NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

I think is better explain with a small example: selected a geometry point i get it back in a coordinates pair

SELECT ST_AsGeoJSON('010100002031BF0D009A999919F9BD2D41CDCCCC4C758E5241')
--result:
"{"type":"Point","coordinates":[974588.55,4864469.2]}"

to return back the geometry simply i make

SELECT ST_GeometryFromText('POINT(974588.55 4864469.2)')

having for example the same pair of geographic coordinates in degrees

coordinates:[9.7458855,48.644692]}

How can i transform them into the previous pair format and get the starting geometry?

I'm working with leaflet and i would implement a kind of routing service using pgRouting, I have populated postgis with "osm2pgsql" tool and all geometries are of 900913 SRID type. My goal is to compare the source and target points on a map with the vertices stored in postgres. Applying a transformation on a point picked from the map to 900913 srid don't get me the right thing, also i notice that the last four numbers (5241) are the same for each geometry in the db and them are different when i transform the geometry returned from my point, what they refer?

asked 22 Aug '15, 20:11

gaia's gravatar image

gaia
16113
accept rate: 0%

edited 22 Aug '15, 23:13

1

This question is not really on topic, it's more a general GIS question.

(23 Aug '15, 09:59) SK53 ♦

I thought there was some special function of osm2pgsql, is osm2pgsql on topic with the forum?

(23 Aug '15, 12:36) gaia

You can change the SRID used by osm2pgsql too, but the question focussed on changing SRID with leaflet, pg_routing and already populated db.

(23 Aug '15, 18:14) SK53 ♦

The two functions you want are ST_SRID and ST_SetSRID.

permanent link

answered 23 Aug '15, 10:00

SK53's gravatar image

SK53 ♦
28.1k48268433
accept rate: 22%

yes, i solved setting first the srid of the coordinates and only then applying a transformation

(23 Aug '15, 12:40) gaia

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×165
×134
×3

question asked: 22 Aug '15, 20:11

question was seen: 4,389 times

last updated: 23 Aug '15, 18:14

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum