Tell me more ×
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 using ogr2ogr to import data into a PostGIS database. Each dataset I need to import has (theoretically) the same exact data structure, but it appears that they are not the same geometry types. Example, I've already imported the first layer, and there's a layer called "streets". Running this command, I import the first feature class from the first database (I have GDAL configured to read .mdb):

ogr2ogr -f PostgreSQL PG:"host=localhost user=postgres dbname=database port=5432" city1.mdb streets -nln streets -nlt MULTILINESTRING -lco GEOMETRY_NAME=geometry

When I go to append (using the -append flag) the same streets layer from city2.mdb, I get this error (presumably due to conflicting geometry types for the two "streets" layers:

Warning 1: Geometry to be inserted is of type 3D Line String, whereas the layer geometry type is 3D Multi Line String.
Insertion is likely to fail
ERROR 1: INSERT command for new feature failed.
ERROR:  Geometry type (LineString) does not match column type (MultiLineString)

Is there a straightforward way with ogr2ogr to cast geometries to the same type on import? Or a way to handle this by predefining the schema and geometries for each table beforehand?

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.