[Gdal-dev] ogr2ogr GML, my output no good?

Brian Hamlin maplabs at light42.com
Wed Oct 10 03:50:21 EDT 2007


well, just as I thought I was getting the hang of this...

I have a PG spatially enabled DB,  the contents seem just fine, but now  
when I export to GML with ogr2ogr the results are corrupted..  ?!?   
(this is with or without a SQL query to ogr2ogr I believe)

I use PGAdmin or psql to export data, no problem

(the same exact problem with KML, but I use GML to prove its not KML  
specific)

samples below... pointers appreciated...
   -Brian

==
ogr2ogr -f GML berk.gml PG:dbname=db -sql "select * from rgnt where  
city = 'Berkeley'"
---
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://ogr.maptools.org/ca.xsd"
      xmlns:ogr="http://ogr.maptools.org/"
      xmlns:gml="http://www.opengis.net/gml">
   <gml:boundedBy>
     <gml:Box>
        
<gml:coord><gml:X>-122.324829</gml:X><gml:Y>37.820027</gml:Y></gml: 
coord>
        
<gml:coord><gml:X>-122.213578</gml:X><gml:Y>37.905824</gml:Y></gml: 
coord>
     </gml:Box>
   </gml:boundedBy>
   <gml:featureMember>
     <ogr:sql_statement fid="F0">
        
<ogr:geometryProperty><gml:MultiPolygon><gml:polygonMember><gml: 
Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates> 
-122.303939,37.866796999999998 -122.303701000000004,37.866844  
-122.303545,37.866875 -122.303427999999997,37.866900999999999  
-122.303111999999999,37.866953000000002  
-122.302701999999996,37.867054000000003  
-122.302569000000005,37.867082000000003  
-122.302283000000003,37.867140999999997  
-122.302173999999994,37.867162999999998  
-122.302012000000005,37.867196999999997  
-122.301651000000007,37.867268000000003 -122.301351999999994,37.867325  
-122.300983000000002,37.867398 -122.300953000000007,37.867308  
-122.300820999999999,37.866885000000003  
-122.300509000000005,37.866045999999997  
-122.300275999999997,37.865226999999997  
-122.300184999999999,37.864893000000002  
-122.300104000000005,37.864657999999999  
-122.299852999999999,37.863931999999998  
-122.299581000000003,37.863002000000002  
-122.299498999999997,37.862845999999998  
-122.299429000000003,37.862685999999997 -122.299148000000002,37.861716  
-122.298952,37.861105000000002 -122.298430999999994,37.859442  
-122.298089000000004,37.858347000000002 -122.297972,37.85801  
-122.297873999999993,37.857712999999997  
-122.297456999999994,37.856439999999999  
-122.297251000000003,37.855794000000003  
-122.296582999999998,37.853684999999999  
-122.296256999999997,37.852685999999999 -122.295867,37.851635999999999  
-122.295604999999995,37.850774 -122.295416000000003,37.850133  
-122.295154999999994,37.849303999999997  
-122.295118000000002,37.849192000000002 -122.295085,37.849089999999997  
-122.294962999999996,37.848709999999997 -122.29495,37.848661999999997  
-122.295079999999999,37.848626000000003 -122.297877,37.848125000000003  
-122.298826000000005,37.847923999999999  
-122.303939,37.866796999999998</gml:coordinates></gml:LinearRing></gml: 
outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ 
ogr:geometryProperty>
       <ogr:gid>528</ogr:gid>
       <ogr:id>528</ogr:id>
       <ogr:state>CA</ogr:state>
       <ogr:city>Berkeley</ogr:city>
     </ogr:sql_statement>
   </gml:featureMember>
</ogr:FeatureCollection>

(please note the comma is not in synch with the data)

===
Same Data, exported as CSV with PGAdmin, or psql ... AsText(the_geom)  
for the geometry....
"city";"geometry"
"Berkeley";"MULTIPOLYGON(((-122.303939 37.866797,-122.303701  
37.866844,-122.303545 37.866875,-122.303428 37.866901,-122.303112  
37.866953,-122.302702 37.867054,-122.302569 37.867082,-122.302283  
37.867141,-122.302174 37.867163,-122.302012 37.867197,-122.301651  
37.867268,-122.301352 37.867325,-122.300983 37.867398,-122.300953  
37.867308,-122.300821 37.866885,-122.300509 37.866046,-122.300276  
37.865227,-122.300185 37.864893,-122.300104 37.864658,-122.299853  
37.863932,-122.299581 37.863002,-122.299499 37.862846,-122.299429  
37.862686,-122.299148 37.861716,-122.298952 37.861105,-122.298431  
37.859442,-122.298089 37.858347,-122.297972 37.85801,-122.297874  
37.857713,-122.297457 37.85644,-122.297251 37.855794,-122.296583  
37.853685,-122.296257 37.852686,-122.295867 37.851636,-122.295605  
37.850774,-122.295416 37.850133,-122.295155 37.849304,-122.295118  
37.849192,-122.295085 37.84909,-122.294963 37.84871,-122.29495  
37.848662,-122.29508 37.848626,-122.297877 37.848125,-122.298826  
37.847924,-122.303939 37.866797)))"

==




More information about the Gdal-dev mailing list