Ticket #444 (new task)

Opened 3 years ago

Last modified 2 weeks ago

Move import function from postgis dir to liblwgeom (GML/KML)

Reported by: colivier Owned by: colivier
Priority: medium Milestone: PostGIS Future
Component: postgis Version: trunk
Keywords: Cc:

Description

Imply to:

  • Add link beetween liblwgeom to external libs (geos/proj4/libxml2) from configure step
  • Move most code from postgis dir to liblwgeom
  • Use cunit to regress (huge work as there's ~500 tests to rewrite)

Change History

Changed 3 years ago by colivier

  • type changed from defect to task

Changed 3 years ago by colivier

I met 2 problems on this ticket:

1) I use Proj in some code of GeomFromGML (automagic reprojection if GML mixed SrsName?)

So it implies to also move libxml and proj (and then to be consistant GEOS) from postgis dir to liblwgeom dir.

=> This one is not that difficult, just to be sure it doesn't hurt anyone.

2) I need to query spatial_ref_sys table (to know if a given projection

is planar or geocentric) so to use SPI.

=> I see now only 2 solutions: A) Don't do anything and keep in_gml and in_kml in postgis dir

B) Move everything but the this SPI function to liblwgeom and call it

from liblwgeom. But it this case the lib will not be really standalone anymore.

Any thoughts ?

Changed 2 years ago by pramsey

Why do we actually need to do the reprojection during the GML reading? Could we generate an LWGEOM with mixed SRID and then reproject it to a consistent SRID in the PostGIS code?

Changed 2 years ago by mcayland

Mixed SRID columns are bad, full stop and we don't want to be encouraging this. I'd suggest making the liblwgeom GML API take a separate parameter indicating whether or not the projection is planar or geocentric and starting from there. We can then figure out whether it has to be passed in by hand in the liblwgeom case or whether we can somehow automate this.

Changed 2 years ago by pramsey

This is not about mixed columns. The GeomFromGML function takes in one geometry representation and spits out one new geometry. The issue is that it's possible to have mixed SRS *within* the geometry itself. Imagine a collection with a different geometries in different SRIDs.

Now, that is entirely illegal inside PostGIS, it was one of our earliest design decisions to not allow that (so, for example, the EWKT representation only provides a single SRID= tag at the front, and the EWKB representation expects SRID to be inherited from the parent geometries).

However.

It is not IMPOSSIBLE to represent a mixed-srid geometry, since each sub-geometry in an LWGEOM can have its own srid value. So we could, for this one case temporarily allow a mixed-SRID LWGEOM to be produced by the lwgeom_from_gml() liblwgeom function, on the understanding that the next call will be to a posgis_transform() function to flip it all into a single SRS.

Changed 16 months ago by pramsey

  • milestone changed from PostGIS 2.0.0 to PostGIS 2.1.0

A worthy goal, but not critical for 2.0

Changed 15 months ago by strk

I've been thinking that the liblwgeom version of GML parser could accept an optional function returning a projPJ given an SRSName, and an optional target projPJ. That way the caller could do the lookups and the core library would take care of GML parsing and transformations.

This way we should be fine (see #1591)

Changed 15 months ago by strk

The callback could also only return proj4text from srsName, the rest of the code seems to do everything else from that.

Changed 2 weeks ago by robe

  • milestone changed from PostGIS 2.1.0 to PostGIS Future

who are we kidding -- this isn't going to happen in 2.1

Note: See TracTickets for help on using tickets.