Hi Jukka,
I wonder if this can help:
In Java:
*SRSInfo srsInfo = ProjUtils.getSRSInfoFromLayerStyleOrSource(layer); *where
layer is Layer.class
(Actually OJ reads Layer.class SRS, if available from tag file or from
auxiliary (PRJ/AUX/AUX.XML) file, on loading that file. SRS info is saved
as SRSStyle)
*String source = srsInfo.getSource();*
It gives back where SRS info are islocated
for instance:
"C:/Folder/file.prj"
or
"Geotiff tag"
*String SRS = srsInfo.toString();*
it gives back a string with minimum SRS info
"EPSG:32632 WGS 84 UTM zone 32N [metre]"
Eventually all those info can be separated:
*srsInfo.toString().getRegistry* -->"EPSG"
*srsInfo.toString().getCode *-->"32632"
*srsInfo.toString().getDescription* --> "WGS 84 UTM zone 32N"
*srsInfo.toString().getUnit* --> "metre"
The method works also for RasterImageLayer.class
Peppe
2017-06-27 15:56 GMT+02:00 Rahkonen Jukka (MML) <
jukka.rahko...@maanmittauslaitos.fi>:
> Hi,
>
>
>
> If layers can know their SRS I wonder how could I read the value with
> BeanShell.
>
>
>
> For example what to do for edding the EPSG code to this snippet that
> writes upper left – lower right coordinates for a GDAL command
>
>
>
> htmlFrame.setTitle("BBOX Output");
>
> fc = wc.getLayerNamePanel().getSelectedLayers()[0].
> getFeatureCollectionWrapper();
>
> int j=1;
>
> for (Iterator i = fc.getFeatures().iterator(); i.hasNext();) {
>
> Feature feature = (Feature) i.next();
>
> Geometry geometry = feature.getGeometry();
>
> Envelope env = geometry.getEnvelopeInternal();
>
> htmlFrame.addText("gdal_translate "
>
> +"-of MBTiles "
>
> +"-projwin "
>
> +env.getMinX()+" "
>
> +env.getMaxY()+" "
>
> +env.getMaxX()+" "
>
> +env.getMinY()+" "
>
> +"-projwin_srs epsg:"
>
> + WHAT?
>
>
>
>
>
> -Jukka Rahkonen-
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel