Opened 4 years ago

Closed 4 years ago

#924 closed enhancement (fixed)

geometries returned by getGeometryN() should have the same SRID as collection

Reported by: sirsigurd Owned by: geos-devel@…
Priority: major Milestone:
Component: Default Version: main
Severity: Unassigned Keywords:
Cc: sirsigurd

Description

Currently geometries returned by getGeometryN() always have SRID=0, because SRID is dropped for elements during geometry collection construction since r3840. I think it would be more correct if collection components have the same SRID as collection.

Change History (3)

comment:1 by sirsigurd, 4 years ago

Cc: sirsigurd added

comment:2 by dbaston, 4 years ago

The proposed behavior (components have same SRID as collection) is consistent w/JTS:

-> GeometryFactory gf = new GeometryFactory(new PrecisionModel(), 4326);
|  Added variable gf of type GeometryFactory with initial value org.locationtech.jts.geom.GeometryFactory@21213b92

-> WKTReader reader = new WKTReader(gf);
|  Added variable reader of type WKTReader with initial value org.locationtech.jts.io.WKTReader@3327bd23

-> Geometry g = reader.read("GEOMETRYCOLLECTION(POINT (3 7), LINESTRING (0 0, 1 1))");
|  Added variable g of type Geometry with initial value GEOMETRYCOLLECTION (POINT (3 7), LINESTRING (0 0, 1 1))

-> g.getSRID();
|  Expression value is: 4326
|    assigned to temporary variable $12 of type int

-> g.getGeometryN(0).getSRID();
|  Expression value is: 4326
|    assigned to temporary variable $13 of type int

-> g.getGeometryN(1).getSRID();
|  Expression value is: 4326
|    assigned to temporary variable $14 of type int


comment:3 by Sergey Fedoseev <fedoseev.sergey@…>, 4 years ago

Resolution: fixed
Status: newclosed

In 33c1e7b/git:

Fix #924: Geometries returned by getGeometryN() now have the same SRID as collection.

Note: See TracTickets for help on using tickets.