How can I convert EPSG4326 point to UTM in spatialite?

SRID=4326;POINT(51.2506238 35.70442974)

Executing X(TRANSFORM(Geometry, 32639)) as X always returns NULL. What's the proper way of extracting northing and easting from geometry type 4326?

enter image description here


You've not given a reproducible example, but here's one:

spatialite> select X(transform(GeomFromText("POINT (0 0)",27700),4326));
X(transform(GeomFromText("POINT (0 0)",27700),4326))

The X coordinate of (0,0) in epsg:27700 is -7.55 degrees in epsg:4326.

And here it is in spatialite-gui (version 2.0.0):

enter image description here

if this fails for you, then there's something wrong or just different with your Spatialite installation.

I'm not sure what your "SRID=..." line is suppose to be. Is that some text in a geometry column? I've constructed a geometry from a string in WKT format with the SRID passed to the GeomFromText function.

  • "SRID=..." is just represention of my geometry point type. I mean how can I extract easting and northing from existing field – Mani devs Sep 3 '18 at 18:58
  • Is it a valid representation of a point in Spatialite SQL? How are you converting this to a geometry type? – Spacedman Sep 3 '18 at 19:00
  • this is what spatialite-gui show about the geometry field SRID: 4326 Geometry type: POINT #1 POINT: 1) 51.2506 35.7044 – Mani devs Sep 3 '18 at 19:03
  • executing select X(transform(GeomFromText("POINT (0 0)",27700),4326)); in spatialite-gui 2.0.0-devel returns null also – Mani devs Sep 3 '18 at 19:07
  • @user30184 good point, but double quotes seems to work for me also. hmmm... – Spacedman Sep 3 '18 at 20:16

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.