Hi Jukka,

I think you can't use wc.getLayerNamePanel().getSelectedLayers()[0]
because it is an old method returning only vector layers

Instead, you can use wc.getLayerNamePanel().getSelectedLayerables().get(0)
If you keep a reference to the layer :
*lyr = wc.layerNamePanel.selectedLayerables.get(0)*

then you can get the SRS from the layer this way :
*lyr.getSRS()*

Hope that helps,

Michaël

Le 27/06/2017 à 15:56, Rahkonen Jukka (MML) a écrit :

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

Reply via email to