Opened 13 years ago
Closed 13 years ago
#1059 closed defect (fixed)
Regress failure after gserialized: ST_ASGML/ST_GeomFromGML POINT empty invalid GML
Reported by: | robe | Owned by: | pramsey |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 2.0.0 |
Component: | postgis | Version: | master |
Keywords: | gml | Cc: |
Description
This is the first of several bug reports comparing our new PostGIS 2.0 with PostGIS 2.0 circa r7331.
SELECT ST_GeomFromGML(ST_AsGML(ST_GeomFromText('POINT EMPTY',4326)));
In prior would return something and if I did an ST_AsText on the geometry returned, I would get:
SELECT ST_AsText(ST_GeomFromGML(ST_AsGML(ST_GeomFromText('POINT EMPTY',4326)))); MULTIPOINT EMPTY
In current trunk I get:
ERROR: invalid GML representation CONTEXT: SQL function "st_geomfromgml" statement 1 -- note ST_AsGML for point empty now returns: <gml:Point srsName="EPSG:4326"><gml:coordinates></gml:coordinates></gml:Point>
Which looks all well and good, but I guess the GeomFromGML can't handle it.
Change History (5)
comment:1 by , 13 years ago
Keywords: | gml added |
---|
comment:2 by , 13 years ago
Actually I get
select st_asgml('POINT EMPTY'); <gml:Point/>
and I have a patch fixed up now that correctly handles that as input so that the behavior is symmetric
postgis20=# select st_astext(st_geomfromgml(st_asgml('POINT EMPTY'))); st_astext ------------- POINT EMPTY (1 row)
As long as we agree that select st_asgml('POINT EMPTY') == <gml:Point/> then we're good to go. I'm ready to commit. The regression suite for in_gml right now insists that the correct answer to GeomFromGML('<gml:Point/>') is an ERROR
comment:3 by , 13 years ago
Regarding #1377, I think I'd rather not handle empty geometries at all than emit that kind of junk on empty. The old behaviour never caused anyone any harm, why not keep it?
comment:4 by , 13 years ago
<gml:Point/> is invalid GML 2. See :
pointempty.xsd :
<?xml version="1.0" encoding="UTF-8"?> <xs:schema targetNamespace="http://ogr.maptools.org/" xmlns:ogr="http://ogr.maptools.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml" elementFormDefault="qualified" version="1.0"> <xs:import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/2.1.2/feature.xsd"/> <xs:element name="FeatureCollection" type="ogr:FeatureCollectionType" substitutionGroup="gml:_FeatureCollection"/> <xs:complexType name="FeatureCollectionType"> <xs:complexContent> <xs:extension base="gml:AbstractFeatureCollectionType"> <xs:attribute name="lockId" type="xs:string" use="optional"/> <xs:attribute name="scope" type="xs:string" use="optional"/> </xs:extension> </xs:complexContent> </xs:complexType> <xs:element name="pointempty" type="ogr:pointempty_Type" substitutionGroup="gml:_Feature"/> <xs:complexType name="pointempty_Type"> <xs:complexContent> <xs:extension base="gml:AbstractFeatureType"> <xs:sequence> <xs:element name="geometryProperty" type="gml:GeometryPropertyType" nillable="true" minOccurs="0" maxOccurs="1"/> <xs:element name="foo" nillable="true" minOccurs="0" maxOccurs="1"> <xs:simpleType> <xs:restriction base="xs:string"> </xs:restriction> </xs:simpleType> </xs:element> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> </xs:schema>
pointempty.gml (hand edited since OGR doesn't allow to write <gml:Point/> :
<?xml version="1.0" encoding="utf-8" ?> <ogr:FeatureCollection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ogr.maptools.org/ pointempty.xsd" xmlns:ogr="http://ogr.maptools.org/" xmlns:gml="http://www.opengis.net/gml"> <gml:boundedBy> <gml:null>missing</gml:null> </gml:boundedBy> <gml:featureMember> <ogr:pointempty fid="pointempty.0"> <ogr:geometryProperty><gml:Point /></ogr:geometryProperty> <ogr:foo>bar</ogr:foo> </ogr:pointempty> </gml:featureMember> </ogr:FeatureCollection>
Now, let's validate the file :
$ LD_LIBRARY_PATH=/home/even/install-libxml2-2.7.8git/lib xmllint --schema pointempty.xsd pointempty.gml -noout pointempty.gml:12: element Point: Schemas validity error : Element '{http://www.opengis.net/gml}Point': Missing child element(s). Expected is one of ( {http://www.opengis.net/gml}coord, {http://www.opengis.net/gml}coordinates ). pointempty.gml fails to validate
comment:5 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Paul: I'd love to have such symmetric behavior, we couldn't get it by returning NULL. See also #1377