I have a very small area map , which I downloaded from Openstreet map(PNG) and also its OSM(.osm) file which contains its Lat ,long.
Now I want to convert Lat ,long to an XY coordinate system (e.g. UTM) and then map this to pixel space of my Image which is of size (600 x 800 ). I know its a two way process ,like to know how to do this . Thank you
Assuming map is Northern Hemisphere Only (no part of map is southern hemisphere)
Given a Latitude and Longitude, to determine which pixel they clicked on:
K = Input Latitude
Calculate X-pixel
XPixel = CInt(((Y - J) / CDbl(Z)) * 800)
Calculate Y-pixel
YPixel = CInt(((A - K) / CDbl(C)) * 600)
Here is a cartographic library that should help with GPS to UTM conversions
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With