From: Paul Ramsey Date: Wed, 13 May 2015 18:06:21 +0000 (+0000) Subject: Include old regression cases for GeoJSON X-Git-Tag: 2.2.0rc1~512 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6cfcbcd2181debf2a5d9b082333ccb7a37ca182c;p=postgis Include old regression cases for GeoJSON git-svn-id: http://svn.osgeo.org/postgis/trunk@13495 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/regress/in_geojson.sql b/regress/in_geojson.sql index 23325e857..b41ac6fc9 100644 --- a/regress/in_geojson.sql +++ b/regress/in_geojson.sql @@ -10,6 +10,12 @@ select 'geomfromgeojson_06',st_astext(st_geomfromgeojson(st_asgeojson('MULTIPOLY select '#1434: Next two errors'; select '#1434.1',ST_GeomFromGeoJSON('{ "type": "Point", "crashme": [100.0, 0.0] }'); select '#1434.2',ST_GeomFromGeoJSON('crashme');; +select '#1434.3',ST_GeomFromGeoJSON(''); +select '#1434.4',ST_GeomFromGeoJSON('{}'); +select '#1434.5',ST_GeomFromGeoJSON('{"type":"Point","coordinates":[]}'); +select '#1434.6',ST_GeomFromGeoJSON('{"type":"MultiPoint","coordinates":[[]]}'); +select '#1434.7',ST_GeomFromGeoJSON('{"type":"MultiPoint"}'); +select '#1434.8',ST_GeomFromGeoJSON('{"type":"Point"}'); -- #2130 -- SELECT '#2130', ST_NPoints(ST_GeomFromGeoJSON('{"type":"MultiPolygon","coordinates":[[[[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,32],[-117,32],[-117,32],[-117,32],[-116,32],[-116,32],[-116,32],[-116,32],[-116,32],[-116,32],[-116,32],[-116,32],[-116,32],[-116,32],[-117,32],[-117,32],[-117,32],[-117,32]],[[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,32],[-117,33]]]]}')); @@ -19,7 +25,19 @@ SELECT '#2216', ST_NPoints(ST_GeomFromGeoJSON('{"type":"MultiPolygon","coordinat -- #2619 -- SELECT '#2619', ST_AsText(ST_GeomFromGeoJSON('{"type":"Polygon","bbox":[1,5,2,6],"coordinates":[]}')); +select '#2619', ST_AsText(ST_GeomFromGeoJSON('{"type":"MultiPolygon","coordinates":[[]]}')); -- #2697 -- SELECT '#2697', ST_GeomFromGeoJSON('{"type":"Polygon","coordinates":[1]}'); SELECT '#2697', ST_GeomFromGeoJSON('{"type":"Polygon","coordinates":[1,1]}'); + +-- FromGeoJSON 3D + +SELECT 'geomfromgeojson_z_01', ST_AsEWKT(ST_GeomFromGeoJSON('{"type":"Point","coordinates":[1,2,3]}')); +SELECT 'geomfromgeojson_z_02', ST_AsEWKT(ST_GeomFromGeoJSON('{"type":"LineString","coordinates":[[1,2,3],[2,3,4]]}')); + +-- FromGeoJSON 4D + +SELECT 'geomfromgeojson_zm_01', ST_AsEWKT(ST_GeomFromGeoJSON('{"type":"Point","coordinates":[1,2,3,4]}')); +SELECT 'geomfromgeojson_zm_02', ST_AsEWKT(ST_GeomFromGeoJSON('{"type":"LineString","coordinates":[[1,2,3,4],[2,3,4,5]]}')); + diff --git a/regress/in_geojson_expected b/regress/in_geojson_expected index 3320f1e25..5e10f1084 100644 --- a/regress/in_geojson_expected +++ b/regress/in_geojson_expected @@ -7,8 +7,19 @@ geomfromgeojson_06|MULTIPOLYGON(((0 0,1 1,1 0,0 0))) #1434: Next two errors ERROR: Unable to find 'coordinates' in GeoJSON string ERROR: unexpected character (at offset 0) +ERROR: unexpected end of data (at offset 0) +ERROR: invalid GeoJSON representation +ERROR: Too few ordinates in GeoJSON +ERROR: Too few ordinates in GeoJSON +ERROR: Unable to find 'coordinates' in GeoJSON string +ERROR: Unable to find 'coordinates' in GeoJSON string #2130|50 #2216|30 #2619|POLYGON EMPTY +#2619|MULTIPOLYGON Z (EMPTY) ERROR: The 'coordinates' in GeoJSON ring are not an array ERROR: The 'coordinates' in GeoJSON ring are not an array +geomfromgeojson_z_01|POINT(1 2 3) +geomfromgeojson_z_02|LINESTRING(1 2 3,2 3 4) +geomfromgeojson_zm_01|POINT(1 2 3) +geomfromgeojson_zm_02|LINESTRING(1 2 3,2 3 4)