Tuesday, February 26, 2019

django leaflet error "L"

Hello , i have these errors

L.Map.djangoMap is not a function
leaflet.js net::ERR_ABORTED 404 (Not Found)
leaflet.css net::ERR_ABORTED 404 (Not Found)
leaflet.extras.js net::ERR_ABORTED 404 (Not Found)
leaflet.extras.js net::ERR_ABORTED 404 (Not Found)

I've added djgeojson and leaflet
here is my code:

<!doctype html>
<html>

{% load leaflet_tags %}
  <head>

     {% leaflet_js %}
        {% leaflet_css %}
  
    <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
    <style>
        .leaflet-container { height: 100%; }
        #map { height: 180px; }
    </style>
  </head>
<body>
        {% leaflet_map "main" callback="myfunction" %}

    <h1>Django-Leaflet</h1>
       <script type="text/javascript">
        function myfunction (map, options) {
            var dataurl = '{% url "data" %}';
            // Download GeoJSON via Ajax
            $.getJSON(dataurl, function (data) {
                // Add GeoJSON layer
                L.geoJson(data).addTo(map);
            })
        }
    </script>
   

 
  </body>
</html>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d00c6925-d1e9-4770-82bd-b07accb98e87%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment