trailbehind / DeepOSM

Train a deep learning net with OpenStreetMap features and satellite imagery.
MIT License
1.31k stars 182 forks source link

Is web mercator transform correct? #82

Open WillieMaddox opened 7 years ago

WillieMaddox commented 7 years ago

In geo_util.py, this line gives me the correct lat lon in web mercator.

x2, y2 = transform(in_proj, out_proj, ulon, ulat)

But this last line (just before the return) seems to transform it back to lat lon in degrees:

x2, y2 = out_proj(x2, y2, inverse=True)

which I believe is incorrect. Am I missing something here?

lematt1991 commented 7 years ago

I might suggest using the geoio library. It provides a GeoImage class with methods for performing these transformations proj_to_raster and raster_to_proj. It automatically extracts the metadata from the GeoTIFF to figure out how to perform these transformations.