0

What I have:

  • A satellite image of an area of interest.
  • The image is 512px by 512px.
  • The center of the image (256,256) has longitude and latitude coordinate (assuming center_lon = -100.577580, center_lat = 60.312079)
  • The zoom level of the image is 15 (defined here: Openstreetmap Resolution and Scale).

Question: Now I have an array of points with longitude and latitude coordinates points = [(lon1, lat1), (lon2, lat2) ...]. How can I project these points to points_xy = [(x1, y1), (x2, y2) ...], so I can draw these points on the map canvas?

One tedious approach I can think of:

  1. Find the resolution (meters per pixel) first: resolution = (earth_radius * 2 * math.pi / 512) * math.cos(center_lat * math.pi / 180) / (2 ** zoom_level) using the equation given here: Openstreetmap Resolution and Scale
  2. Calculate the physical distance (in meters) between the query points and the center point (d1x, d1y)... (as described here: How to convert latitude or longitude to meters?). Then I can calculate the pixel coordinates of the point x1 = (256 + d1x) / resolution and y1 = (256 + d1y) / resolution

Other thoughts:

I can also use linear interpolation, but we need to know the longitude and latitude coordinates of the corners. (How?)

Shayne
  • 1

0 Answers0