Opened 8 years ago

Closed 8 years ago

#3590 closed defect (wontfix)

Auto cast from geometry to geoggraphy with polygon larger than a hemisphere

Reported by: linebp Owned by: pramsey
Priority: low Milestone: PostGIS 2.2.3
Component: postgis Version: 2.2.x
Keywords: Cc:

Description

I am trying to make som maps with point and polygon data from all over the world.

I have my data in a postgis 2.2 stored as geography type.

I am using mapserver 7 to serve my requests and it is generating requests for me with a bounding box constraint looking like:

geog && ST_GeomFromText('POLYGON((-180 -86, -180 86, 180 86, 180 -86, -180 -86))', 4326)

where geog is of the type geography(Point, 4326). This results in no data returned. I'm guessing what happens is that the inside of the polygon becomes the outside when cast implicitly to a geography type. Casting the point explicitly fixes the problem and rows are returned as expected:

geog::geometry && ST_GeomFromText('POLYGON((-180 -86, -180 86, 180 86, 180 -86, -180 -86))', 4326)

Change History (1)

comment:1 by robe, 8 years ago

Resolution: wontfix
Status: newclosed

Two things I see here

1) You really should be using ST_GeogFromText when doing your && check rather than relying on PostgreSQL to do the right thing and guess whether you mean geography /geometry space.

2) Sorry geography does not support more than half-sphere. Reason is it relies on shortest distance between two points. So this is sadly an implementation detail, that I don't think is in our scope to change. Detailed here - http://postgis.net/docs/manual-dev/using_postgis_dbmanagement.html#idp44623824

Note: See TracTickets for help on using tickets.