Giter Club home page Giter Club logo

Comments (8)

george-silva avatar george-silva commented on June 27, 2024

You'll need these dependencies. They are there for a reason.

Solution: Install GEOS. Review the documentation for your operating system.
If on Windows, I recommend OSGEO4W Installer.

On Wed, Jan 28, 2015 at 12:35 PM, V1ce [email protected] wrote:

Hi,

I got a problem, i can't add marker to map with my current code, he works
well some week ago, but with no reason and no edit code it just stop to
work, dt understand...

  • latest stable version of django-leaflet and django-geojson
  • django 1.7.4
  • Python 3.4

It's just a basic call :

models.py :

class lieu(models.Model):
nom = models.CharField(max_length = 30, null = True)
geom = GeometryField()
description = models.TextField(null = True)
categorie = models.ForeignKey('categorie', null=True, blank=True)
def str(self):
return self.nom

urls.py

url(r'^map/(?P\w+)/?$', getlieux.as_view(),name='getlieu'),

views.py

class getlieux(GeoJSONLayerView):
model = lieu
#properties=('popupContent',)
def get_queryset(self):
return lieu.objects.filter(categorie__nom=self.kwargs['categ'])

javascript :

$('.rem').click(function() {

categ = $(this).text();

$.getJSON('/map/' + categ + '/', function (data) {

marker.addData(data);

});

});

I got this with the ajax request, thats looks normal answer :

{"type": "FeatureCollection", "features": [{"properties": {"model":
"plan.lieu"}, "type": "Feature", "id": 12, "geometry": {"type": "Point",
"coordinates": [0.17282545566558838, 47.282842764549855]}}], "crs":
{"properties": {"href": "http://spatialreference.org/ref/epsg/4326/",
"type": "proj4"}, "type": "link"}}

At the install of django-geojson i got geos error dependency, so cant load
template, i comment these lines in djgeojson/views.py (thx fle post about
this) :

#from django.contrib.gis.geos.geometry import Polygon
#from django.contrib.gis.db.models import PointField

And after that i can load my templates correctly, i dont think that provoc
my problem because my code works some week ago with these line commented...

i got an other random error like this :
At my first install of leaflet and djgeojson, i was able to create a point
field in django-admin with the leaflet widget admin, but can't edit it, the
leaflet.js just freeze my web browser (firefox or chrome), but works with
other geometry field. And in a day, without touch anything in the code,
without update etc i was able to edit my point field, from this moment i dt
got this error anymore.

Thanks for your answer and enjoy my bad english :p


Reply to this email directly or view it on GitHub
#51.

George R. C. Silva

SIGMA Consultoria

http://www.consultoriasigma.com.br/

from django-geojson.

V1ce avatar V1ce commented on June 27, 2024

thx but why i was able to use django-geojson without spatial dependencies few time ago and with the same version?

from django-geojson.

george-silva avatar george-silva commented on June 27, 2024

Leaflet is a client library that runs on the browser, not server.

What I mean here is that there is no bug on django-geojson code. You need
the dependencies for the code work properly.

On Wed, Jan 28, 2015 at 12:44 PM, V1ce [email protected] wrote:

thx but why i was able to use leaflet without spatial dependencies few
time ago?


Reply to this email directly or view it on GitHub
#51 (comment)
.

George R. C. Silva

SIGMA Consultoria

http://www.consultoriasigma.com.br/

from django-geojson.

V1ce avatar V1ce commented on June 27, 2024

Problem resolv without geos or postgis.

Just forgot to initialyze my layer in the map_init function

function map_init(map, options) {

var collection ;
#before :/
L.geoJson(collection, {onEachFeature: onEachFeature}).addTo(map);
#now :)
layer = L.geoJson(collection, {onEachFeature: onEachFeature}).addTo(map);
}

and i can now add data to him

$('.rem').click(function(e) {

categ = $(this).text(); 

$.getJSON('/map/' + categ + '/', function (data) {

    layer.clearLayers() 
    layer.addData(data);
});     

});

2 day for that :p

from django-geojson.

leplatrem avatar leplatrem commented on June 27, 2024

Please close this issue if there is nothing we have to do :)

from django-geojson.

V1ce avatar V1ce commented on June 27, 2024

Hi,

I re-open this issue about this 2 lines i have commented in djgeojson/views.py, so with that no need geos :

#from django.contrib.gis.geos.geometry import Polygon
#from django.contrib.gis.db.models import PointField

Actually thats work fine for my use, just click in a link and some points pop in the map. But i want to know if these 2 lines can provoc some problems in the future?

At this http://fle.github.io/easy-webmapping-with-django-leaflet-and-django-geojson.html Fle say :

"The magic thing is that you don't need a spatial database or some complex geographic libraries! Mathieu and I have removed the last dependencies to GEOS a few days ago. I'm glad I could make this tiny contribution!"

Can i really continue to use Django-geojson without geos?

Thanks :)

from django-geojson.

leplatrem avatar leplatrem commented on June 27, 2024

What is your problem exactly ?

Yes, we want to continue to support django-geojson without GEOS. If you have a particular problem, just tell us :)

from django-geojson.

V1ce avatar V1ce commented on June 27, 2024

Hi,

No problem at this time, just want know if i can continu with these pratices. Thanks

from django-geojson.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.