ucar.unidata.geoloc.ogc
Class WKTParser

java.lang.Object
  extended by ucar.unidata.geoloc.ogc.WKTParser

public class WKTParser
extends Object

This class parses OGC WKT Spatial Reference Text.

Author:
Barrodale Computing Services, Ltd. (Eric Davies), Unidata Java Development Team

Constructor Summary
WKTParser(String srtext)
          Creates a new instance of WKTParser.
 
Method Summary
static ProjectionImpl convertWKTToProjection(WKTParser srp)
          Convert OGC spatial reference WKT to a ProjectionImpl.
 String getDatumName()
          Get the datum name.
 String getGeogcsName()
          Get the name of the geographic coordinate system.
 String getGeogUnitName()
          Get the name of the unit that the prime meridian is expressed in.
 double getGeogUnitValue()
          Get the size of the unit that the prime meridian is expressed in.
 double getInverseFlattening()
          Get the inverse flattening.
 double getMajorAxis()
          Get the major axis of the spheroid.
 double getParameter(String name)
          Get the value of the projection parameter.
 String getPrimeMeridianName()
          Get the name of the prime meridian.
 double getPrimeMeridianValue()
          Return the value of prime meridian.
 String getProjectionType()
          Get the name of the type of projection.
 String getProjName()
          Get the name of the projection.
 String getProjUnitName()
          Get the name of the projection unit.
 double getProjUnitValue()
          Get the projection unit value.
 String getSpheroidName()
          Get the name of the spheroid.
 boolean hasParameter(String name)
          Inquire if a particular projection parameter is present.
 boolean isPlanarProjection()
          Determine if the spatial reference text defines a planar projection, as opposed to a Geographic coordinate system.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WKTParser

public WKTParser(String srtext)
          throws ParseException
Creates a new instance of WKTParser. If the constructor succeeds, the spatial reference text was successfully parsed.

Parameters:
srtext - The spatial reference text to be parsed. Geocentric coordinate text is not currently supported.
Throws:
ParseException - A ParseException is thrown if the spatial reference text could not be parsed.
Method Detail

getGeogcsName

public String getGeogcsName()
Get the name of the geographic coordinate system.

Returns:
the name.

getDatumName

public String getDatumName()
Get the datum name. Note that the datum name itself implies information not found in the spheroid.

Returns:
The name of the datum.

getSpheroidName

public String getSpheroidName()
Get the name of the spheroid.

Returns:
The name of the spheroid.

getMajorAxis

public double getMajorAxis()
Get the major axis of the spheroid.

Returns:
The major axis of the spheroid, in meters.

getInverseFlattening

public double getInverseFlattening()
Get the inverse flattening.

Returns:
The inverse flattening. Note that this is unitless.

getPrimeMeridianName

public String getPrimeMeridianName()
Get the name of the prime meridian.

Returns:
the name of the prime meridian. Usually "Greenwich".

getPrimeMeridianValue

public double getPrimeMeridianValue()
Return the value of prime meridian.

Returns:
The longitude of the prime meridian, usually 0.

getGeogUnitName

public String getGeogUnitName()
Get the name of the unit that the prime meridian is expressed in.

Returns:
Tje name of the unit that the prime meridian is expressed in. Usually "Degree".

getGeogUnitValue

public double getGeogUnitValue()
Get the size of the unit that the prime meridian is expressed in.

Returns:
The conversion from the prime meridian units to radians.

hasParameter

public boolean hasParameter(String name)
Inquire if a particular projection parameter is present.

Parameters:
name - The name of the parameter. Case is ignored.
Returns:
True if the parameter is present.

getParameter

public double getParameter(String name)
Get the value of the projection parameter. An IllegalArgument exception is thrown if the parameter is not found.

Parameters:
name - The name of the parameter. Case is ignored.
Returns:
The value of the parameter, as a double.

isPlanarProjection

public boolean isPlanarProjection()
Determine if the spatial reference text defines a planar projection, as opposed to a Geographic coordinate system.

Returns:
True if the spatial reference text defines a planar projection system.

getProjName

public String getProjName()
Get the name of the projection.

Returns:
The name of the projection.

getProjectionType

public String getProjectionType()
Get the name of the type of projection.

Returns:
Returns the name of the type of the projection. For example,Transverse_Mercator. Returns null for geographic coordinate systems.

getProjUnitName

public String getProjUnitName()
Get the name of the projection unit.

Returns:
Get the name of the projection unit. Usually "Meter".

getProjUnitValue

public double getProjUnitValue()
Get the projection unit value.

Returns:
The size of the projection unit, in meters.

convertWKTToProjection

public static ProjectionImpl convertWKTToProjection(WKTParser srp)
Convert OGC spatial reference WKT to a ProjectionImpl. An IllegalArgumentException may be thrown if a parameter is missing.

Parameters:
srp - The parsed OGC WKT spatial reference text.
Returns:
The ProjectionImpl class.
Throws:
ParseException - If the OGIS spatial reference text was not parseable.


Copyright © 1999-2011 UCAR/Unidata. All Rights Reserved.