2

I have a some shapefiles and I want to convert them into SQL scripts. I know that ogr2ogr can put data into a database itself. But I want to have a SQL script which can be executed and put data to DB.

Any advice?

If it impossible with ogr2ogr maybe I can use other tools for this?

  • What kind of DB are you using ? PostGis ? Oracle Spatial ? Different DB's use different formats for e.g. geometries, projections etc. – Oyvind Aug 25 '13 at 11:39
  • It will used in Oracle. – Kliver Max Aug 25 '13 at 12:16
  • Oracle Spatial then ? – Oyvind Aug 25 '13 at 16:58
  • Yeah, Oracle Spatial. – Kliver Max Aug 25 '13 at 17:24
2

There is no direct way of generating an Oracle SQL dump in OGR. You could perhaps use the Python OGR/GDAL bindings an make a script that reads the shapefile(s), and writes Oracle SQL.

Otherwise, there is a Comma Separated Value (.csv) driver, where you could "morph" the output into an Oracle bulk loader file, or an SQL script.

Alternatively there is a PostGIS SQL dump driver, the only SQL dump driver in OGR. Maybe you could alter the output to fit Oracle.

Oracle supports WKT geometries, and both drivers mentioned generates WKT on output.

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.