[gdal-dev] ogr2ogr PROMOTE_TO_MULTI with linestrings?
Rahkonen Jukka (MML)
jukka.rahkonen at maanmittauslaitos.fi
Tue May 16 13:54:14 PDT 2017
Hi,
Could you have a try with attached data that contains 2 linestrings?
ogr2ogr -f Postgresql PG:"dbname=gis host=localhost port=5432 user=user password=password" -overwrite -nln linetest -nlt promote_to_multi lines.shp --debug on
ogr2ogr -f Postgresql PG:"dbname=gis host=localhost port=5432 user=user password=password" -append -nln linetest -nlt promote_to_multi lines.shp --debug on
For me the result is a table named as "linetest" that contains 4 multilinestring geometries. I tried to fool ogr2ogr by creating first "linetest" with multipolygon geometries but it cleared the test and -overwrite changed the table into multilinestring just fine. I tested also with a polygon shapefile and I can tell that for me PROMOTE_TO_MULTI does work for both lines and polygons.
The SQL create statement captured from the database for the multilinestring case is
-- Table: public.linetest
-- DROP TABLE public.linetest;
CREATE TABLE public.linetest
(
ogc_fid integer NOT NULL DEFAULT nextval('linetest_ogc_fid_seq'::regclass),
wkb_geometry geometry(MultiLineString),
CONSTRAINT linetest_pkey PRIMARY KEY (ogc_fid)
)
WITH (
OIDS=FALSE
);
ALTER TABLE public.linetest
OWNER TO xxxx;
-- Index: public.linetest_wkb_geometry_geom_idx
-- DROP INDEX public.linetest_wkb_geometry_geom_idx;
CREATE INDEX linetest_wkb_geometry_geom_idx
ON public.linetest
USING gist
(wkb_geometry);
Please check what you have in your first shapefile "tl_2016_us_county.shp ". Could it be that it contains polygon(s)? If it does it explains everything.
-Jukka Rahkonen-
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lines.zip
Type: application/x-zip-compressed
Size: 445 bytes
Desc: lines.zip
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170516/6849ab0d/attachment.bin>
More information about the gdal-dev
mailing list