Opened 10 years ago

Closed 9 years ago

#2640 closed defect (fixed)

ST_GeogFromText allows putting in non-long lat coordinate ref

Reported by: robe Owned by: pramsey
Priority: low Milestone: PostGIS 2.2.0
Component: postgis Version: 2.1.x
Keywords: Cc:

Description

SELECT ST_Distance(ST_GeogFromText('SRID=2249;POINT(1 2)'), ST_GeogFromText('SRID=2249;POINT(4 8)') ) ;

Paul I assume it was intentional that you changed geography to accept other spatial ref sys besides WGS 84 (4326). Where was this announcement made — I assume I just missed it.

Trapping works fine when casting to geography, but not so nice when using ST_GeogFromText

Observe:

-- cool catch
SELECT 'SRID=2249;POINT(775041.040826076 2956528.39992328)'::geography

ERROR:  Only lon/lat coordinate systems are supported in geography.

— not so cool catch

SELECT ST_GeogFromText('SRID=2249;POINT(775041.040826076 2956528.39992328)');

--very not cool to find out after I've loaded my data --

SELECT ST_Distance(ST_GeogFromText('SRID=2249;POINT(775041.040826076 2956528.39992328)'), ST_GeogFromText('SRID=2249;POINT(772319.977336506 2960158.82319006)') );

NOTICE:  Coordinate values were coerced into range [-180 -90, 180 90] for GEOGRAPHY
NOTICE:  Coordinate values were coerced into range [-180 -90, 180 90] for GEOGRAPHY


ERROR:  spheroid_distance returned NaN: (-0.49567216854771884 -0.67996585883191063) (-1.0266583430730258 2.0939995498030646) a = 1.0234294757849818e-315 b = 0
CONTEXT:  SQL function "st_distance" statement 1


Change History (3)

comment:1 by robe, 10 years ago

Priority: mediumlow

comment:2 by robe, 10 years ago

Milestone: PostGIS 2.1.2PostGIS 2.2.0

comment:3 by pramsey, 9 years ago

Resolution: fixed
Status: newclosed

Fixed at r13760

Note: See TracTickets for help on using tickets.