I am trying to export a line feature class from an oracle spatial database to a file geodatabase. I can export polygons with no problem, but cannot find the appropriate command '-nlt' for Line Feature.

    ogr2ogr  -update -overwrite -nln  CONVERT_TO_LINEAR  -nln sf_line -a_srs EPSG:3089 -progress -f FileGDB g:/...." "
  • Where have you searched? Ogr2ogr manual gdal.org/ogr2ogr.html is listing Define the geometry type for the created layer. One of NONE, GEOMETRY, POINT, LINESTRING, POLYGON, GEOMETRYCOLLECTION, MULTIPOINT, MULTIPOLYGON or MULTILINESTRING. And CIRCULARSTRING, COMPOUNDCURVE, CURVEPOLYGON, MULTICURVE and MULTISURFACE for GDAL 2.0 non-linear geometry types. – user30184 Apr 14 '16 at 20:54
  • Thanks for the response. I have been using this manual, and have attempted GEOMETRY, GEOMETRYCOLLECTIOn, and some others but to no avail. Polygon works, but it converts the lines to polygons and closes those shapes. Linestring converts to exports out a table only. – Ian Horn Apr 15 '16 at 17:26
  • I think it is very unlikely that with your command ogr2ogr is taking lines and closing them into polygons. I rather believe that what you have in Oracle are polygons. – user30184 Apr 15 '16 at 18:00
  • What do you get with this SQL select distinct a.geom.sdo_gtype from your_table a;? Naturally you must edit the SQL a bit to suit your table. – user30184 Apr 15 '16 at 18:11
  • Your question is definitely not clear. You say polygons export successfully, but lines don't ? Or is it that you want to export lines as polygons ? Or maybe polygons are lines ? Why do you have two -nln parameters in your command. – Albert Godfrind Apr 15 '16 at 23:48

I was able to use the '-nlt linestring' to export a line feature class successfully. The error appears to have been embedded in the sql statement. I was joining two tables and a view. The view was originally written using the 'myview.*'. I changed the SQL so that added each variable individually. This seemed to work.

    table1.var1, table2.var2, myview.variable1, myview.variable2 . . . myview.variableN'.  

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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