I am trying to load latitude and longitude from a CSV file to PostgreSQL database table using a database function. The db function has the following code to transform the lng/lat to the proper point data:
"ST_Transform(ST_SetSRID(ST_MakePoint(longitude,latitude),4326),2272)"
.
The database table has a field called 'location' and is configured as : geometry(Point,2272)
.
It was working fine until I had to reinstall the database, and subsequently reinstalled PostGIS / GDAL / proj / etc.
Now, the db function generates a point data that is somewhere in Antartica. I compared the data by running
SELECT ST_Transform(ST_SetSRID(ST_MakePoint(-77.622917,40.67931),4326),2272);
and got '0101000020E0080000487BB57A23933E41987B010FC2ED1D41'
.
Whereas if I run the same query in my test server, I get the correct result as: '0101000020E0080000397BB57A23933E41987B010FC2ED1D41'
It's just a difference of 2 digits ( bolded ). How can I rectify this ?
dev server:
POSTGIS="2.4.4 r16526" PGSQL="100" GEOS="3.8.1-CAPI-1.13.3" PROJ="Rel. 4.9.1, 04 March 2015" GDAL="GDAL 3.1.2, released 2020/07/07" LIBXML="2.9.2" LIBJSON="0.15" LIBPROTOBUF="1.3.3" TOPOLOGY RASTER
test server:
POSTGIS="2.5.2 r17328" [EXTENSION] PGSQL="110" GEOS="3.7.0-CAPI-1.11.0 673b9939" PROJ="Rel. 5.2.0, September 15th, 2018" GDAL="GDAL 2.3.1, released 2018/06/22" LIBXML="2.9.1" LIBJSON="0.12" LIBPROTOBUF="1.3.0" TOPOLOGY RASTER
ST_AsText(ST_GeomFromEWKB(E'\\x0101...'))
I get the same value, down to a few nanometers (I think — I got lost counting the decimals).