I'm building an application that saves geographical data to the postgresql db with postgis extension.

The data I'm saving is in EPSG 4326 WGS84 format, so I'm sending lat/lng coordinates to the postgresql and on insert, it changes the coordinates to a geometry POINT string like so:

GPS (39.10, 9.10)
POINT (1000FF111FFFGGGAAA1) // casual digits and letters

Before sending the data to the db I need to transform the point from EPSG 4326 to 32632 so that I can apply geometric functions to the geometric points. I know how to use ST_Transform, and the translation happens on the DB. What I would like to do is to make the transformation happen on the server so that the point is inserted directly with 32632 SRID.

Is it possible?

  • not sure if I get that; you want to pre-transform your points within node.js? I wouldn't, PostGIS is really good at that, why adding another processing layer in-between? apart from that, having your data in EPSG:4326 has certain benefits, namely interchangeability and, most of all, the possible cast to GEOGRAPHY that let's you get highly precise calculations in a proper setting. it depends somewhat on the functionality you are aiming at; what do you have in mind here? – geozelot Dec 4 '18 at 13:58
  • Hello ThingumaBob, thanks for helping me out! I managed to do it withing nodejs by using PRO4J package. Thank you! – mnemosdev Dec 6 '18 at 11:52

The coordinates SR can be changed within nodejs by using PRO4J ported package, by defining the SRs needed and their definitions, which can be found on geoportals.

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.