Opened 17 years ago

Closed 14 years ago

#1850 closed defect (invalid)

Fishy Polygon file conversion behavior

Reported by: darkblueB Owned by:
Priority: normal Milestone:
Component: OGR_SF Version: unspecified
Severity: normal Keywords: kml pg
Cc: warmerdam, Didge

Description

Run ogr2ogr to convert a trivial polygon from KML to something else

varying results, including outright failure (eg operation not completed)

However, ogrinfo on the same KML source shows a well-defined polygon

hence the title "fishy", where is the error, in the KML driver ? maybe

examples I used were GML output (very similar output to the KML input) SQLite "known to have shortcomings" re crschmidt PostgreSQL - the clincher, because the same test DB target accepted a

15,000 polygon layer from a Shape file, but fails on this test

Attachments (1)

Polygon.kml (975 bytes ) - added by darkblueB 17 years ago.

Download all attachments as: .zip

Change History (6)

by darkblueB, 17 years ago

Attachment: Polygon.kml added

comment:1 by warmerdam, 17 years ago

Cc: warmerdam Didge added
Owner: changed from warmerdam to Mateusz Łoskot

Brian,

Could you paste in the error you get so we know when we have hit the same problem?

Flipping to Mateusz to address...

comment:2 by darkblueB, 17 years ago

PostgreSQL: set up a new PG database, add the plpgsql language and execute file lwpostgis.sql (sp?). Attempt to import the file Polygon.kml with ogr2ogr. Observe the error:

ERROR 1: CREATE TABLE Polygon."kml" ( OGC_FID SERIAL, CONSTRAINT "kml_pk" PRIMARY KEY (OGC_FID) ) ERROR: schema "polygon" does not exist

SQLite: import Polygon.KML to SQLite. ogrinfo on the SQLite result shows a polygon. However, my SQLite viewer 'SQLite Database Browser 1.3' shows the table with the CREATE string, but no contents? something is confusing the viewer...

comment:3 by darkblueB, 17 years ago

PG continued- In an attempt to make sure I was not missing a step with PG, I executed the query from the PostGIS instructions page which makes a new table with a SpatialGeometry column: CREATE TABLE gtest ( ID int4, NAME varchar(20) );

SELECT AddGeometryColumn(, 'gtest','geom',-1,'LINESTRING',2);

this worked fine, as expected.

Later, I imported with ogr2ogr a stock Shape file I use for many tests, about 15,000 polygons. Import worked fine the first time.

comment:4 by Mateusz Łoskot, 16 years ago

Owner: Mateusz Łoskot removed

comment:5 by Even Rouault, 14 years ago

Resolution: invalid
Status: newclosed

The following works for me :

ogr2ogr -f GML polygon.gml polygon.kml; ogrinfo -ro -al polygon.gml
ogr2ogr -f SQLITE polygon.sqlite polygon.kml; ogrinfo -ro -al polygon.sqlite 
ogr2ogr -f PostgreSQL PG:dbname=test polygon.kml -nln polygon;  ogrinfo -ro -al PG:dbname=test polygon

Note the -nln for the PG case because the KML layer name is "polygon.kml" which is interprated by the PG driver as beging a schema.table name, but I have no "polygon" schema ... It might be that your 'SQLite Database Browser 1.3' doesn't like "polygon.kml" as a layer name either. -nln could also be useful in that case.

Note: See TracTickets for help on using tickets.