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

Robert Hewlett rob.hewy at gmail.com
Mon Aug 18 08:34:23 PDT 2025


First step, make sure you are not crossing over.

You say x y but latitude longitude is y x.

All the best

On Mon, Aug 18, 2025 at 6:40 AM Luca Bertoncello <lucabert at lucabert.de>
wrote:

> Hi list!
>
> Sorry, I'm OT, but I don't know other one that (hopefully!) can help
> me...
>
> So, my problem: I have a map, generated from Tiles (generated from OSM,
> but this is not very important).
> The map is NOT the whole word, just a little part.
> In my currently test case, about 2°x2° and this is 1792x1536 pixel.
>
> I need to calculate the X,Y position starting from the coordinates
> (latitude, longitude).
> I searched many procedures in Internet, but I cannot locate a marker at
> the wanted place...
>
> I tried to ignore that the word is almost a sphere and calculate the X,Y
> as this is flat (X and Y are the size of the map related to the delta of
> coordinates), but the position is always wrong.
>
> Now, I'm not very good (AKA: very bad!) in geometry, so I really don't
> know how to solve my problem.
>
> I'm working in PHP, but a generic example of the procedure is enough.
>
> Can someone help me?
>
> Thanks a lot
> Luca Bertoncello
> (lucabert at lucabert.de)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20250818/c2ce968f/attachment.htm>


More information about the postgis-users mailing list