Setting up a SRID to a Leaflet - Geodjango

不打扰是莪最后的温柔 提交于 2019-12-24 05:58:30

问题


I have data in my Postgres DB which are in 31277 projection. Anyway, I am using Leaflet map to show them with Geodjango. Right now, my data are moved somewhere down in the map, so I need to change the projection of the Leaflet map.

In documentation (http://django-leaflet.readthedocs.io/en/latest/advanced.html) is written just to add SRID attribute to LEAFLET_CONFIG variable, which I did. Like here:

LEAFLET_CONFIG = {
    'DEFAULT_ZOOM': 13,
    'MIN_ZOOM': 2,
    'MAX_ZOOM': 18,
    'SRID':31277
}

But after I added SRID attribute I got an error when I tried to access to that page with a map:

"GET /static/proj4js/31277.js HTTP/1.1" 404 1770

Also, I get same error for the WGS84 - 4326


回答1:


Judging by the path of the error you are getting, that starts with static and the documentation of django-leaflet on the CONFIG subject:

By default, django-leaflet will try to load the spatial reference from your static files at “proj4js/{{ srid }}.js”.

I would suggest configuring your static file settings and run

python manage.py collectstatic


来源:https://stackoverflow.com/questions/51786438/setting-up-a-srid-to-a-leaflet-geodjango

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!