4

I know there is a similar question but I am getting a different error and none of those answers have helped.
I am trying the following query (the GeoJSON itself is from the PostGIS website.

INSERT INTO layer_radar (id, geom)
VALUES
(
    '3bf24920-225b-11e4-8c21-0800200c9a66',
    ST_GeomFromGeoJSON('{"type":"Point","coordinates":[-48.23456,20.12345]}')
)

The error I am receiving is

ERROR:  (null) (at offset 0)

********** Error **********

ERROR: (null) (at offset 0)
SQL state: XX000

Has anyone seen anything like this before? I can't get the simplest example to work.

  • Welcome to GIS SE! Some of our protocols can take a little getting used to but I think it is good practice to always include a link to any other GIS SE question that you wish to reference yours. You can do this by using the edit button and then simply pasting in its URL which then gets its title automatically displayed. – PolyGeo Aug 12 '14 at 21:18
5

I don't think the issue is with the ST_GeomFromGeoJSON call. It's possibly the id field you have OR your table structure. Can you provide your table structure.

SELECT ST_GeomFromGeoJSON('{"type":"Point","coordinates":[-48.23456,20.12345]}');

alone works fine, so doubt that is your issue. If the above query fails, then your postgis install is corrupt in some way. Please provide output of

SELECT postgis_full_version();
  • 1
    After checking the documentation and postgis_full_version(), it seems the postgis version from the Ubuntu package manager isn't configured with LIBJSON properly. I'm now trying to compile from source with the proper configuration – Andrew G Aug 13 '14 at 17:21
0

Sorry I know my response is a little late. I faced a similar problem inserting Point coordinates to postgis but was successful when I replaced the comma in the coordinates with a space; [-48.23456,20.12345] to [-48.23456 20.12345]

INSERT INTO layer_radar (id, geom)
VALUES
(
    '3bf24920-225b-11e4-8c21-0800200c9a66',
    ST_GeomFromGeoJSON('{"type":"Point","coordinates":[-48.23456 20.12345]}')
)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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