[gdal-dev] ogr2ogr PROMOTE_TO_MULTI with linestrings?

Richard Greenwood richard.greenwood at gmail.com
Tue May 16 05:56:38 PDT 2017


You could use -nlt geometry but that won't convert simple objects to multi
objects.
You could do it in steps:

   1. use -where to get lines and -nlt MultiLine
   2. use -where to get polys with -nlt MutliPolygon
   3. combine the two tables into a single Geometry table

Rich


On Mon, May 15, 2017 at 6:25 PM, Stephen Woodbridge <woodbri at swoodbridge.com
> wrote:

> On 5/15/2017 6:15 PM, Stephen Woodbridge wrote:
>
>> Hi,
>>
>> I'm trying to load both polygons and linestrings and would like
>> PROMOTE_TO_MULTI to work for both, but it appears to define Multipolygon
>> type and does not work for linestrings/multilinestrings.
>>
>> Maybe it would make more sense to have:
>>
>> PROMOTE_TO_MULTI - work for either polygon or linestring depending on
>> what the first object is
>>
>> or have two options like:
>>
>> PROMOTE_POLY_TO_MULTI
>> PROMOTE_LINE_TO_MULTI
>>
>> Or maybe, I'm totally missing something in the docs.
>>
>
> Sorry, forgot to add:
>
> ogrinfo --version
> GDAL 2.1.0, released 2016/04/25
>
> ogr2ogr -t_srs EPSG:4326 -nln census.roads -nlt PROMOTE_TO_MULTI -f
> PostgreSQL -append PG:dbname=buildings host=localhost port=5432
> user=postgres active_schema=census /u/ror/buildings/data/census/t
> mp-11/tl_2016_06061_roads.shp
> Warning 1: Geometry to be inserted is of type Multi Line String, whereas
> the layer geometry type is Multi Polygon.
> Insertion is likely to fail
> ERROR 1: ERROR:  Geometry type (MultiLineString) does not match column
> type (MultiPolygon)
>
>
>
> ---
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>



-- 
Richard W. Greenwood, PLS
www.greenwoodmap.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170516/09a348df/attachment.html>


More information about the gdal-dev mailing list