[gdal-dev] How to read GML/GeoRSS directly from XML string?

Yingqi Tang anakintang at gmail.com
Tue Jul 3 15:04:31 PDT 2012


Hi,

I am using OGR/GDAL to read GML/GeoRSS/GeoJSON from either local file or
url, the sample code is like below
...
inputDriver = ogr.GetDriverByName(inputDriverType)
inputDataSource = inputDriver.Open(inputDataPath, 0);
...

It seems that I can pass in the GeoJSON string directly like:

inputDataSource = inputDriver.Open("
{'type':'FeatureCollection','features':[{'type':'Feature','id':'OpenLayers.Feature.Vector_3449','properties':{},'geometry':{'type':'Polygon','coordinates':[[[-109.3449,63.6328125],[-112.5,35.5078125],[-85.078125,34.8046875],[-68.90625,39.7265625],[-68.203125,67.1484375],[-109.6875,63.6328125]]]},'crs':{'type':'OGC','properties':{'urn':'urn:ogc:def:crs:OGC:1.3:CRS84'}}},{'type':'Feature','id':'OpenLayers.Feature.Vector_07050618','properties':{},'geometry':{'type':'Polygon','coordinates':[[[-40.78125,65.0390625],[-40.078125,34.8046875],[-12.3449,25.6640625],[21.09375,17.2265625],[22.5,58.0078125],[-40.78125,65.0390625]]]},'crs':{'type':'OGC','properties':{'urn':'urn:ogc:def:crs:OGC:1.3:CRS84'}}}]}",
0);

But it doesn't seem to work with GML or GeoRSS, did I miss anything? So
basically how can I read GML/GeoRSS directly from an XML string?

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20120703/020b2a56/attachment.html>


More information about the gdal-dev mailing list