[Shapelib] Hello,how to transform the shp file to xml

Frank Warmerdam warmerdam at pobox.com
Thu Jul 6 18:57:56 PDT 2006


吴谷 wrote:
> Hi All,I am new to shapelib.
> Now my assignment is that I should transfomr the shp,shx,dbf file to xml 
> file.
> How I can do that.Thanks in advance!
> 

Haze,

You haven't been very specific about the constraints you are operating under.
One simple approach would be to use a translating like the ogr2ogr program
from GDAL/OGR to convert the shapefile to GML.

eg.

ogr2ogr -f GML out.gml in.shp

If have specific requirements for the XML output, you could implement a
program yourself using Shapelib to read the shapefile, and writing the
XML with printf()'s.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGF, http://osgeo.org




More information about the Shapelib mailing list