Hello again,

I found a very interesting document about wkt-problems 
(http://home.gdal.org/projects/opengis/wktproblems.html). In the examples we 
can see two different uses of the Authority Element, one with annotation marks 
for the code and one without.
What do you think about making the parser class in the parseAuthority method 
more flexible? Is there any special reason why calling
element.pullString("code")? What about call
element.pullInteger("code")
and if that fails call the pullString method?

Any sugesstions?

In regards,

Frank

> Hello,
> 
> I created a GIS application using the ESRI soap Services and stumbled a bit. 
> From a layer I get the WKT per soap request for the reference system and I 
> would like to use the wkt to transform into a corrdinate reference system the 
> user have chosen.
> 
> But I got a ParseExcpetion for the AUTHORITY Parameter:
> 
> java.text.ParseException: Error in "AUTHORITY": Parameter "code" is missing.
>       at org.geotools.referencing.wkt.Element.pullString(Element.java:419)
>       at org.geotools.referencing.wkt.Parser.parseAuthority(Parser.java:338)
>       at org.geotools.referencing.wkt.Parser.parseProjCS(Parser.java:883)
>       at 
> org.geotools.referencing.wkt.Parser.parseCoordinateReferenceSystem(Parser.java:222)
>       at 
> org.geotools.referencing.wkt.Parser.parseCoordinateReferenceSystem(Parser.java:201)
> 
> within the wkt-string the AUTHORITY section looks like : 
> 
>     AUTHORITY["ESRI",102018] 
> 
> I read the document 
> (http://geoapi.sourceforge.net/snapshot/javadoc/org/opengis/referencing/doc-files/WKT.html)
>  and dived into the Parser code too. I guess the code value should be a 
> string.
> 
> Did somebody else run into such problems? And what's the best way to handle 
> these WKT's? Is it required to call setAuthority before 
> parseCoordinateReferenceSystem? See the attached file for the test that fails.
> 
> Thanks for help!
> 
> Regards, 
> 
> Frank
> 
> 
> <hr>
> ------------------------------------------------------------------------------
> 
> 
> <hr>
> _______________________________________________
> Geotools-devel mailing list
> Geotools-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-devel
> 
> 


import org.geotools.referencing.wkt.Parser;
import org.junit.Test;

public class WKTParserTests
{

    private String ORG_ESRI_WKT_FROM_SOAP = "PROJCS[\"North_Pole_Stereographic\",GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Stereographic\"],PARAMETER[\"False_Easting\",0.0],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",0.0],PARAMETER[\"Scale_Factor\",1.0],PARAMETER[\"Latitude_Of_Origin\",90.0],UNIT[\"Meter\",1.0],AUTHORITY[\"ESRI\",102018]]";


    /**
     * should run but fails with an ParseException
     * @throws Exception
     */
    @Test
    public void testParserFailed() throws Exception
    {

        Parser parser = new Parser();
        parser.parseCoordinateReferenceSystem(ORG_ESRI_WKT_FROM_SOAP);

    }
}

------------------------------------------------------------------------------
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to