geodjango

AttributeError: /usr/lib/ogdi/libgdal.so: undefined symbol: GDALVersionInfo

自闭症网瘾萝莉.ら 提交于 2019-12-02 07:47:29
I have setup the database using geodjango documentation and when I am doing python manage.py sqlall world I am getting this error: OSError: /home/nishant-un/local/lib/libgdal.so: cannot open shared object file: No such file or directory And when I locate libgdal.so I found it in: /usr/lib/ogdi/libgdal.so So I changed the GeoDjango Settings: GDAL_LIBRARY_PATH = '/home/nishant-un/local/lib/libgdal.so' to GDAL_LIBRARY_PATH = '/usr/lib/ogdi/libgdal.so' Then When I do python manage.py sqlall world again: I get the error as: AttributeError: /usr/lib/ogdi/libgdal.so: undefined symbol: GDALVersionInfo

GeoDjango & SpatiaLite - filtering nearby objects

谁都会走 提交于 2019-12-01 23:35:00
问题 My models.py has User and Business models that have this field: location = PointField(geography=True) I'm getting Google Maps coordinates (in EPSG 4326 ) via Geocode service from an address which the user specifies. Then I'm saving it in the above field (also EPSG 4326 ). Now, what I want is to get all Business objects within a specified radius (of 1km for example), based on the user location: Business.gis.filter(location__distance_lt=(request.user.location, D(km=1))) But it doesn't work, it

Django GIS : Using location__dwithin gives “Only numeric values of degree units are allowed” however location__distance_lte works fine

纵饮孤独 提交于 2019-12-01 21:59:26
问题 I have the following two queries. The first one works fine however the last one which uses location__dwithin returns back Unable to get repr for . Any suggestions on why the last one fails ? querySet = modelEmployee.objects.filter(location__distance_lte=(modelemp.location, D(mi=150))) and the other one is: querySet = modelEmployee.objects.filter(location__dwithin=(modelemp.location, D(mi=150))) This is what my modelEmployee looks like class modelEmployee(models.Model): user = models

GeoDjango & SpatiaLite - filtering nearby objects

旧巷老猫 提交于 2019-12-01 21:37:58
My models.py has User and Business models that have this field: location = PointField(geography=True) I'm getting Google Maps coordinates (in EPSG 4326 ) via Geocode service from an address which the user specifies. Then I'm saving it in the above field (also EPSG 4326 ). Now, what I want is to get all Business objects within a specified radius (of 1km for example), based on the user location: Business.gis.filter(location__distance_lt=(request.user.location, D(km=1))) But it doesn't work, it gives me this error: ValueError: SpatiaLite does not support distance queries on geometry fields with a

GeoDjango & MySQL: points can't be NULL, what other “empty” value should I use?

空扰寡人 提交于 2019-12-01 18:11:42
I have this Django model: from django.contrib.gis.db import models class Event(models.Model): address = models.TextField() point = models.PointField('coordinates', null=True, blank=True) When I sync this model using MySQL, this error message is printed while creating indexes: Failed to install index for events.Event model: (1252, 'All parts of a SPATIAL index must be NOT NULL') so, not being able to use null=True (given that I want to have that index), what other possibilities do I have? I could define the point (0,0) as "empty", but then I have to remember that convention everywhere I plan to

Getting “django.core.exceptions.ImproperlyConfigured: GEOS is required and has not been detected.” although GEOS is installed

不打扰是莪最后的温柔 提交于 2019-12-01 15:36:15
I'm running Django 1.8 and Python 3.4 on Ubuntu 14.04 LTS . Just recently, my Django app has been reporting that GEOS is not present. GEOS is installed and libgeos_c.so is where it's supposed to be ( /usr/lib/ ). My code seems fine. It is the source of a docker image which still works. This seems to indicate an os/incompatibility issue. Any help would be much appreciated. The full traceback is Traceback (most recent call last): File "<path/to/my/homedir>/pycharm-4.5.1/helpers/pydev/pydevd.py", line 2358, in <module> globals = debugger.run(setup['file'], None, None, is_module) File "<path/to/my

Getting “django.core.exceptions.ImproperlyConfigured: GEOS is required and has not been detected.” although GEOS is installed

徘徊边缘 提交于 2019-12-01 14:32:25
问题 I'm running Django 1.8 and Python 3.4 on Ubuntu 14.04 LTS . Just recently, my Django app has been reporting that GEOS is not present. GEOS is installed and libgeos_c.so is where it's supposed to be ( /usr/lib/ ). My code seems fine. It is the source of a docker image which still works. This seems to indicate an os/incompatibility issue. Any help would be much appreciated. The full traceback is Traceback (most recent call last): File "<path/to/my/homedir>/pycharm-4.5.1/helpers/pydev/pydevd.py"

How efficient is it to order by distance (entire table) in geodjango

吃可爱长大的小学妹 提交于 2019-12-01 09:23:47
Assume that I have the following data model Person(models.Model): id = models.BigAutoField(primary_key=True) name = models.CharField(max_length=50) location = models.PointField(srid=4326) Assume also that I have an app that makes queries to this django backend, and the only purpose of this app is to return a (paginated) list of registered users from closest to farthest. Currently I have this query in mind: # here we are obtaining all users in ordered form current_location = me.location people = Person.objects.distance(current_location).order_by('distance') # here we are obtaining the first X

Django's Distance function not returning a Distance object

感情迁移 提交于 2019-12-01 08:50:11
This is an unexpected behavior that came up on the road to solve this problem with @Nargiza: 3d distance calculations with GeoDjango . Following the Django docs on the Distance function : Accepts two geographic fields or expressions and returns the distance between them, as a Distance object . And from a Distance object , we can get the distance in each and every one of the supported units . But: Let model be: class MyModel(models.Model): ... coordinates = models.PointField() then the following: p1 = MyModel.objects.get(id=1).coordinates p2 = MyModel.objects.get(id=2).coordinates d = Distance

Django's Distance function not returning a Distance object

对着背影说爱祢 提交于 2019-12-01 06:52:02
问题 This is an unexpected behavior that came up on the road to solve this problem with @Nargiza: 3d distance calculations with GeoDjango. Following the Django docs on the Distance function : Accepts two geographic fields or expressions and returns the distance between them, as a Distance object . And from a Distance object , we can get the distance in each and every one of the supported units. But: Let model be: class MyModel(models.Model): ... coordinates = models.PointField() then the following