Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm trying to convert a government data contour GML (http://geo.data.linz.gv.at/katalog/geodata/hoehenschichten/2011/1m-Hoehenschichten.gml) to Shapefile.

It seems like it was created by FME:

<?xml version="1.0" encoding="UTF-8"?>
<gml:FeatureCollection xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:fme="http://www.safe.com/gml/fme" xsi:schemaLocation="http://www.safe.com/gml/fme 1m-Contour.xsd">
<gml:boundedBy>
<gml:Envelope srsName="AUT-GK31-5" srsDimension="3">
<gml:lowerCorner>67741.3127211605 341935.72972973 245</gml:lowerCorner>
<gml:upperCorner>79959.5666279546 360502.420825918 602</gml:upperCorner>
</gml:Envelope>
</gml:boundedBy>
<gml:featureMember>
<fme:Contour gml:id="ida7f8be19-1a86-42be-886c-2238b778e00d">
<fme:_elevation>434</fme:_elevation>
<fme:_length>2987.20354766336</fme:_length>
<gml:curveProperty>
<gml:LineString srsName="AUT-GK31-5" srsDimension="3">
<gml:posList>68485.5237522595 355869.11751307 434 68487 355867.757575758 434 68488.6860465116 355866 434 68492 355862.369426752 434 68493.6929133858 355861 434 68497 355858.324840764 434 68498.921052631$
</gml:LineString>
</gml:curveProperty>
</fme:Contour>
</gml:featureMember>

Ogrinfo (OGR 1.9) recognizes multi line strings:

> ogrinfo 1m-Hoehenschichten.gml 
Had to open data source read-only.
INFO: Open of `1m-Hoehenschichten.gml'
  using driver `GML' successful.
1: Contour (Multi Line String)

But

 ogr2ogr -f "ESRI Shapefile" -nlt MULTILINESTRING25D  -skipfailures  out 1m-Hoehenschichten.gml Contour

fails with

ERROR 1: Did not get at least 2 values or invalid number of
set of coordinates <gml:posList>68485.5237522595 355869.11751307 434 68487 355867.757575758 434 68488.6860465116 355866 434 68492 355862.369426752 434 68493.6929133858 355861 434 68497 355858.324840764 434 68498.9210526316 355856 434 68502 355851.9375 434 68502.5818965517 355851 434 68503.5340909091 355849.465909091 434 68505.6853448276 355846 434 68507 355843.896551724 434 68509.2459893048 355841 434 68512 355836.846774194 434 ....

My interpretation so far is that OGR does not recognize that the file contains 3D geometries.

How can I find out if the file is broken or whether I'm dealing with an OGR bug/missing feature?

share|improve this question
1  
Try adding -dim 3 –  Mike T Feb 7 '13 at 9:51
    
@MikeToews Thanks. Seems like I need OGR 1.10 to test that. –  underdark Feb 7 '13 at 10:07
    
maybe -nlt MULTILINESTRING25D. Your example works for me, with this one line. –  mk.archaeo Feb 7 '13 at 10:22
    
@mk.archaeo No luck here. Did you try the whole file or just the first feature? –  underdark Feb 7 '13 at 10:31
1  
Yup needs OGR 1.10. OGR 1.09 tries to read an GML 2.0, but posList is defined in GML 3.*. See: sisostds.org/FEATProgrammersReference/… –  mk.archaeo Feb 7 '13 at 15:10

1 Answer 1

up vote 2 down vote accepted

Add -dim 3 to force the coordinate dimension to 3D for both the layer geometry type, and feature geometries.

This option requires GDAL 1.10, which is currently in development.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.