Let's say I have the following geographical point represented in GeoJSON:


When I run the following conversion, things work as expected:

SELECT ST_AsText(ST_GeomFromGeojson('{"type":"Point","coordinates":[-109.0,35.292506]}'));
 POINT(-109 35.292506)
(1 row)

The problem occurs if the string passed to ST_GeomFromGeojson() omits the trailing decimal on -109.0:

SELECT ST_AsText(ST_GeomFromGeojson('{"type":"Point","coordinates":[-109,35.292506]}'));
 POINT(-109 35)
(1 row)

Notice how in this case rounding to an Integer value occurs on both latitude and longitude. The loss of precision on the latitude value in this case is very significant (32.53 km).

Note: I left out the CRS field for clarify, the problem occurs either way.

The same problem does not occur using the ST_GeomFromText() function. Both numbers are not rounded to Integers if the first looks like an integer.

My question is this: Am I missing something regarding the GeoJSON conversion function, or is this really unexpected behaviour? If it is a bug, where should I report it? Thanks!

  • I think it's a bug. Please add to our ticket tracker instructions here: postgis.net/support Thanks, Regina
    – Regina Obe
    May 17, 2014 at 5:18

1 Answer 1



I saw the ticket you put in. I thought I had tried on 2.1.3 and 2.1.2 but I guess not and I was trying on an early 2.2.0dev. Anryate I'm not seeing the issue 2.1.2 or 2.1.3. Try upgrading to one of those and see if the problem goes away.


  • I tried this on another one of our installs using 2.1.2 and the problem does not occur. I will see about updating the problem machine. Thanks for your help!
    – jakeorr
    May 19, 2014 at 19:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.