|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.gdal.osr.SpatialReference
public class SpatialReference
This class respresents a OpenGIS Spatial Reference System, and contains methods for converting between this object organization and well known text (WKT) format. This object is reference counted as one instance of the object is normally shared between many Geometry objects.
The SpatialReference class is a binding for the C++ OGRSpatialReference class.
Normally application code can fetch needed parameter values for this SRS using GetAttrValue(), but in special cases the underlying parse tree (or OGR_SRSNode objects) can be accessed more directly.
See the tutorial for more information on how to use this class.
Constructor Summary | |
---|---|
SpatialReference()
Constructor. |
|
SpatialReference(String wkt)
Constructor. |
Method Summary | |
---|---|
String |
__str__()
Convert this SRS into a pretty WKT format. |
int |
AutoIdentifyEPSG()
Set EPSG authority info if possible. |
Object |
clone()
|
SpatialReference |
Clone()
Make a duplicate of this SpatialReference object. |
SpatialReference |
CloneGeogCS()
Make a duplicate of the GEOGCS node of this SpatialReference object. |
int |
CopyGeogCSFrom(SpatialReference src_srs)
Copy GEOGCS from another OGRSpatialReference. |
void |
delete()
|
int |
EPSGTreatsAsLatLong()
|
boolean |
equals(Object obj)
|
String |
ExportToMICoordSys()
Export coordinate system in Mapinfo style CoordSys format. |
int |
ExportToMICoordSys(String[] argout)
Export coordinate system in Mapinfo style CoordSys format. |
int |
ExportToPCI(String[] proj,
String[] units,
double[] parms)
Export coordinate system in PCI projection definition. |
String |
ExportToPrettyWkt()
Convert this SRS into a a nicely formatted WKT string for display to a person. |
String |
ExportToPrettyWkt(int simplify)
Convert this SRS into a a nicely formatted WKT string for display to a person. |
int |
ExportToPrettyWkt(String[] argout)
Convert this SRS into a a nicely formatted WKT string for display to a person. |
int |
ExportToPrettyWkt(String[] argout,
int simplify)
Convert this SRS into a a nicely formatted WKT string for display to a person. |
String |
ExportToProj4()
Export coordinate system in PROJ.4 format. |
int |
ExportToProj4(String[] argout)
Export coordinate system in PROJ.4 format. |
int |
ExportToUSGS(int[] projsys,
int[] zone,
double[] parms,
int[] datum)
Export coordinate system in USGS GCTP projection definition. |
String |
ExportToWkt()
Convert this SRS into WKT format. |
int |
ExportToWkt(String[] argout)
Convert this SRS into WKT format. |
String |
ExportToXML()
Export coordinate system in XML format. |
String |
ExportToXML(String dialect)
Export coordinate system in XML format. |
int |
ExportToXML(String[] argout)
Export coordinate system in XML format. |
int |
ExportToXML(String[] argout,
String dialect)
Export coordinate system in XML format. |
int |
Fixup()
Fixup as needed. |
int |
FixupOrdering()
Correct parameter ordering to match CT Specification. |
double |
GetAngularUnits()
Fetch angular geographic coordinate system units. |
String |
GetAttrValue(String name)
Fetch first attribute of named node. |
String |
GetAttrValue(String name,
int child)
Fetch indicated attribute of named node. |
String |
GetAuthorityCode(String target_key)
Get the authority code for a node. |
String |
GetAuthorityName(String target_key)
Get the authority name for a node. |
double |
GetLinearUnits()
Fetch linear projection units. |
String |
GetLinearUnitsName()
Fetch linear projection units name. |
double |
GetNormProjParm(String name)
Fetch a normalized projection parameter value. |
double |
GetNormProjParm(String name,
double default_val)
Fetch a normalized projection parameter value. |
double |
GetProjParm(String name)
Fetch a projection parameter value. |
double |
GetProjParm(String name,
double default_val)
Fetch a projection parameter value. |
double[] |
GetTOWGS84()
Fetch TOWGS84 parameters, if available. |
int |
GetTOWGS84(double[] argout)
Fetch TOWGS84 parameters, if available. |
int |
GetUTMZone()
Get UTM zone information. |
int |
hashCode()
|
int |
ImportFromEPSG(int nCode)
Initialize SRS based on EPSG GCS or PCS code. |
int |
ImportFromEPSGA(int arg)
|
int |
ImportFromESRI(Vector ppszInput)
Import coordinate system from ESRI .prj format(s). |
int |
ImportFromMICoordSys(String coord_sys)
Import Mapinfo style CoordSys definition. |
int |
ImportFromPCI(String proj)
Import coordinate system from PCI projection definition. |
int |
ImportFromPCI(String proj,
String units)
Import coordinate system from PCI projection definition. |
int |
ImportFromPCI(String proj,
String units,
double[] prjParams)
Import coordinate system from PCI projection definition. |
int |
ImportFromProj4(String proj4)
Import PROJ.4 coordinate string. |
int |
ImportFromUrl(String url)
Set spatial reference from a URL. |
int |
ImportFromUSGS(int iProjSys)
Import coordinate system from USGS projection definition. |
int |
ImportFromUSGS(int iProjSys,
int iZone)
Import coordinate system from USGS projection definition. |
int |
ImportFromUSGS(int iProjSys,
int iZone,
double[] padfPrjParams)
Import coordinate system from USGS projection definition. |
int |
ImportFromUSGS(int iProjSys,
int iZone,
double[] padfPrjParams,
int iDatum)
Import coordinate system from USGS projection definition. |
int |
ImportFromWkt(String wkt)
Import from WKT string. |
int |
ImportFromXML(String xmlString)
Import coordinate system from XML format (GML only currently). |
int |
IsGeographic()
Check if geographic coordinate system. |
int |
IsLocal()
Check if local coordinate system. |
int |
IsProjected()
Check if projected coordinate system. |
int |
IsSame(SpatialReference other)
Do these two spatial references describe the same system ? |
int |
IsSameGeogCS(SpatialReference other)
Do the GeogCS'es match? |
int |
MorphFromESRI()
Convert in place from ESRI WKT format. |
int |
MorphToESRI()
Convert in place to ESRI WKT format. |
int |
SetACEA(double stdp1,
double stdp2,
double clat,
double clong,
double fe,
double fn)
|
int |
SetAE(double clat,
double clong,
double fe,
double fn)
|
int |
SetAngularUnits(String name,
double to_radians)
Set the angular units for the geographic coordinate system. |
int |
SetAttrValue(String name,
String value)
Set attribute value in spatial reference. |
int |
SetAuthority(String target_key,
String authority,
int code)
Set the authority for a node. |
int |
SetBonne(double stdp,
double cm,
double fe,
double fn)
|
int |
SetCEA(double stdp1,
double cm,
double fe,
double fn)
|
int |
SetCS(double clat,
double clong,
double fe,
double fn)
|
int |
SetEC(double stdp1,
double stdp2,
double clat,
double clong,
double fe,
double fn)
|
int |
SetEckertIV(double cm,
double fe,
double fn)
|
int |
SetEckertVI(double cm,
double fe,
double fn)
|
int |
SetEquirectangular(double clat,
double clong,
double fe,
double fn)
|
int |
SetEquirectangular2(double clat,
double clong,
double pseudostdparallellat,
double fe,
double fn)
|
int |
SetFromUserInput(String definition)
Set spatial reference from various text formats. |
int |
SetGaussSchreiberTMercator(double clat,
double clong,
double sc,
double fe,
double fn)
|
int |
SetGeogCS(String pszGeogName,
String pszDatumName,
String pszSpheroidName,
double dfSemiMajor,
double dfInvFlattening)
Set geographic coordinate system. |
int |
SetGeogCS(String pszGeogName,
String pszDatumName,
String pszSpheroidName,
double dfSemiMajor,
double dfInvFlattening,
String pszPMName)
Set geographic coordinate system. |
int |
SetGeogCS(String pszGeogName,
String pszDatumName,
String pszSpheroidName,
double dfSemiMajor,
double dfInvFlattening,
String pszPMName,
double dfPMOffset)
Set geographic coordinate system. |
int |
SetGeogCS(String pszGeogName,
String pszDatumName,
String pszSpheroidName,
double dfSemiMajor,
double dfInvFlattening,
String pszPMName,
double dfPMOffset,
String pszAngularUnits)
Set geographic coordinate system. |
int |
SetGeogCS(String pszGeogName,
String pszDatumName,
String pszSpheroidName,
double dfSemiMajor,
double dfInvFlattening,
String pszPMName,
double dfPMOffset,
String pszAngularUnits,
double dfConvertToRadians)
Set geographic coordinate system. |
int |
SetGEOS(double cm,
double satelliteheight,
double fe,
double fn)
|
int |
SetGH(double cm,
double fe,
double fn)
|
int |
SetGnomonic(double clat,
double clong,
double fe,
double fn)
|
int |
SetGS(double cm,
double fe,
double fn)
|
int |
SetHOM(double clat,
double clong,
double azimuth,
double recttoskew,
double scale,
double fe,
double fn)
|
int |
SetHOM2PNO(double clat,
double dfLat1,
double dfLong1,
double dfLat2,
double dfLong2,
double scale,
double fe,
double fn)
|
int |
SetKrovak(double clat,
double clong,
double azimuth,
double pseudostdparallellat,
double scale,
double fe,
double fn)
|
int |
SetLAEA(double clat,
double clong,
double fe,
double fn)
|
int |
SetLCC(double stdp1,
double stdp2,
double clat,
double clong,
double fe,
double fn)
|
int |
SetLCC1SP(double clat,
double clong,
double scale,
double fe,
double fn)
|
int |
SetLCCB(double stdp1,
double stdp2,
double clat,
double clong,
double fe,
double fn)
|
int |
SetLinearUnits(String name,
double to_meters)
Set the linear units for the projection. |
int |
SetLinearUnitsAndUpdateParameters(String name,
double to_meters)
Set the linear units for the projection. |
int |
SetLocalCS(String name)
Set the user visible LOCAL_CS name. |
int |
SetMC(double clat,
double clong,
double fe,
double fn)
|
int |
SetMercator(double clat,
double clong,
double scale,
double fe,
double fn)
|
int |
SetMollweide(double cm,
double fe,
double fn)
|
int |
SetNormProjParm(String name,
double val)
Set a projection parameter with a normalized value. |
int |
SetNZMG(double clat,
double clong,
double fe,
double fn)
|
int |
SetOrthographic(double clat,
double clong,
double fe,
double fn)
|
int |
SetOS(double dfOriginLat,
double dfCMeridian,
double scale,
double fe,
double fn)
|
int |
SetPolyconic(double clat,
double clong,
double fe,
double fn)
|
int |
SetProjCS()
Set the user visible PROJCS name. |
int |
SetProjCS(String name)
Set the user visible PROJCS name. |
int |
SetProjection(String name)
Set a projection name. |
int |
SetProjParm(String name,
double val)
Set a projection parameter value. |
int |
SetPS(double clat,
double clong,
double scale,
double fe,
double fn)
|
int |
SetRobinson(double clong,
double fe,
double fn)
|
int |
SetSinusoidal(double clong,
double fe,
double fn)
|
int |
SetSOC(double latitudeoforigin,
double cm,
double fe,
double fn)
|
int |
SetStatePlane(int zone)
Set State Plane projection definition. |
int |
SetStatePlane(int zone,
int is_nad83)
Set State Plane projection definition. |
int |
SetStatePlane(int zone,
int is_nad83,
String unitsname)
Set State Plane projection definition. |
int |
SetStatePlane(int zone,
int is_nad83,
String unitsname,
double units)
Set State Plane projection definition. |
int |
SetStereographic(double clat,
double clong,
double scale,
double fe,
double fn)
|
int |
SetTM(double clat,
double clong,
double scale,
double fe,
double fn)
|
int |
SetTMG(double clat,
double clong,
double fe,
double fn)
|
int |
SetTMSO(double clat,
double clong,
double scale,
double fe,
double fn)
|
int |
SetTMVariant(String pszVariantName,
double clat,
double clong,
double scale,
double fe,
double fn)
|
int |
SetTOWGS84(double p1,
double p2,
double p3)
Set the Bursa-Wolf conversion to WGS84. |
int |
SetTOWGS84(double dfDX,
double dfDY,
double dfDZ,
double dfEX,
double dfEY,
double dfEZ,
double dfPPM)
Set the Bursa-Wolf conversion to WGS84. |
int |
SetUTM(int zone)
Set UTM projection definition. |
int |
SetUTM(int zone,
int north)
Set UTM projection definition. |
int |
SetVDG(double clong,
double fe,
double fn)
|
int |
SetWellKnownGeogCS(String name)
Set a GeogCS based on well known name. |
int |
StripCTParms()
Strip OGC CT Parameters. |
String |
toString()
Convert this SRS into a pretty WKT format. |
int |
Validate()
Validate SRS tokens. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SpatialReference(String wkt)
wkt
- well known text definition to which the object should
be initialized, or null (the default).public SpatialReference()
SpatialReference(String wkt)
Method Detail |
---|
public void delete()
public boolean equals(Object obj)
equals
in class Object
public Object clone()
clone
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
public String ExportToWkt()
ExportToWkt(String[] argout)
public String ExportToPrettyWkt(int simplify)
ExportToPrettyWkt(String[] argout, int simplify)
public String ExportToPrettyWkt()
ExportToPrettyWkt(String[] argout, int simplify)
public String ExportToProj4()
ExportToProj4(String[] argout)
public String ExportToXML(String dialect)
ExportToXML(String[] argout, String dialect)
public String ExportToXML()
ExportToXML(String[] argout, String dialect)
public String ExportToMICoordSys()
public double[] GetTOWGS84()
public int SetTOWGS84(double p1, double p2, double p3)
SetTOWGS84(double dfDX, double dfDY, double dfDZ, double dfEX, double dfEY, double dfEZ, double dfPPM)
public String __str__()
public int IsSame(SpatialReference other)
other
- the SRS being compared to.
public int IsSameGeogCS(SpatialReference other)
other
- the SRS being compared against.
public int IsGeographic()
public int IsProjected()
public int IsLocal()
public int EPSGTreatsAsLatLong()
public int SetAuthority(String target_key, String authority, int code)
target_key
- the partial or complete path to the node to
set an authority on. ie. "PROJCS", "GEOGCS" or "GEOGCS|UNIT".authority
- authority name, such as "EPSG".code
- code for value with this authority.
public String GetAttrValue(String name, int child)
name
- the tree node to look for (case insensitive).child
- the child of the node to fetch (zero based).
public String GetAttrValue(String name)
name
- the tree node to look for (case insensitive).
public int SetAttrValue(String name, String value)
name
- full path to attribute to be set. For instance
"PROJCS|GEOGCS|UNITS".value
- value to be assigned to node, such as "meter".
This may be null if you just want to force creation of the intermediate
path.
public int SetAngularUnits(String name, double to_radians)
name
- the units name to be used. Some preferred units
names can be found in ogr_srs_api.h such as SRS_UA_DEGREE.to_radians
- the value to multiple by an angle in the indicated
units to transform to radians. Some standard conversion factors can
be found in ogr_srs_api.h.
public double GetAngularUnits()
public int SetLinearUnits(String name, double to_meters)
name
- the units name to be used. Some preferred units
names can be found in ogr_srs_api.h such as SRS_UL_METER, SRS_UL_FOOT
and SRS_UL_US_FOOT.to_meters
- the value to multiple by a length in the indicated
units to transform to meters. Some standard conversion factors can
be found in ogr_srs_api.h.
public int SetLinearUnitsAndUpdateParameters(String name, double to_meters)
name
- the units name to be used. Some preferred units
names can be found in ogr_srs_api.h such as SRS_UL_METER, SRS_UL_FOOT
and SRS_UL_US_FOOT.to_meters
- the value to multiple by a length in the indicated
units to transform to meters. Some standard conversion factors can
be found in ogr_srs_api.h.
public double GetLinearUnits()
public String GetLinearUnitsName()
public String GetAuthorityCode(String target_key)
While in theory values may be non-numeric, for the EPSG authority all code values should be integral.
target_key
- the partial or complete path to the node to
get an authority from. ie. "PROJCS", "GEOGCS", "GEOGCS|UNIT" or null to
search for an authority node on the root element.
public String GetAuthorityName(String target_key)
The most common authority is "EPSG".
target_key
- the partial or complete path to the node to
get an authority from. ie. "PROJCS", "GEOGCS", "GEOGCS|UNIT" or null to
search for an authority node on the root element.
public int SetUTM(int zone, int north)
zone
- UTM zone.north
- 1 for northern hemisphere, or 0 for southern
hemisphere.
public int SetUTM(int zone)
SetUTM(int zone, int north)
public int GetUTMZone()
public int SetStatePlane(int zone, int is_nad83, String unitsname, double units)
zone
- State plane zone number, in the USGS numbering scheme (as
dinstinct from the Arc/Info and Erdas numbering scheme.is_nad83
- 1 if the NAD83 zone definition should be used or 0
if the NAD27 zone definition should be used.unitsname
- Linear unit name to apply overriding the
legal definition for this zone.units
- Linear unit conversion factor to apply overriding
the legal definition for this zone.
public int SetStatePlane(int zone, int is_nad83, String unitsname)
SetStatePlane(int zone, int is_nad83, String unitsname, double units)
public int SetStatePlane(int zone, int is_nad83)
SetStatePlane(int zone, int is_nad83, String unitsname, double units)
public int SetStatePlane(int zone)
SetStatePlane(int zone, int is_nad83, String unitsname, double units)
public int AutoIdentifyEPSG()
If it success the OGRSpatialReference is updated in place, and the method return 0. If the method fails to identify the general coordinate system, a RuntimeException() will be throwned
public int SetProjection(String name)
name
- the projection name, which should be selected from
the macros in ogr_srs_api.h, such as SRS_PT_TRANSVERSE_MERCATOR.
public int SetProjParm(String name, double val)
Please check http://www.remotesensing.org/geotiff/proj_list pages for legal parameter names for specific projections.
name
- the parameter name, which should be selected from
the macros in ogr_srs_api.h, such as SRS_PP_CENTRAL_MERIDIAN.val
- value to assign.
public double GetProjParm(String name, double default_val)
name
- the name of the parameter to fetch, from the set of
SRS_PP codes in ogr_srs_api.h.default_val
- the value to return if this parameter doesn't exist.
public double GetProjParm(String name)
GetProjParm(String name, double default_val)
public int SetNormProjParm(String name, double val)
name
- the parameter name, which should be selected from
the macros in ogr_srs_api.h, such as SRS_PP_CENTRAL_MERIDIAN.val
- value to assign.
public double GetNormProjParm(String name, double default_val)
name
- the name of the parameter to fetch, from the set of
SRS_PP codes in ogr_srs_api.h.default_val
- the value to return if this parameter doesn't exist.
public double GetNormProjParm(String name)
GetNormProjParm(String name, double default_val)
public int SetACEA(double stdp1, double stdp2, double clat, double clong, double fe, double fn)
public int SetAE(double clat, double clong, double fe, double fn)
public int SetBonne(double stdp, double cm, double fe, double fn)
public int SetCEA(double stdp1, double cm, double fe, double fn)
public int SetCS(double clat, double clong, double fe, double fn)
public int SetEC(double stdp1, double stdp2, double clat, double clong, double fe, double fn)
public int SetEckertIV(double cm, double fe, double fn)
public int SetEckertVI(double cm, double fe, double fn)
public int SetEquirectangular(double clat, double clong, double fe, double fn)
public int SetEquirectangular2(double clat, double clong, double pseudostdparallellat, double fe, double fn)
public int SetGaussSchreiberTMercator(double clat, double clong, double sc, double fe, double fn)
public int SetGS(double cm, double fe, double fn)
public int SetGH(double cm, double fe, double fn)
public int SetGEOS(double cm, double satelliteheight, double fe, double fn)
public int SetGnomonic(double clat, double clong, double fe, double fn)
public int SetHOM(double clat, double clong, double azimuth, double recttoskew, double scale, double fe, double fn)
public int SetHOM2PNO(double clat, double dfLat1, double dfLong1, double dfLat2, double dfLong2, double scale, double fe, double fn)
public int SetKrovak(double clat, double clong, double azimuth, double pseudostdparallellat, double scale, double fe, double fn)
public int SetLAEA(double clat, double clong, double fe, double fn)
public int SetLCC(double stdp1, double stdp2, double clat, double clong, double fe, double fn)
public int SetLCC1SP(double clat, double clong, double scale, double fe, double fn)
public int SetLCCB(double stdp1, double stdp2, double clat, double clong, double fe, double fn)
public int SetMC(double clat, double clong, double fe, double fn)
public int SetMercator(double clat, double clong, double scale, double fe, double fn)
public int SetMollweide(double cm, double fe, double fn)
public int SetNZMG(double clat, double clong, double fe, double fn)
public int SetOS(double dfOriginLat, double dfCMeridian, double scale, double fe, double fn)
public int SetOrthographic(double clat, double clong, double fe, double fn)
public int SetPolyconic(double clat, double clong, double fe, double fn)
public int SetPS(double clat, double clong, double scale, double fe, double fn)
public int SetRobinson(double clong, double fe, double fn)
public int SetSinusoidal(double clong, double fe, double fn)
public int SetStereographic(double clat, double clong, double scale, double fe, double fn)
public int SetSOC(double latitudeoforigin, double cm, double fe, double fn)
public int SetTM(double clat, double clong, double scale, double fe, double fn)
public int SetTMVariant(String pszVariantName, double clat, double clong, double scale, double fe, double fn)
public int SetTMG(double clat, double clong, double fe, double fn)
public int SetTMSO(double clat, double clong, double scale, double fe, double fn)
public int SetVDG(double clong, double fe, double fn)
public int SetWellKnownGeogCS(String name)
The following well known text values are currently supported:
name
- name of well known geographic coordinate system.
public int SetFromUserInput(String definition)
This method is intended to be flexible, but by it's nature it is imprecise as it must guess information about the format intended. When possible applications should call the specific method appropriate if the input is known to be in a particular format.
definition
- text definition to try to deduce SRS from.
public int CopyGeogCSFrom(SpatialReference src_srs)
src_srs
- the spatial reference to copy the GEOGCS information from.
public int SetTOWGS84(double dfDX, double dfDY, double dfDZ, double dfEX, double dfEY, double dfEZ, double dfPPM)
The parameters have the same meaning as EPSG transformation 9606 (Position Vector 7-param. transformation).
dfDX
- X child in meters.dfDY
- Y child in meters.dfDZ
- Z child in meters.dfEX
- X rotation in arc seconds (optional, defaults to zero).dfEY
- Y rotation in arc seconds (optional, defaults to zero).dfEZ
- Z rotation in arc seconds (optional, defaults to zero).dfPPM
- scaling factor (parts per million).
public int GetTOWGS84(double[] argout)
argout
- allocated array of 7 doubles into which up to 7 coefficients are placed.
public int SetLocalCS(String name)
name
- the user visible name to assign. Not used as a key.
public int SetGeogCS(String pszGeogName, String pszDatumName, String pszSpheroidName, double dfSemiMajor, double dfInvFlattening, String pszPMName, double dfPMOffset, String pszAngularUnits, double dfConvertToRadians)
pszGeogName
- user visible name for the geographic coordinate system
(not to serve as a key).pszDatumName
- key name for this datum. The OpenGIS specification
lists some known values, and otherwise EPSG datum names with a standard
transformation are considered legal keys.pszSpheroidName
- user visible spheroid name (not to serve as a key)dfSemiMajor
- the semi major axis of the spheroid.dfInvFlattening
- the inverse flattening for the spheroid.
This can be computed from the semi minor axis as
1/f = 1.0 / (1.0 - semiminor/semimajor).pszPMName
- the name of the prime merdidian (not to serve as a key)
If this is null a default value of "Greenwich" will be used.dfPMOffset
- the longitude of greenwich relative to this prime
meridian.pszAngularUnits
- the angular units name (see ogr_srs_api.h for some
standard names). If null a value of "degrees" will be assumed.dfConvertToRadians
- value to multiply angular units by to transform
them to radians. A value of SRS_UL_DEGREE_CONV will be used if
pszAngularUnits is null.
public int SetGeogCS(String pszGeogName, String pszDatumName, String pszSpheroidName, double dfSemiMajor, double dfInvFlattening, String pszPMName, double dfPMOffset, String pszAngularUnits)
SetGeogCS(String pszGeogName, String pszDatumName, String pszSpheroidName, double dfSemiMajor, double dfInvFlattening, String pszPMName, double dfPMOffset, String pszUnits, double dfConvertToRadians)
public int SetGeogCS(String pszGeogName, String pszDatumName, String pszSpheroidName, double dfSemiMajor, double dfInvFlattening, String pszPMName, double dfPMOffset)
SetGeogCS(String pszGeogName, String pszDatumName, String pszSpheroidName, double dfSemiMajor, double dfInvFlattening, String pszPMName, double dfPMOffset, String pszAngularUnits, double dfConvertToRadians)
public int SetGeogCS(String pszGeogName, String pszDatumName, String pszSpheroidName, double dfSemiMajor, double dfInvFlattening, String pszPMName)
SetGeogCS(String pszGeogName, String pszDatumName, String pszSpheroidName, double dfSemiMajor, double dfInvFlattening, String pszPMName, double dfPMOffset, String pszAngularUnits, double dfConvertToRadians)
public int SetGeogCS(String pszGeogName, String pszDatumName, String pszSpheroidName, double dfSemiMajor, double dfInvFlattening)
SetGeogCS(String pszGeogName, String pszDatumName, String pszSpheroidName, double dfSemiMajor, double dfInvFlattening, String pszPMName, double dfPMOffset, String pszAngularUnits, double dfConvertToRadians)
public int SetProjCS(String name)
name
- the user visible name to assign. May be null
public int SetProjCS()
SetProjCS(String name)
public int ImportFromWkt(String wkt)
wkt
- WKT string
public int ImportFromProj4(String proj4)
Example: pszProj4 = "+proj=utm +zone=11 +datum=WGS84"
Some parameters, such as grids, recognised by PROJ.4 may not be well understood and translated into the OGRSpatialReference model. It is possible to add the +wktext parameter which is a special keyword that OGR recognises as meaning "embed the entire PROJ.4 string in the WKT and use it literally when converting back to PROJ.4 format".
For example: "+proj=nzmg +lat_0=-41 +lon_0=173 +x_0=2510000 +y_0=6023150 +ellps=intl +units=m +nadgrids=nzgd2kgrid0005.gsb +wktext"
will be translated as :
PROJCS["unnamed", GEOGCS["International 1909 (Hayford)", DATUM["unknown", SPHEROID["intl",6378388,297]], PRIMEM["Greenwich",0], UNIT["degree",0.0174532925199433]], PROJECTION["New_Zealand_Map_Grid"], PARAMETER["latitude_of_origin",-41], PARAMETER["central_meridian",173], PARAMETER["false_easting",2510000], PARAMETER["false_northing",6023150], UNIT["Meter",1], EXTENSION["PROJ4","+proj=nzmg +lat_0=-41 +lon_0=173 +x_0=2510000 +y_0=6023150 +ellps=intl +units=m +nadgrids=nzgd2kgrid0005.gsb +wktext"]]
proj4
- the PROJ.4 style string.
public int ImportFromUrl(String url)
url
- text definition to try to deduce SRS from.
public int ImportFromESRI(Vector ppszInput)
Currently only GEOGRAPHIC, UTM, STATEPLANE, GREATBRITIAN_GRID, ALBERS, EQUIDISTANT_CONIC, and TRANSVERSE (mercator) projections are supported from old style files.
At this time there is no equivelent exportToESRI() method. Writing old style .prj files is not supported by OGRSpatialReference. However the morphToESRI() and exportToWkt() methods can be used to generate output suitable to write to new style (Arc 8) .prj files.
ppszInput
- vector of strings containing the definition.
public int ImportFromEPSG(int nCode)
These support files are normally searched for in /usr/local/share/gdal or in the directory identified by the GDAL_DATA configuration option. See CPLFindFile() for details.
This method is relatively expensive, and generally involves quite a bit of text file scanning. Reasonable efforts should be made to avoid calling it many times for the same coordinate system.
This method is similar to importFromEPSGA() except that EPSG preferred axis ordering will *not* be applied for geographic coordinate systems. EPSG normally defines geographic coordinate systems to use lat/long contrary to typical GIS use).
nCode
- a GCS or PCS code from the horizontal coordinate system table.
public int ImportFromEPSGA(int arg)
public int ImportFromPCI(String proj, String units, double[] prjParams)
proj
- string containing the definition. Looks
like "pppppppppppp Ennn" or "pppppppppppp Dnnn", where "pppppppppppp" is
a projection code, "Ennn" is an ellipsoid code, "Dnnn" --- a datum code.units
- Grid units code ("DEGREE" or "METRE"). If null, "METRE" will
be used.prjParams
- Array of 17 coordinate system parameters:
[0] Spheroid semi major axis [1] Spheroid semi minor axis [2] Reference Longitude [3] Reference Latitude [4] First Standard Parallel [5] Second Standard Parallel [6] False Easting [7] False Northing [8] Scale Factor [9] Height above sphere surface [10] Longitude of 1st point on center line [11] Latitude of 1st point on center line [12] Longitude of 2nd point on center line [13] Latitude of 2nd point on center line [14] Azimuth east of north for center line [15] Landsat satellite number [16] Landsat path numberParticular projection uses different parameters, unused ones may be set to zero. If null supplied instead of array pointer default values will be used (i.e., zeroes).
public int ImportFromPCI(String proj, String units)
ImportFromPCI(String proj, String units, double[] prjParams)
public int ImportFromPCI(String proj)
ImportFromPCI(String proj, String units, double[] prjParams)
public int ImportFromUSGS(int iProjSys, int iZone, double[] padfPrjParams, int iDatum)
---------------------------------------------------------------------------- | Array Element Code & Projection Id |--------------------------------------------------- | 0 | 1 | 2 | 3 | 4 | 5 |6 | 7 ---------------------------------------------------------------------------- 0 Geographic | | | | | | | | 1 U T M |Lon/Z |Lat/Z | | | | | | 2 State Plane | | | | | | | | 3 Albers Equal Area |SMajor|SMinor|STDPR1|STDPR2|CentMer|OriginLat|FE|FN 4 Lambert Conformal C |SMajor|SMinor|STDPR1|STDPR2|CentMer|OriginLat|FE|FN 5 Mercator |SMajor|SMinor| | |CentMer|TrueScale|FE|FN 6 Polar Stereographic |SMajor|SMinor| | |LongPol|TrueScale|FE|FN 7 Polyconic |SMajor|SMinor| | |CentMer|OriginLat|FE|FN 8 Equid. Conic A |SMajor|SMinor|STDPAR| |CentMer|OriginLat|FE|FN Equid. Conic B |SMajor|SMinor|STDPR1|STDPR2|CentMer|OriginLat|FE|FN 9 Transverse Mercator |SMajor|SMinor|Factor| |CentMer|OriginLat|FE|FN 10 Stereographic |Sphere| | | |CentLon|CenterLat|FE|FN 11 Lambert Azimuthal |Sphere| | | |CentLon|CenterLat|FE|FN 12 Azimuthal |Sphere| | | |CentLon|CenterLat|FE|FN 13 Gnomonic |Sphere| | | |CentLon|CenterLat|FE|FN 14 Orthographic |Sphere| | | |CentLon|CenterLat|FE|FN 15 Gen. Vert. Near Per |Sphere| |Height| |CentLon|CenterLat|FE|FN 16 Sinusoidal |Sphere| | | |CentMer| |FE|FN 17 Equirectangular |Sphere| | | |CentMer|TrueScale|FE|FN 18 Miller Cylindrical |Sphere| | | |CentMer| |FE|FN 19 Van der Grinten |Sphere| | | |CentMer|OriginLat|FE|FN 20 Hotin Oblique Merc A |SMajor|SMinor|Factor| | |OriginLat|FE|FN Hotin Oblique Merc B |SMajor|SMinor|Factor|AziAng|AzmthPt|OriginLat|FE|FN 21 Robinson |Sphere| | | |CentMer| |FE|FN 22 Space Oblique Merc A |SMajor|SMinor| |IncAng|AscLong| |FE|FN Space Oblique Merc B |SMajor|SMinor|Satnum|Path | | |FE|FN 23 Alaska Conformal |SMajor|SMinor| | | | |FE|FN 24 Interrupted Goode |Sphere| | | | | | | 25 Mollweide |Sphere| | | |CentMer| |FE|FN 26 Interrupt Mollweide |Sphere| | | | | | | 27 Hammer |Sphere| | | |CentMer| |FE|FN 28 Wagner IV |Sphere| | | |CentMer| |FE|FN 29 Wagner VII |Sphere| | | |CentMer| |FE|FN 30 Oblated Equal Area |Sphere| |Shapem|Shapen|CentLon|CenterLat|FE|FN ---------------------------------------------------------------------------- ---------------------------------------------------- | Array Element | Code & Projection Id |--------------------------- | 8 | 9 | 10 | 11 | 12 | ---------------------------------------------------- 0 Geographic | | | | | | 1 U T M | | | | | | 2 State Plane | | | | | | 3 Albers Equal Area | | | | | | 4 Lambert Conformal C | | | | | | 5 Mercator | | | | | | 6 Polar Stereographic | | | | | | 7 Polyconic | | | | | | 8 Equid. Conic A |zero | | | | | Equid. Conic B |one | | | | | 9 Transverse Mercator | | | | | | 10 Stereographic | | | | | | 11 Lambert Azimuthal | | | | | | 12 Azimuthal | | | | | | 13 Gnomonic | | | | | | 14 Orthographic | | | | | | 15 Gen. Vert. Near Per | | | | | | 16 Sinusoidal | | | | | | 17 Equirectangular | | | | | | 18 Miller Cylindrical | | | | | | 19 Van der Grinten | | | | | | 20 Hotin Oblique Merc A |Long1|Lat1|Long2|Lat2|zero| Hotin Oblique Merc B | | | | |one | 21 Robinson | | | | | | 22 Space Oblique Merc A |PSRev|LRat|PFlag| |zero| Space Oblique Merc B | | | | |one | 23 Alaska Conformal | | | | | | 24 Interrupted Goode | | | | | | 25 Mollweide | | | | | | 26 Interrupt Mollweide | | | | | | 27 Hammer | | | | | | 28 Wagner IV | | | | | | 29 Wagner VII | | | | | | 30 Oblated Equal Area |Angle| | | | | ---------------------------------------------------- where Lon/Z Longitude of any point in the UTM zone or zero. If zero, a zone code must be specified. Lat/Z Latitude of any point in the UTM zone or zero. If zero, a zone code must be specified. SMajor Semi-major axis of ellipsoid. If zero, Clarke 1866 in meters is assumed. SMinor Eccentricity squared of the ellipsoid if less than zero, if zero, a spherical form is assumed, or if greater than zero, the semi-minor axis of ellipsoid. Sphere Radius of reference sphere. If zero, 6370997 meters is used. STDPAR Latitude of the standard parallel STDPR1 Latitude of the first standard parallel STDPR2 Latitude of the second standard parallel CentMer Longitude of the central meridian OriginLat Latitude of the projection origin FE False easting in the same units as the semi-major axis FN False northing in the same units as the semi-major axis TrueScale Latitude of true scale LongPol Longitude down below pole of map Factor Scale factor at central meridian (Transverse Mercator) or center of projection (Hotine Oblique Mercator) CentLon Longitude of center of projection CenterLat Latitude of center of projection Height Height of perspective point Long1 Longitude of first point on center line (Hotine Oblique Mercator, format A) Long2 Longitude of second point on center line (Hotine Oblique Mercator, format A) Lat1 Latitude of first point on center line (Hotine Oblique Mercator, format A) Lat2 Latitude of second point on center line (Hotine Oblique Mercator, format A) AziAng Azimuth angle east of north of center line (Hotine Oblique Mercator, format B) AzmthPt Longitude of point on central meridian where azimuth occurs (Hotine Oblique Mercator, format B) IncAng Inclination of orbit at ascending node, counter-clockwise from equator (SOM, format A) AscLong Longitude of ascending orbit at equator (SOM, format A) PSRev Period of satellite revolution in minutes (SOM, format A) LRat Landsat ratio to compensate for confusion at northern end of orbit (SOM, format A -- use 0.5201613) PFlag End of path flag for Landsat: 0 = start of path, 1 = end of path (SOM, format A) Satnum Landsat Satellite Number (SOM, format B) Path Landsat Path Number (Use WRS-1 for Landsat 1, 2 and 3 and WRS-2 for Landsat 4, 5 and 6.) (SOM, format B) Shapem Oblated Equal Area oval shape parameter m Shapen Oblated Equal Area oval shape parameter n Angle Oblated Equal Area oval rotation angle Array elements 13 and 14 are set to zero. All array elements with blank fields are set to zero too.If the datum code is negative, the first two values in the parameter array (parm) are used to define the values as follows:
semiminor = sqrt(1.0 - ES) * semimajor
where
ES = eccentricity squared
0: Clarke 1866 (default) 1: Clarke 1880 2: Bessel 3: International 1967 4: International 1909 5: WGS 72 6: Everest 7: WGS 66 8: GRS 1980/WGS 84 9: Airy 10: Modified Everest 11: Modified Airy 12: Walbeck 13: Southeast Asia 14: Australian National 15: Krassovsky 16: Hough 17: Mercury 1960 18: Modified Mercury 1968 19: Sphere of Radius 6370997 meters
iProjSys
- Input projection system code, used in GCTP.iZone
- Input zone for UTM and State Plane projection systems. For
Southern Hemisphere UTM use a negative zone code. iZone ignored for all
other projections.padfPrjParams
- Array of 15 coordinate system parameters. These
parameters differs for different projections.iDatum
- Input spheroid.
public int ImportFromUSGS(int iProjSys, int iZone, double[] padfPrjParams)
ImportFromUSGS(int iProjSys, int iZone, double[] padfPrjParams, int iDatum)
public int ImportFromUSGS(int iProjSys, int iZone)
ImportFromUSGS(int iProjSys, int iZone, double[] padfPrjParams, int iDatum)
public int ImportFromUSGS(int iProjSys)
ImportFromUSGS(int iProjSys, int iZone, double[] padfPrjParams, int iDatum)
public int ImportFromXML(String xmlString)
xmlString
- XML string to import
public int ImportFromMICoordSys(String coord_sys)
coord_sys
- Mapinfo style CoordSys definition string.
public int ExportToWkt(String[] argout)
argout
- an already allocated array of 1 string to receive the output
public int ExportToPrettyWkt(String[] argout, int simplify)
argout
- an already allocated array of 1 string to receive the outputsimplify
- 1 if the AXIS, AUTHORITY and EXTENSION nodes should be stripped off
public int ExportToPrettyWkt(String[] argout)
ExportToPrettyWkt(String[] argout, int simplify)
public int ExportToProj4(String[] argout)
LOCAL_CS coordinate systems are not translatable. An empty string will be returned along with 0.
argout
- an already allocated array of 1 string to receive the PROJ.4 definition
public int ExportToPCI(String[] proj, String[] units, double[] parms)
LOCAL_CS coordinate systems are not translatable. An empty string will be returned along with 0.
proj
- an already allocated array of 1 string to receive the PCI projection
definitionunits
- an already allocated array of 1 string to receive units definitionparms
- an already allocated array of 17 doubles to receive the 17
projection parameters will be assigned. See importFromPCI() for the list of parameters.
public int ExportToUSGS(int[] projsys, int[] zone, double[] parms, int[] datum)
projsys
- an already allocated array of 1 integer to receive the projection system code.zone
- an already allocated array of 1 integer to receive the zone for UTM and State Plane
projection.parms
- n already allocated array of 15 doubles to receive
15 projection parameters. See importFromUSGS() for
the list of parameters.datum
- an already allocated array of 1 integer to receive the datum code.
public int ExportToXML(String[] argout, String dialect)
argout
- an already allocated array of 1 string to receive the XML definition.dialect
- currently ignored. The dialect used is GML based.
public int ExportToXML(String[] argout)
ExportToXML(String[] argout, String dialect)
public int ExportToMICoordSys(String[] argout)
argout
- an already allocated array of 1 string to receive the output
public SpatialReference CloneGeogCS()
public SpatialReference Clone()
public int Validate()
public int StripCTParms()
public int FixupOrdering()
public int Fixup()
This method should be expected to evolve over time to as problems are discovered. The following are amoung the fixup actions this method will take:
public int MorphToESRI()
public int MorphFromESRI()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |