I have a Postgres database with the Postgis extension created on it.
I want to use the ST_GeomFromGeoJSON function. The docs state:
If you do not have JSON-C enabled, you will get an error notice instead of seeing an output. To enable JSON-C, run configure --with-jsondir=/path/to/json-c. See Section 2.2.3, “Build configuration” for details.
So I ensure that I have JSON-C installed and I configure Postgis with it...
# install json-c
curl -L --output /tmp/json-c.tar.gz https://s3.amazonaws.com/json-c_releases/releases/json-c-0.10-nodoc.tar.gz
tar -xvf /tmp/json-c.tar.gz -C /tmp/
mkdir -p /var/lib/include
cp -r /tmp/json-c-0.10 /var/lib/include/json-c
# install postgis
curl https://download.osgeo.org/postgis/source/postgis-3.0.3.tar.gz -o ./postgis-3.0.3.tar.gz \
&& tar xvzf postgis-3.0.3.tar.gz
# configure postgis
cd /tmp/postgis-3.0.3
./configure --without-raster --with-jsondir=/var/lib \
&& make \
&& make install
then, I run the following in the database
postgres=# create extension postgis;
CREATE EXTENSION
postgres=# select ST_GeomFromGeoJSON('{"type": "Point", "coordinates": [0,0]}');
ERROR: You need JSON-C for ST_GeomFromGeoJSON
Why am I getting that error? I am including JSON-C when I am configure postgis, no? Am I missing something in my installation steps?
Postgres: 12.7
Postgis: 3.0.3
--with-jsondir=/var/lib/include/json-c
instead of--with-jsondir=/var/lib
? - Jim Jones