Search code examples
pythonopencvgoogle-mapspyprojepsg

Python: correcting offset of points on google maps (due to satellite image tilt)


I'm using the google maps static api to get top view satellite images of objects of which I have the surface coordinates (LoD1 / LoD2).

the points are always slightly off, I think this is due to a small tilt in the satellite image itself (is it a correct assumption?).

For example in this image I have the building shape, but the points are slightly off. Is there a way to correct this for all objects?

The red markers are the standard google-maps api pointers, the center of the original image (here it is cropped) is the center of the building, and the white line is a cv2.polyline implementation of the object shape.

Just shifting by n pixels will not help since the offset depends on the angle between the satellite and object and the shape of that object. I am using the pyproj library to transform the coordinates, and then convert the coordinates to pixel values (by setting the center point as the center pixel value, and having the difference in the coordinate space, one can calculate the edge-points pixel values too).


Solution

  • So - the good news is that there is no need to "correct" this for all objects, because there is no way to do that without using 3d models & textures.

    Google (or most map platforms for that matter) don't actually use satellite images, they use aeroplane images. The planes don't fly directly over the top of every building (imagine how tight/redundant their flight path would be if they did!).

    Instead, the plane will take an image from some kind of angle, and then, through the wonders of photogrammetric processing, the images are all corrected and ortho-rectified so the ground surface is in the right place everywhere.

    What can't (and shouldn't) be corrected in a 2d image is the location of objects above ground height. Like the roof in your image. For a more extreme example, just look at a skyscraper, and you'll realise you can't ever get the pixels correct above the ground: https://goo.gl/maps/4tLSrd7yXQYWZPTy7