这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@glebpinigin
Copy link

Mapnik source on-the-fly reprojection used deprecated proj4 API for assigning mapnik.Map object's projection.

This behavior and the way to fix it is described in issue #538

Debian package maintainers apply this fix with one of patches so that debian-based package works properly and does not fail to render mapnik sources. However it is not the case for installations based on source code (e.g. via pip)

@glebpinigin
Copy link
Author

glebpinigin commented Feb 7, 2024

This fix may lead to some backward compatibility issues with outdated versions of mapnik and proj. I am not sure if it is an issue, because most popular distributions ship mapnik versions that support newer proj API thus incompatible with current mapproxy source code.

However, if we don't want to deal with this compatibility break there is a way to generate valid proj4 string from EPSG code with pyproj and using it for mapnik configuration

proj_string = pyproj.Proj('EPSG:XXXX').to_proj4()

@simonseyock
Copy link
Collaborator

Hello, sorry for the very late response. If we can use a variant that does not break compatibility, I would prefer that one. We can then merge this in the near future.

@b-r-u
Copy link

b-r-u commented Oct 30, 2025

What about something like this? It needs an import from pyproj that I see nowhere else, but that library seems to be a requirement for mapproxy.

from pyproj import PROJ_VERSION
#....
# Check major proj version and adjust srs definition accordingly
if PROJ_VERSION[0] >= 6:
    m.srs = str(query.srs.srs_code.lower())
else:
    m.srs = '+init=%s' % str(query.srs.srs_code.lower())

b-r-u added a commit to b-r-u/mapproxy that referenced this pull request Nov 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants