[R-sig-Geo] projection metadata
Roger Bivand
Roger.Bivand at nhh.no
Thu Apr 13 14:43:50 CEST 2006
On Thu, 13 Apr 2006, Edzer J. Pebesma wrote:
> Michael, I'm pretty new to the xml world, but I guess you need an
> application
> that can write out proj.4 strings from the xml's manifold outputs. I thought
> something like that was called an xslt rather than a schema/dtd, which
> define
> rather the structure (dtd) and content (schema) of the xml.
>
> Briefly browsing the web (google PROJ.4 xml) you may find something
> useful in the context of the OGR work done by Frank Warmerdam. BTW
> ogr is part of gdal, so if something's in there, you could get to it through
> package rgdal.
>
> Keep us updated on this interesting topic,
> --
> Edzer
>
> Michael Sumner wrote:
> > Hello, I'm looking for advice on parsing XML metadata and mapping
> > projection tags to PROJ.4 strings.
> >
> > Manifold GIS provides auxiliary .xml files with every export of
> > drawings, images, surfaces or labels and
> > this is as robust as GeoTIFF headers and can be used to override the
> > limitations of shapefiles, png images
> > etc. that don't store projection metadata completely if at all.
> >
> > I have a function that writes the xml for a Manifold surface when I
> > export an R xyz image to raw binary, it's totally ad hoc
> > and just explicitly writes out the text lines - but it works well for
> > transferring my (usually latlon) data
> > back and forth.
> >
> > I'd like to generalize this by mapping the XML tags to PROJ.4 arguments.
If Manifold can output Well-Known Text WKT forms, in one mutation ESRI
WKT, then they are already read in rgdal (readOGR() reads them among
others). The projection code from what was spproj is now included in
rgdal, by the way - documentation on the websites will follow shortly.
The manual way might be for your example grepping through:
EPSG <- make_EPSG()
EPSG[grep("Lambert", EPSG$note), 1:2]
but the example is actually only:
> showWKT("+proj=laea +ellps=WGS84 +lat_0=-42 +lon_0=150")
[1] "PROJCS[\"Unknown\",
GEOGCS[\"GCS_WGS_1984\",
DATUM[\"D_unknown\",
SPHEROID[\"WGS84\",6378137,298.257223563]],
PRIMEM[\"Greenwich\",0],
UNIT[\"Degree\",0.017453292519943295]
],
PROJECTION[\"Lambert_Azimuthal_Equal_Area\"],
PARAMETER[\"latitude_of_center\",-42],
PARAMETER[\"longitude_of_center\",150],
PARAMETER[\"false_easting\",0],
PARAMETER[\"false_northing\",0]
]"
It may well be that there is code in GDAL/OGR/PROJ4 for handling the xml
directly, or that a converter to ESRI *.prj files (which look like the
above) already exists.
If showWKT() is given a filename argument, it emits a WKT file, by default
using the ESRI mutation.
I hope this helps,
Roger
> >
> > I've made some limited explorations using the XML package to parse the
> > xml and modify tags, but
> > I'm trying to capture two data models (the xml and PROJ.4) at once and
> > it's beyond me.
> >
> > A shorter version of my query might be: is there a DTD or schema for
> > PROJ.4 arguments, and can anyone point
> > me to examples of mapping other schemes to PROJ.4? ( I imagine that the
> > GDAL code for GeoTIFF headers is
> > likely good place.Any pointers would be appreciated. ) It will be
> > simple enough to create or obtain a
> > DTD for the Manifold XML.
> >
> > Cheers, Mike.
> >
> > Here's an example of an XML file:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <preset>
> > <name>Lambert Azimuthal Equal Area</name>
> > <datum>World Geodetic 1984 (WGS84)</datum>
> > <system>Lambert Azimuthal Equal Area</system>
> > <unit>Meter</unit>
> > <majorAxis>6.378137000000000000000000e+006</majorAxis>
> > <eccentricity>8.181919084262148600000000e-002</eccentricity>
> > <centerX>0.000000000000000000000000e+000</centerX>
> > <centerY>0.000000000000000000000000e+000</centerY>
> > <centerZ>0.000000000000000000000000e+000</centerZ>
> > <rotationX>0.000000000000000000000000e+000</rotationX>
> > <rotationY>0.000000000000000000000000e+000</rotationY>
> > <rotationZ>0.000000000000000000000000e+000</rotationZ>
> > <scaleX>1.000000000000000000000000e+000</scaleX>
> > <localScaleX>1.000000000000000000000000e+000</localScaleX>
> > <scaleY>1.000000000000000000000000e+000</scaleY>
> > <localScaleY>1.000000000000000000000000e+000</localScaleY>
> > <falseEasting>0.000000000000000000000000e+000</falseEasting>
> > <localOffsetX>0.000000000000000000000000e+000</localOffsetX>
> > <falseNorthing>0.000000000000000000000000e+000</falseNorthing>
> > <localOffsetY>0.000000000000000000000000e+000</localOffsetY>
> > <centerLat>-4.200000000000000000000000e+001</centerLat>
> > <centerLon>1.500000000000000000000000e+002</centerLon>
> > </preset>
> >
> > _______________________________________________
> > R-sig-Geo mailing list
> > R-sig-Geo at stat.math.ethz.ch
> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> >
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the R-sig-Geo
mailing list