[postgis-devel] WKT format of MULTIPOINT

Andy Teucher andy.teucher at gmail.com
Wed Dec 18 12:23:31 PST 2019


The WKT representation of MULTIPOINT features can take two different forms, both of which are accepted (almost) universally. PostGIS (st_astext) implements the format without parentheses around individual point coordinate pairs:

MULTIPOINT (0 0, 1 1)
vs
MULTIPOINT ((0 0), (1 1))

I know this has been discussed in the past (https://lists.osgeo.org/pipermail/postgis-devel/2013-December/023990.html and https://trac.osgeo.org/postgis/ticket/2558) however I’ve come across a situation where it is making a difference.

I have been using a geoserver wfs service to obtain spatial data, and supplying multipoint features to a geometry predicate (e.g., INTERSECTS) without nested parenthesis fails:

$ wget -O "a.json" "https://openmaps.gov.bc.ca/geo/pub/wfs?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&outputFormat=application/json&typeNames=WHSE_BASEMAPPING.GBA_LOCAL_REG_GREENSPACES_SP&SRSNAME=EPSG:3005&CQL_FILTER=INTERSECTS(SHAPE, MULTIPOINT (1236285 463726.8, 1228264 463547.4))"

--2019-12-18 12:08:52--  https://openmaps.gov.bc.ca/geo/pub/wfs?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&outputFormat=application/json&typeNames=WHSE_BASEMAPPING.GBA_LOCAL_REG_GREENSPACES_SP&SRSNAME=EPSG:3005&CQL_FILTER=INTERSECTS(SHAPE,%20MULTIPOINT%20(1236285%20463726.8,%201228264%20463547.4))
Resolving openmaps.gov.bc.ca (openmaps.gov.bc.ca)... 142.34.140.41
Connecting to openmaps.gov.bc.ca (openmaps.gov.bc.ca)|142.34.140.41|:443... connected.
HTTP request sent, awaiting response... 400
2019-12-18 12:08:52 ERROR 400: (no description).

But it works when inner parentheses are present:

$ wget -O "a.json" "https://openmaps.gov.bc.ca/geo/pub/wfs?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&outputFormat=application/json&typeNames=WHSE_BASEMAPPING.GBA_LOCAL_REG_GREENSPACES_SP&SRSNAME=EPSG:3005&CQL_FILTER=INTERSECTS(SHAPE, MULTIPOINT ((1236285 463726.8), (1228264 463547.4)))"

--2019-12-18 12:10:20--  https://openmaps.gov.bc.ca/geo/pub/wfs?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&outputFormat=application/json&typeNames=WHSE_BASEMAPPING.GBA_LOCAL_REG_GREENSPACES_SP&SRSNAME=EPSG:3005&CQL_FILTER=INTERSECTS(SHAPE,%20MULTIPOINT%20((1236285%20463726.8),%20(1228264%20463547.4)))
Resolving openmaps.gov.bc.ca (openmaps.gov.bc.ca)... 142.34.140.41
Connecting to openmaps.gov.bc.ca (openmaps.gov.bc.ca)|142.34.140.41|:443... connected.
HTTP request sent, awaiting response... 200
Length: unspecified [application/json]
Saving to: ‘a.json’

a.json                  [ <=>                ]   3.59K  --.-KB/s    in 0s
2019-12-18 12:10:20 (35.4 MB/s) - ‘a.json’ saved [3678]

I believe the database behind the geoserver is Oracle, which I have seen elsewhere only accepts the variety of MULTIPOINT with nested parentheses (https://viswaug.wordpress.com/2011/02/13/well-known-text-wkt-representation-for-multipoint/).

What is the possibility of PostGIS being able to output the nested-parens version of MULTIPOINT wkt?

Thanks for your time!
Andy Teucher




More information about the postgis-devel mailing list