-
Notifications
You must be signed in to change notification settings - Fork 292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
st_as_text: format of MULTIPOINT #1219
Comments
I agree that the grammar description copied to the SO answer implies double parentheses. Funny enough, GEOS doesn't do it: > lwgeom::st_astext(st_multipoint(rbind(c(0,1), c(10,11))))
[1] "MULTIPOINT(0 1,10 11)" but GDAL/OGR does; here exported to GPKG and read in:
|
I noticed that as well... though I thought that the Incidentally, I believe that the database which is being served by geoserver is Oracle, and I've seen elsewhere that while some software/databases accept either, Oracle is pickier (e.g., https://viswaug.wordpress.com/2011/02/13/well-known-text-wkt-representation-for-multipoint/). Do you think it's worth an issue in the postgis repo as well? |
In PostGIS they explicitly don't use inner parens: https://github.com/postgis/postgis/blob/54399b9f6b0f02e8db9444f9f042b8d4ca6d4fa4/liblwgeom/lwout_wkt.c#L218-L245. Though looking at the git blame, that was 10 yrs ago, seems the standard has specified the parentheses since then. |
In the sfa document the examples in 6.1.2.6.3 conflict with the grammar and with the example in Table 6. So best we can say is that the standard is ambiguous. You are right about |
Thanks @edzer, I agree about the ambiguity. What do you think is the best approach for |
If everyone can read the double parens, I see no objection to use them in sf. But we'd have to do a full reverse dependency check before committing to master. |
Ok thanks! I'll try to find some time to explore further and put a PR together |
Just confirming that while CREATE TABLE mytable (
id SERIAL PRIMARY KEY,
geom GEOMETRY(Multipoint, 26910),
name VARCHAR(128)
);
-- Add a multipoint (using nested parens)
INSERT INTO mytable (geom, name)
VALUES (
ST_GeomFromText('MULTIPOINT ((0 0), (1 1))', 26910),
'test'
);
-- Read it back as text
SELECT id, name, st_astext(geom) geomtext FROM mytable;
-- id | name | geomtext
-- ----+------+---------------------
-- 1 | test | MULTIPOINT(0 0,1 1)
-- (1 row) |
I have posted a message to the PostGIS mailing list. |
- prnt.MULTIPOINT is also used for CIRCULARSTRING and CURVE
FWIW, the GEOS WKT parser accepts both forms and refers to the single-paren version as the "deprecated form": https://github.com/libgeos/geos/blob/master/src/io/WKTReader.cpp#L292. This has been the case since 2006. |
Change output of st_as_text() for MULTIPOINT to include inner parens. #1219
I think that format of
MULTIPOINT
when output as wkt usingst_as_text()
may not be in a standard format, in that I think each point element should be surrounded by parentheses. E.g.,The Simple Features Specification is a little ambiguous, but in the examples (pg 61) it shows it with the inner parentheses. In addition, this stackoverflow answer outlines a good case for the inclusion of inner parentheses.
This has affected me as 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:Created on 2019-12-16 by the reprex package (v0.3.0)
cc @boshek
The text was updated successfully, but these errors were encountered: