2

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

Neven
  • 453
  • 2
  • 7
  • 14

1 Answers1

0

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
John Moutafis
  • 22,254
  • 11
  • 68
  • 112
  • Hey, thanks for replying! I am not at the home at the moment, so I don't have the project to check. In a few days I will and then I will write to you! :) – Neven Aug 12 '18 at 21:24
  • 1
    @Neven @John hey, I'm running into a similar issue, did you ever figure this out? For me, running `collectstatic` didn't help :/ While it did create `proj4js.js` and `proj4leaflet.js` in my `STATIC_ROOT` dir, it did not create the `31277.js` file. Is it supposed to, or should I manually add it? And should we really rely on `collectstatic` in development? That seems a bit odd, no? – sc28 Apr 11 '19 at 19:19