In the class SridLookupTable there is a method, experimental and not yet
used.
This method, giving a string EPSG code (like "4326") should give back the
conresponding OGC WKT definition

String OGC = SridLookupTable.getOGCWKTFromWkidCode(String code)

for instance String OGC = SridLookupTable.getOGCWKTFromWkidCode("4326")
should give back :

GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS
84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,
AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]

2017-06-27 16:28 GMT+02:00 Giuseppe Aruta <giuseppe.ar...@gmail.com>:

> 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.rahkonen@
> 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].getFeatureColl
>> ectionWrapper();
>>
>> 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