Any idea why I am not able to to use "st_asgeojson...
# sql
u
Any idea why I am not able to to use "st_asgeojson()" function. Trying to play with sql editor (never used postgis before). I have enabled the extension aswell and all other which mention the "postgis".
Says that function does not exist.
j
Are you using it in all lower case? I assume it doesn't make a difference but figured I'd ask anyway
u
Yeah i tested
And tested with "ST_ASGEOJSON" and lowercase aswell.
j
and ST_AsGeoJSON I assume?
u
ye same thing "function st_asgeojson(json) does not exist"
j
What do you see when you run
Copy code
SELECT * 
FROM pg_extension;
u
Sec let me try.
Didnt knew that command (pretty noob with sql)
And these are the extensions which I have enabled:
And to add, my column where I try pull the data is at "json" type:
And its origin where I take the data from (api source) as default geojson format (WGS84)
Now I am not sure, does this have anything to do with the issue. Been struggeling to understand this, these past couple of days.
Doing more digging into this, having hard time to understand why giving just mock value works, but doing same thing but taking values from table does not work :/
Copy code
/* SELECT st_geomfromgeojson(aarni)
FROM collectionspots
WHERE aarni IS NOT NULL; */
vs
Copy code
select st_astext(st_geomfromgeojson(
       '{"type": "Point",
         "coordinates": [-71.11295700073242,42.37896312335581]}'
));
Did some debugging and it seems like, that if some rows coordinate column is null its causing issues. For example if i just specify random id it works.
Atleast now made some progress and we know that these 2x functions work for me.
I did take that into consideration, hence added the "WHERE X is not null" but that doesnt seem to be working.
j
@uskolol I have a sneaking suspicion that the nullif function might be handy for you
u
Cheers, ill look into that function and try solve it.