Class TLcdOGCModelReferenceParser

java.lang.Object
com.luciad.reference.format.TLcdOGCModelReferenceParser
All Implemented Interfaces:
ILcdModelReferenceParser, ILcdXYWorldReferenceParser

public class TLcdOGCModelReferenceParser extends Object implements ILcdModelReferenceParser, ILcdXYWorldReferenceParser
Parser for references used in OGC standards such as GML, WMS, AIXM 5, and so on.

Supported model references

  • Most EPSG references, formatted as urn:ogc:def:crs:EPSG::<code>, http://www.opengis.net/gml/srs/epsg.xml#<code>, or EPSG:<code>. Refer to TLcdEPSGReferenceParser for a list of the supported codes.
  • Any WKT reference, formatted as urn:ogc:def:crs:WKT::<URL-encoded WKT string>, WKT:<version>:<URL-encoded WKT string> or WKT:<URL-encoded WKT string>
  • Specific OGC references of the form urn:ogc:def:crs:OGC:<version>:<name>, with <name> being one of CRS84, CRS83, or CRS27
  • Commonly used reference names: WGS84, LL-WGS84 and NAD83

EPSG 4326 axis order in older servers

Many older servers treat EPSG:4326 as a lon-lat reference, even though the EPSG specification dictates a lat-lon order. To interact with these servers, the interpretation of the strings "EPSG:4326" and "http://www.opengis.net/gml/srs/epsg.xml#4326" can be changed to lon-lat as follows:

 TLcdOGCModelReferenceParser parser = new TLcdOGCModelReferenceParser();
 parser.setParseUnprefixedEPSG4326AsLonLat(true);
 parser.setParseGMLPrefixedEPSG4326AsLonLat(true);
 
Other notations of EPSG:4326 (e.g. "urn:ogc:def:crs:EPSG::4326") should not give any problems, because they are only supported by more recent server implementations, which parse the axis order as expected.
Since:
2016.1
  • Constructor Details

    • TLcdOGCModelReferenceParser

      public TLcdOGCModelReferenceParser()
  • Method Details

    • parseModelReference

      public ILcdModelReference parseModelReference(String aUrn) throws ParseException
      Description copied from interface: ILcdModelReferenceParser
      Returns the ILcdModelReference that corresponds to the specified string representation.
      Specified by:
      parseModelReference in interface ILcdModelReferenceParser
      Parameters:
      aUrn - the String representation to be converted to an ILcdModelReference.
      Returns:
      the ILcdModelReference that corresponds to the specified string, never null.
      Throws:
      ParseException - if this parser cannot convert the specified string into a model reference (e.g. if the code is not supported or if the code was not valid)
    • parseXYWorldReference

      public ILcdXYWorldReference parseXYWorldReference(String aUrn) throws ParseException
      Description copied from interface: ILcdXYWorldReferenceParser
      Returns the ILcdXYWorldReference that is formatted as a String.
      Specified by:
      parseXYWorldReference in interface ILcdXYWorldReferenceParser
      Parameters:
      aUrn - the String representation of the ILcdXYWorldReference.
      Returns:
      the ILcdXYWorldReference that is formatted as a String. Never null.
      Throws:
      ParseException - If the ILcdXYWorldReference cannot be created from the String.
    • setParseUnprefixedEPSG4326AsLonLat

      public void setParseUnprefixedEPSG4326AsLonLat(boolean aParseUnprefixedEPSG4326AsLonLat)
      If true, parses the "EPSG:4326" string as a lon-lat reference instead of the more correct lat-lon. Older WMS servers and GML versions may rely on this interpretation. The default and recommended value is false. The OGC prepended variant "urn:ogc:def:crs:EPSG::4326" will always be parsed as lat-lon, regardless of this setting.
      Parameters:
      aParseUnprefixedEPSG4326AsLonLat - true to parse "EPSG:4326" as a lon-lat reference
    • isParseUnprefixedEPSG4326AsLonLat

      public boolean isParseUnprefixedEPSG4326AsLonLat()
      Returns whether or not the parser interprets the "EPSG:4326" string as being lon-lat instead of the more correct lat-lon.
      Returns:
      true if the parser interprets the "EPSG:4326" string as a lon-lat reference.
      See Also:
    • setParseGMLPrefixedEPSG4326AsLonLat

      public void setParseGMLPrefixedEPSG4326AsLonLat(boolean aParseGMLPrefixedEPSG4326AsLonLat)
      If true, parses the "http://www.opengis.net/gml/srs/epsg.xml#4326" string as a lon-lat reference instead of the more correct lat-lon. Older WMS servers and GML versions may rely on this interpretation. The default and recommended value is false. The OGC prepended variant "urn:ogc:def:crs:EPSG::4326" will always be parsed as lat-lon, regardless of this setting.
      Parameters:
      aParseGMLPrefixedEPSG4326AsLonLat - true to parse "http://www.opengis.net/gml/srs/epsg.xml#4326" as a lon-lat reference
    • isParseGMLPrefixedEPSG4326AsLonLat

      public boolean isParseGMLPrefixedEPSG4326AsLonLat()
      Returns whether or not the parser interprets the "http://www.opengis.net/gml/srs/epsg.xml#4326" string as being lon-lat instead of the more correct lat-lon.
      Returns:
      true if the parser interprets the "http://www.opengis.net/gml/srs/epsg.xml#4326" string as a lon-lat reference.
      See Also: