[a little bit OT] calculating X,Y from latitude and longitude

Luca Bertoncello lucabert at lucabert.de
Tue Aug 19 04:14:57 PDT 2025


Am 19.08.2025 13:04, schrieb Regina Obe:

Hi Regina,

> In my PHP programs I do one of 2 things
> 
> 1) If I have a file I'm converting the coordinates of I call ogr2ogr
> from a php system command
> 
> https://www.php.net/manual/en/function.system.php
> 
> ogr2ogr is a commandline tool so can be used in php if the web context
> has the right access.
> 
> But I haven't done that in some time so don't have code readily handy
> to share and this does assume you have GDAL installed on your server.

Maybe this is not a good solution for me, if I have to convert a lot of 
coordinates...

> 2) If it's user input I'm trying to convert, I just call an SQL
> ST_Transform  statement as Greg mentioned
> 
> https://postgis.net/docs/en/ST_Transform.html
> 
> in a php PDO command.

mmmm... can I use the function to convert the coordinates in a map I 
created without using the GIS functions?
So, I create the image getting the tiles from my server, then I query a 
PostGIS instance giving the boundingbox (coordinates) of the image and 
width+height in order to get the coordinates of a point to be converted 
in X,Y?

> And as Greg mentioned, if we start getting into too many PHP details,
> then it's off-topic for this mailing list.

I know...
Unfortunately I don't know other ML about the problem, so I decided to 
ask here...

Thanks
Luca Bertoncello
(lucabert at lucabert.de)


More information about the postgis-users mailing list