smopy icon indicating copy to clipboard operation
smopy copied to clipboard

Retrieving the lat and lon of the map.

Open krish-adi opened this issue 5 years ago • 1 comments

map = smopy.Map((52.346715, 4.885780, 52.348233, 4.891473))

When I pass this, the zoomlevel is adjust for the maximum, and set at 17. And the resulting map's min lat, lon and max lat, lon is not the same as the one that is originally passed. How do I retrieve the min lat, lon and max lat, lon of the resulting map?

Is there a way to also retrieve the following data?

  • pixel size in the x-direction in map units/pixel
  • rotation about y-axis
  • rotation about x-axis
  • pixel size in the y-direction in map units, almost always negative[3]
  • x-coordinate of the center of the upper left pixel
  • y-coordinate of the center of the upper left pixel

I would like to fetch an image for a coordinate box and create a "World File" for it.

krish-adi avatar Apr 05 '20 20:04 krish-adi

I played around with the package a bit and came to the same issues ... I think the fetched map is bigger because of the added margin.

In my Fork I added a function map.to_coords(x,y) that converts pixels to coords. with BBox=list(map.to_coords(0,0)+map.to_coords(map.w-1,map.h-1)) you get the BoundingBox with the coordinates of the img.

I needed them for ploting axis

https://github.com/Simon-Liebig/smopy

I am very new to working with git and python. If someone tells me how to push or merge my edit to this repro I could do that.

Simon-Liebig avatar Apr 24 '20 17:04 Simon-Liebig