geodjango

Cannot set MODEL_NAME SpatialProxy (POLYGON) with value of type: <class 'django.contrib.gis.geos.polygon.Polygon'>

流过昼夜 提交于 2021-02-08 08:15:17
问题 When I try an API call to the url of one my models I face the following: Cannot set Allotment SpatialProxy (POLYGON) with value of type: <class 'django.contrib.gis.geos.polygon.Polygon'> I check my model's definition and data type in PGadmin. full log Traceback: File "/home/user/MyProjects/forest-venv/lib/python3.5/site-packages/django/core/handlers/exception.py" in inner 35. response = get_response(request) File "/home/user/MyProjects/forest-venv/lib/python3.5/site-packages/django/core

GeoDjango distance of related model

浪尽此生 提交于 2021-02-07 19:44:48
问题 I'm trying to return a queryset with distances from a related model. models.py (simplified) class Store(models.Model): geopoint = models.PointField(srid=4326) objects = models.GeoManager() class HashTag(models.Model): tag = models.CharField(max_length=100) class Label(models.Model): hashtags = models.ManyToManyField(HashTag) store = models.ForeignKey(Store) What I need to return are the Label objects which have a certain tag/tags ordered by distance from a given point. The Labels can be found

GIS/Gdal/OSGeos Import error in django on Windows

末鹿安然 提交于 2021-02-07 12:51:48
问题 I am trying this from hours now and I couldn't get get it solved. I am using this link to setup GeoDjango on Windows. I am getting following error message and I have no clue what to do. All the environment variables are set in Windows and I am able to import with from osgeo import gdal successfully in python terminal as import gdal is deprecated. In Postgresql database I have all extensions available as required like address_standardizer , fuzzystrmatch , ogr_fdw , pgrouting , plpgsql ,

GIS/Gdal/OSGeos Import error in django on Windows

有些话、适合烂在心里 提交于 2021-02-07 12:51:16
问题 I am trying this from hours now and I couldn't get get it solved. I am using this link to setup GeoDjango on Windows. I am getting following error message and I have no clue what to do. All the environment variables are set in Windows and I am able to import with from osgeo import gdal successfully in python terminal as import gdal is deprecated. In Postgresql database I have all extensions available as required like address_standardizer , fuzzystrmatch , ogr_fdw , pgrouting , plpgsql ,

GeoDjango Distance() Annotation on Related Model

一笑奈何 提交于 2021-02-05 06:39:25
问题 I have a Profile class which is a OneToOne with Location model. Every profile has one and only location. class Location(models.Model): profile = models.OneToOne(Profile) point = PointField() In one of my views, I display a list of profiles. For example, I first find profiles with locations and then find associated profiles. ref_location = Point(0,0) # point to calculate distances from locations = Location.objects.filter(point__distance_lte=(ref_location, D(m=50 * 1000))) \ profiles = Profile

Extract the coordinates from the LineStringField

别来无恙 提交于 2021-01-29 04:48:39
问题 I've this simple model from GeoDjango for a line vector: from django.contrib.gis.db import models class LineBuffer(models.Model): geom = models.LineStringField() def __int__(self): return self.pk @property def coordinates(self): return str(self.geom.x) + ', ' + str(self.geom.y) I need to create a buffer using Turf.js; the results will be redered using MapBox. With this view I create my map: def line_mapbox_turf_buffer(request): geometry = LineBuffer.objects.all() context = { 'geometry':

GeoDjango GDALException - OGR failure

假如想象 提交于 2021-01-28 06:08:40
问题 After installing GeoDjango, I wanted to create a 'Location' object in the admin panel which uses an address and a point on a map. After submitting the form, I get an error like so... GDALException at /admin/maps/location/add/ OGR failure. I have tried looking at similar questions, like here, but none of the solutions have worked. Additionally, searching for 'unable to load PROJ.4 library' (first traceback line) didn't come with any success. Any help would be appreciated! - Let me know if I

Heroku GeoDjango issues with missing GDAL (and possibly GEOS)

谁说我不能喝 提交于 2021-01-27 10:29:11
问题 I'm working on a GeoDjango application and am using Heroku (with a Heroku-16 stack) as my platform. I am following the instructions found here, which specify the following: If your application requires geo libraries, experimental support for a handful of these libraries are available: GDAL v2.2.1 (v1.11.5 for cedar-14) Geos v3.6.2 (v3.4.2 for cedar-14) Proj v4.9.3 (v4.8.0 for cedar-14) To make these libraries available to your application, simply set the BUILD_WITH_GEO_LIBRARIES environment

Heroku GeoDjango issues with missing GDAL (and possibly GEOS)

只愿长相守 提交于 2021-01-27 10:28:40
问题 I'm working on a GeoDjango application and am using Heroku (with a Heroku-16 stack) as my platform. I am following the instructions found here, which specify the following: If your application requires geo libraries, experimental support for a handful of these libraries are available: GDAL v2.2.1 (v1.11.5 for cedar-14) Geos v3.6.2 (v3.4.2 for cedar-14) Proj v4.9.3 (v4.8.0 for cedar-14) To make these libraries available to your application, simply set the BUILD_WITH_GEO_LIBRARIES environment

Heroku GeoDjango issues with missing GDAL (and possibly GEOS)

家住魔仙堡 提交于 2021-01-27 10:26:56
问题 I'm working on a GeoDjango application and am using Heroku (with a Heroku-16 stack) as my platform. I am following the instructions found here, which specify the following: If your application requires geo libraries, experimental support for a handful of these libraries are available: GDAL v2.2.1 (v1.11.5 for cedar-14) Geos v3.6.2 (v3.4.2 for cedar-14) Proj v4.9.3 (v4.8.0 for cedar-14) To make these libraries available to your application, simply set the BUILD_WITH_GEO_LIBRARIES environment