Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Converting Pixels to LatLong

by ikegami (Patriarch)
on Feb 14, 2007 at 19:03 UTC ( [id://600042]=note: print w/replies, xml ) Need Help??


in reply to Converting Pixels to LatLong

That depends on the projection used to obtain the map image.

This post is wrong from this point on.

If you draw a three points on the map such that
Ay == By && Ax != Bx
Ax == Cx && Ay != Cy

+=====================+ # # # A-------------B # # | # # | # # C # # # +=====================+

Is Alat == Blat && Along == Clong?

  • If so, every pixel represents the same long and lat difference.

    Pixellat = (Blat - Alat) / (Bx - Ax)
    Pixellong = (Clong - Along) / (Cy - Ay)

  • If not, the math gets a bit more complicated, but it's still pretty straightforward. You'll probably need a fourth point D such that
    Dx == Bx && Dy == Cy

    +=====================+ # # # A-------------B # # | | # # | | # # C-------------D # # # +=====================+

    There surely exists modules to help you here.

Replies are listed 'Best First'.
Re^2: Converting Pixels to LatLong
by akho (Hermit) on Feb 14, 2007 at 19:19 UTC
    No.

    If the Mercator projection was used, then Alat == Blat && Along == Clong, but pixels near the poles and pixels on the equator represent very different long values.

    It's hard to find out which projection was used if you only look at a finite number of points.

    Finding a map with a known projection for use in the program seems a better way to do it.

      Shoot! I mixed up distances with long/lat somewhere along the way.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://600042]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2025-11-14 18:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (71 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.