[R-sig-Geo] Importing GML-files
Roger Bivand
Roger.Bivand at nhh.no
Tue Apr 8 16:37:34 CEST 2008
On Tue, 8 Apr 2008, Hans Gardfjell wrote:
> Dear R-SIG readers,
>
> The European Union is promoting the use of open source software and
> standards. As a R-user that's certainly positive, but it also creates
> new challenges. One open format that is used by EU is GML, a
> "geographically XML" format. It's possible to import (or export) a
> GML-file with ESRI's ArcGIS software, but does anyone of you have any
> experience importing GML-files into R? Maybe into a
> spatialPolygonDataframe object (given that the GML contain polygon
> data)? I have included the beginning of one of the GML-files I'm using
> below.
GML 2.0 is supported by OGR/GDAL, accessible in R in the rgdal package, if
the driver is available. On Unix/Linux, and OSX, users get the drivers
they themselves have built into GDAL/OGR. On Windows, the basic binary
rgdal package does not include the underlying Xerces DLL. Note that
writeOGR() can write (export) GML files without Xerces, but will not be
able to read them.
The rapid alternative for reading GML files is to convert a vector GML
file to a format for which a driver is available using ogr2ogr from GDAL
binaries (for example FWTools, http://fwtools.maptools.org/). If there is
enough interest, or helpers willing to work out how to build Xerces under
MSyS/MinGW on Windows to link to GDAL/OGR built under MSyS/MinGW on
Windows, the full GML driver could be made available in the rgdal Windows
binary package.
So we're half-way for everybody, but reading (importing) will require more
effort.
Roger
>
> Thanks,
>
> Hans Gardfjell
> Department of Forest Resource Management
> SLU, Sweden
>
>
>
> Example of the beginning of a GML-file:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <gml:FeatureCollection
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="http://biodiversity.eionet.europa.eu/schemas/dir9243eec/gml_art17.xsd"
> xmlns:gml="http://www.opengis.net/gml"
> xmlns:met="http://biodiversity.eionet.europa.eu/schemas/dir9243eec">
> <gml:metaDataProperty>
> <met:info href="map-distribution-9170.gml">
> <met:mapOwner label="Owner of the map">
> <met:organisationName label="Organisation name"></met:organisationName>
> ***
> Some Metadata removed
> ***
> </met:datasetsRetrievedFrom><met:projection label="ESRI projection metadata">PROJCS["ETRS_1989_LAEA",GEOGCS["GCS_ETRS_1989",DATUM["D_ETRS_1989",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["False_Easting",4321000.0],PARAMETER["False_Northing",3210000.0],PARAMETER["Central_Meridian",10.0],PARAMETER["Latitude_Of_Origin",52.0],UNIT["Meter",1.0]]</met:projection>
> </met:info>
> </gml:metaDataProperty>
> <gml:boundedBy>
> <gml:Envelope>
> <gml:coord>
> <gml:X>4500000.22367543</gml:X>
> <gml:Y>3620000.00447305</gml:Y>
> </gml:coord>
> <gml:coord>
> <gml:X>4690000.24615209</gml:X>
> <gml:Y>3709999.93080836</gml:Y>
> </gml:coord>
> </gml:Envelope>
> </gml:boundedBy
>
> The rest of the file removed...
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> 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