Opened 15 years ago

Closed 15 years ago

#347 closed defect (fixed)

Creating geography type is confusing

Reported by: robe Owned by: pramsey
Priority: medium Milestone: PostGIS 1.5.0
Component: postgis Version:
Keywords: Cc:

Description

I'm not quite sure how to express this and not sure if I consider it an issue or not, but someone brought it to my attention when I was demonstrating how to create a column.

If you create a geography column as

geography(POINT,4326) vs. geography(POINT)

They are different. They don't have the same SRID and in order to convert a geography(POINT) to a geography(POINT,4326) you have to do something goofy like this

ALTER TABLE sometable ALTER COLUMN the_geog TYPE (geography(POINT,4326)) USING geography(ST_SetSRID(geometry(the_geog),4326) );

Given that we don't support unknown SRID — it seems kind of silly to have people do this and takes a long time for a large table. Unfortunately not sure if there is anyway around this aside from enforcing the requirement of SRID (don't allow unknown for now, but allow it later when/if we support multiple SRIDs). I'm not sure what the best resolution is for this since its technically not a bug, but an annoyance.

Change History (3)

comment:1 by mcayland, 15 years ago

Milestone: PostGIS FuturePostGIS 1.5.0

I think this was something I touched on before; i.e. a geography without a SRID is useless compared to a geometry without a SRID :(

For example, for a geometry if we have a polygon we can still calculate area + length (IMO two of the fundamental properties of a linestring/polygon) regardless of whether or not we have a SRID. This allows us to use many calculations SRID-less without much of an issue.

However, for geography the area + length calculations are both dependent on the SRID which contains the required information for the curvature of the sphere and so without a SRID we can't really do much at all.

My recommendation would be to currently enforce SRID 4326 on all new geographies in trunk so then we always have a reference to calculate these two properties. I also think this should be marked as for 1.5.

comment:2 by pramsey, 15 years ago

I should be able to force all unknowns to 4326 without issue… one question: if I create a table with type geography(point), when I do a \d on that table, is it OK to see geography(point, 4326) in the output?

The second item is a note that we are doing damage to the standard by picking a number (4326) and saying it has "meaning". It only has meaning within the context of spatial_ref_sys, which is highly mutable, unfortunately. For practical purposes, we are probably on safe ground, but I'm just saying…

comment:3 by pramsey, 15 years ago

Resolution: fixed
Status: newclosed

At r5005, have made 4326 the default SRID for "unknown" cases, both in column creation and in geography object creation. Please test for satisfaction.

Note: See TracTickets for help on using tickets.