tiling render problems unprojecting mercator units with pyproj
See original GitHub issueDescription
Experimenting with the tiling renderer my first attempt at a load_data_func I figured I’d take the x_range and y_range passed in and transform it to lat/lon so as to constrain the postGIS query that loads the tile data.
- What went wrong, or what were you unable to do?
pyproj appears to not correctly transform the ranges generated by the tiler:
from pyproj.proj import Proj
proj = Proj(init="epsg:3857", preserve_units=False)
# these extents are passed to the tiling load_data_func
print(proj((-20037508.34, 20037508.345578488), (-20037508.34, 20037508.345578488), inverse=True))
# ((-179.9999999749438, -179.9999999749438), (-85.05112877764508, 85.05112878196812))
#these extents are the bounds described on https://epsg.io/3857
print(proj((-20026376.39, 20026376.39), (-20048966.10, 20048966.10), inverse=True))
# ((-179.89999996667325, 179.89999996667325), (-85.04249459864828, 85.04249459864828))
- What did you expect to happen?
that the extents would match those returned by pyproj:
In [2]: proj((-180, 180), (-85.06, 85.06))
Out[2]:
((-20037508.342789244, 20037508.342789244),
(-20048966.1040146, 20048966.104014594))
I am not a GIS expert so the above could be wrong, but maybe someone has an idea that can shed some light on it. I was able to work around the problem by running one large sql query and making one big dataframe that all the tiling operations used (similar to the tiling notebook example) and it’s actually faster, so it’s not like this is a pressing issue for me, just a stumbling block.
How to reproduce
The tiling notebook can be used to generate the ranges:
https://github.com/pyviz/datashader/blob/master/examples/tiling.ipynb
Your environment
pip3 installed datashader and pyproj.
- What operating system and version?
Debian stretch with python3.5, libproj-dev
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top GitHub Comments
@ppwadhwa hey yes definitely. I’ll be pushing to deprecate
tiles.py
from within datashader.@brendancol thanks. we’ll close this issue and follow up in mapshader.