[postgis-tickets] [PostGIS] #2372: KML with space around ordinate values considered invalid
PostGIS
trac at osgeo.org
Mon Jul 1 14:03:46 PDT 2013
#2372: KML with space around ordinate values considered invalid
----------------------+-----------------------------------------------------
Reporter: strk | Owner: strk
Type: defect | Status: reopened
Priority: high | Milestone: PostGIS 1.5.9
Component: postgis | Version: 1.5.X
Resolution: | Keywords: history, kml
----------------------+-----------------------------------------------------
Comment(by colivier):
Humm i've replyied a bit too fast on my latest post:
After checking back in OGC KML 2.2 spec,
it itself contains some examples (e.g in 9.10.4)
allowing space before/after tuples,
or also several spaces as a tuple separator
So explain why 1,2,5 use cases were previously allowed,
in first coordinates parser implementation.
So mean NOTICE only on 3 and 4 uses cases.
I've give a look on latest trunk
Here an enhanced version of coordinates regress/in_kml.sql
who should reflect current discussion:
{{{
--
-- Coordinates
--
-- X,Y
SELECT 'coordinates_1',
ST_AsEWKT(ST_GeomFromKML('<kml:Point><kml:coordinates>1,2</kml:coordinates></kml:Point>'));
-- ERROR: single X
SELECT 'coordinates_2',
ST_AsEWKT(ST_GeomFromKML('<kml:Point><kml:coordinates>1</kml:coordinates></kml:Point>'));
-- X,Y,Z
SELECT 'coordinates_3',
ST_AsEWKT(ST_GeomFromKML('<kml:Point><kml:coordinates>1,2,3</kml:coordinates></kml:Point>'));
-- ERROR: 4 dimension
SELECT 'coordinates_4',
ST_AsEWKT(ST_GeomFromKML('<kml:Point><kml:coordinates>1,2,3,4</kml:coordinates></kml:Point>'));
-- ERROR: Only commas
SELECT 'coordinates_5',
ST_AsEWKT(ST_GeomFromKML('<kml:Point><kml:coordinates>,</kml:coordinates></kml:Point>'));
SELECT 'coordinates_6',
ST_AsEWKT(ST_GeomFromKML('<kml:Point><kml:coordinates> ,
</kml:coordinates></kml:Point>'));
-- ERROR: empty or spaces
SELECT 'coordinates_7',
ST_AsEWKT(ST_GeomFromKML('<kml:Point><kml:coordinates></kml:coordinates></kml:Point>'));
SELECT 'coordinates_8',
ST_AsEWKT(ST_GeomFromKML('<kml:Point><kml:coordinates>
</kml:coordinates></kml:Point>'));
-- ERROR: End on comma
SELECT 'coordinates_9',
ST_AsEWKT(ST_GeomFromKML('<kml:Point><kml:coordinates>1,2,3,</kml:coordinates></kml:Point>'));
SELECT 'coordinates_10',
ST_AsEWKT(ST_GeomFromKML('<kml:Point><kml:coordinates>1,2,</kml:coordinates></kml:Point>'));
-- ERROR: Begin on comma
SELECT 'coordinates_11',
ST_AsEWKT(ST_GeomFromKML('<kml:LineString><kml:coordinates>,1
2,3</kml:coordinates></kml:LineString>'));
-- Whitespaces before and after
SELECT 'coordinates_12',
ST_AsEWKT(ST_GeomFromKML('<kml:LineString><kml:coordinates> 1,2 3,4
</kml:coordinates></kml:LineString>'));
SELECT 'coordinates_13',
ST_AsEWKT(ST_GeomFromKML('<kml:LineString><kml:coordinates>
1,2 3,4
</kml:coordinates></kml:LineString>'));
-- NOTICE: Spaces insides -- Cf #2372
SELECT 'coordinates_14',
ST_AsEWKT(ST_GeomFromKML('<kml:LineString><kml:coordinates>1, 2
3,4</kml:coordinates></kml:LineString>'));
SELECT 'coordinates_15',
ST_AsEWKT(ST_GeomFromKML('<kml:LineString><kml:coordinates>1,2 3
,4</kml:coordinates></kml:LineString>'));
SELECT 'coordinates_16',
ST_AsEWKT(ST_GeomFromKML('<kml:LineString><kml:coordinates>1,2, 3 4,
5,6</kml:coordinates></kml:LineString>'));
-- Several spaces as tuples separator
SELECT 'coordinates_17',
ST_AsEWKT(ST_GeomFromKML('<kml:LineString><kml:coordinates>1,2
3,4</kml:coordinates></kml:LineString>'));
SELECT 'coordinates_18',
ST_AsEWKT(ST_GeomFromKML('<kml:LineString><kml:coordinates>
1,2
3,4
</kml:coordinates></kml:LineString>'));
-- ERROR: Mixed dimension
SELECT 'coordinates_19',
ST_AsEWKT(ST_GeomFromKML('<kml:LineString><kml:coordinates>1,2
3,4,5</kml:coordinates></kml:LineString>'));
SELECT 'coordinates_20',
ST_AsEWKT(ST_GeomFromKML('<kml:LineString><kml:coordinates>1,2,3
4,5</kml:coordinates></kml:LineString>'));
SELECT 'coordinates_21',
ST_AsEWKT(ST_GeomFromKML('<kml:LineString><kml:coordinates>1,2
,3</kml:coordinates></kml:LineString>'));
SELECT 'coordinates_22',
ST_AsEWKT(ST_GeomFromKML('<kml:LineString><kml:coordinates>1,
2,3</kml:coordinates></kml:LineString>'));
SELECT 'coordinates_23',
ST_AsEWKT(ST_GeomFromKML('<kml:LineString><kml:coordinates>1,2,3
,4,5</kml:coordinates></kml:LineString>'));
SELECT 'coordinates_24',
ST_AsEWKT(ST_GeomFromKML('<kml:LineString><kml:coordinates>1,2,
3,4,5</kml:coordinates></kml:LineString>'));
-- ERROR: Mixed dimension and extra tuple separator (Cf #2372)
SELECT 'coordinates_25',
ST_AsEWKT(ST_GeomFromKML('<kml:LineString><kml:coordinates>1,2 3,4,
5</kml:coordinates></kml:LineString>'));
-- ERROR: Junk
SELECT 'coordinates_26',
ST_AsEWKT(ST_GeomFromKML('<kml:LineString><kml:coordinates>!@#$%^*()"</kml:coordinates></kml:LineString>'));
}}}
--
Ticket URL: <http://trac.osgeo.org/postgis/ticket/2372#comment:23>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-tickets
mailing list