Open h4k1m0u opened 6 years ago
Yes it's possible. Step that I did was :
def yourpolygon_datasets(request):
yourpolygon = serialize('geojson', Yourpolygonmodel.objects.all())
return HttpResponse(smpsungai, content_type='json')
in url:
path('yourmodel_data/', yourmodel_datasets, name='yourmodelurl'),
You should be able to accessing it via host:port/yourmodelurl
var datasets_yourmodel = new L.GeoJSON.AJAX("{% url 'yourmodelurl' %}",{
//query popup or color of polygon here
}).addTo(map)
Hi,
Is it possible to add a
GeoDjango
PolygonField
to the Leaflet map? I've tried to do that by adding the js code below to my template, but I get aTypeError: t is null
instead:In the code above
extent
is my object and the PolygonField is calledgeometry
. So I thought maybe I should use thecoords
property instead. But the same error persisted.