[gdal-dev] help! convert GML to Shp by using python

Ari Jolma ari.jolma at tkk.fi
Thu Dec 18 15:19:51 EST 2008


Frank Warmerdam kirjoitti:
> Xiaoyu Guan wrote:
>> The GML which i used is located at 
>> http://www.openlayers.org/dev/examples/gml/multipolygon.xml
>> but the polygon.shp file does not contain the first feature's and the 
>> third feature's attribute
>
>
> and this seemed to produce a shapefile with all three features, and all
> their attributes (ogc_fid, name, id).  I did this with GDAL/OGR trunk -
> essentially identical to 1.6.0.

I'm observing a similar thing as Xiaoyu reports. This is with 1.6.0 or 
very near to it (revision 15975). Here's the output from ogrinfo:

c:\>ogrinfo  multipolygon.xml
Had to open data source read-only.
INFO: Open of `multipolygon.xml'
      using driver `GML' successful.
1: multipolygon
2: ogc_fid
3: name
4: id

and

c:\>ogrinfo  multipolygon.xml multipolygon
Had to open data source read-only.
INFO: Open of `multipolygon.xml'
      using driver `GML' successful.

Layer name: multipolygon
Geometry: Unknown (any)
Feature Count: 3
Extent: (-1.738290, 46.307560) - (3.754420, 47.244300)
Layer SRS WKT:
(unknown)
ogc_fid: Integer (0.0)
name: String (22.0)
id: Integer (0.0)
OGRFeature(multipolygon):1
  ogc_fid (Integer) = (null)
  name (String) = (null)
  id (Integer) = (null)
  MULTIPOLYGON (((1.313216 46.69077,1.000968 46.861086999999998,0.887424 
47.0597
9,1.142899 47.244300000000003,1.355795 47.244300000000003,1.554498 
47.0172110000
00003,1.710622 47.05979,1.767394 46.747542000000003,1.313216 
46.69077,1.313216 4
6.69077)),((0.7313 46.605612,-0.19125 46.704962999999999,-0.19125 
46.84689399999
9999,0.17777 46.988824,0.447438 46.960438000000003,0.589369 
46.804315000000003,0
.688721 46.832701,0.7313 46.605612,0.7313 46.605612)),((-1.610557 
46.73334899999
9997,-1.184765 46.704962999999999,-1.198958 46.704962999999999,-0.943483 
46.6198
04999999999,-0.915096 46.818508,-0.659621 46.775928,-0.688007 
47.017211000000003
,-0.943483 47.003017999999997,-1.127992 47.088175999999997,-1.397661 
47.10236900
0000003,-1.62475 47.073982999999998,-1.738295 46.917859,-1.610557 
46.73334899999
9997)))

OGRFeature(multipolygon):2
  ogc_fid (Integer) = 2
  name (String) = My second Multipolygon
  id (Integer) = 0
  POLYGON ((2.959612 46.392716,2.789295 46.775928,3.172508 
46.903666,3.498949 46
.903666,3.498949 46.662384000000003,3.754424 46.563032,2.959612 46.392716))

OGRFeature(multipolygon):3
  ogc_fid (Integer) = (null)
  name (String) = (null)
  id (Integer) = (null)
  MULTIPOLYGON (((2.292538 46.804315000000003,2.207379 
47.017211000000003,2.3918
89 47.045597,2.562206 46.832701,2.292538 46.804315000000003)),((2.789295 
46.3075
57000000003,2.789295 46.307557000000003,2.803488 
46.506259999999997,2.618978 46.
676577000000002,2.34931 46.633997999999998,2.448661 46.392716,2.789295 
46.307557
000000003)))

note the attributes are null. I'll look more into the issue.

Ari

-- 
Prof. Ari Jolma
Environmental Management Information Technology
Teknillinen Korkeakoulu / Helsinki University of Technology
tel: +358 9 4511 address: POBox 5300, 02015 TKK, Finland
Email: ari.jolma at tkk.fi URL: http://geoinformatics.tkk.fi




More information about the gdal-dev mailing list