geodjango

Geo Django GDAL Exception OGR Failure

拥有回忆 提交于 2020-02-16 10:42:10
问题 I'm using geo django and running on windows. I do have GDAL and OSGEOS configured in the settings. Here is my settings.py code for gdal. import os if os.name == 'nt': import platform OSGEO4W = r"C:\OSGeo4W" if '64' in platform.architecture()[0]: OSGEO4W += "64" assert os.path.isdir(OSGEO4W), "Directory does not exist: " + OSGEO4W os.environ['OSGEO4W_ROOT'] = OSGEO4W os.environ['GDAL_DATA'] = OSGEO4W + r"\share\gdal" os.environ['PROJ_LIB'] = OSGEO4W + r"\share\proj" os.environ['PATH'] =

Geo Django GDAL Exception OGR Failure

左心房为你撑大大i 提交于 2020-02-16 10:40:09
问题 I'm using geo django and running on windows. I do have GDAL and OSGEOS configured in the settings. Here is my settings.py code for gdal. import os if os.name == 'nt': import platform OSGEO4W = r"C:\OSGeo4W" if '64' in platform.architecture()[0]: OSGEO4W += "64" assert os.path.isdir(OSGEO4W), "Directory does not exist: " + OSGEO4W os.environ['OSGEO4W_ROOT'] = OSGEO4W os.environ['GDAL_DATA'] = OSGEO4W + r"\share\gdal" os.environ['PROJ_LIB'] = OSGEO4W + r"\share\proj" os.environ['PATH'] =

How do I satisfy “enforce_srid_coordinate” constraint with GeoDjango/PostGIS?

落爺英雄遲暮 提交于 2020-01-05 09:14:59
问题 I'm using GeoDjango and have a Django model with a PointField: class ArchivrItem(models.Model): ... coordinate = models.PointField(srid=4326) When I try to insert a new ArchivrItem, using latitude and longitude, I get this error: ERROR: new row for relation "archivr_archivritem" violates check constraint "enforce_srid_coordinate" I can avoid Django and get the same error in postgresql directly by trying to do this: INSERT INTO archivr_archivritem (coordinate) VALUES ('POINT(51.520667 -0

Fastest way to get nearest geometry to a point in GeoDjango

↘锁芯ラ 提交于 2020-01-05 08:09:13
问题 I've got a large number of points (~1.5 million) in the WGS84 coordinate system. The points span a large area, so I can't use a projected coordinate system. I want to find the closest point to a given pair of input coordinates. I have a working view, but it takes too long (~2.5 seconds) to execute. This is my model: from django.contrib.gis.db import models class Point(models.Model): id = models.IntegerField(primary_key=True) geom = models.PointField(srid=4326, spatial_index=True) objects =

How to calculate Frechet Distance in Django?

不羁的心 提交于 2020-01-05 06:51:21
问题 This is basically a question about running custom PostGIS functions inside the Django code. There is a number of related answers on this site, most close to my case is this one. It is suggested to use Func() or even GeoFunc() classes but there is no example for geospatial functions there. The latter ('GeoFunc') didn't even work for me throwing st_geofunc does not exist exception (Django 2.1.5). The task that I have to complete is to filter LineStrings based on their Frechet Distance to the

Geo Django mac OS X

你。 提交于 2020-01-01 19:48:31
问题 I am trying to use Geodjango on mac os, i use postgresql and I installed GEOS but i got this error : dlopen(/usr/local/lib/libgeos_c.dylib, 6): no suitable image found. Did find: /usr/local/lib/libgeos_c.dylib: mach-o, but wrong architecture Any idea? Thank you 回答1: Ok, I have my answer. My MAMP uses 32-bit Python and I compiled my library for 64-bit Python. So I recompiled it for 32-bit Python. To do this, I used these commands in my library folder: export CFLAGS=-m32 export CXXFLAGS=-m32 .

Geo Django mac OS X

余生长醉 提交于 2020-01-01 19:48:11
问题 I am trying to use Geodjango on mac os, i use postgresql and I installed GEOS but i got this error : dlopen(/usr/local/lib/libgeos_c.dylib, 6): no suitable image found. Did find: /usr/local/lib/libgeos_c.dylib: mach-o, but wrong architecture Any idea? Thank you 回答1: Ok, I have my answer. My MAMP uses 32-bit Python and I compiled my library for 64-bit Python. So I recompiled it for 32-bit Python. To do this, I used these commands in my library folder: export CFLAGS=-m32 export CXXFLAGS=-m32 .

Adding custom Feature attributes to ESRI Shapefile with Python

孤街醉人 提交于 2020-01-01 05:16:11
问题 I am seeking a way to take an existing ESRI Shapefile that has a Feature set of 200 countries. Each country Feature has an attribute of "NAME." My objective is to create a Python script that adds an arbitrary (for now) additional attribute, say, "POPULATION". Of course I have the OSGeo and GeoDjango modules installed. I'm as far as: from osgeo import ogr infile = ogr.Open('sample.shp', 1) #'sample.shp' is a pre-existing ESRI shapefile described above inlyr = infile.GetLayerByIndex(0) Am I

GeoDjango, difference between dwithin and distance_lt?

霸气de小男生 提交于 2019-12-31 19:30:04
问题 Using geoDjango, what is the difference between myObj.objects.filter(point__dwithin(...etc.)) and myObj.objects.filter(point__distance_lt(...etc.)) ? Are they the same thing, or are they doing subtly different things? 回答1: Ok, I did some research but I don't know if the results are of any use ;) I looked at the unit tests that they use to test the DB queries but they don't give real hints (to me). I tried to compare the generated SQL: I have already a geo application using a PostgreSQL

GeoDjango, difference between dwithin and distance_lt?

ぐ巨炮叔叔 提交于 2019-12-31 19:28:17
问题 Using geoDjango, what is the difference between myObj.objects.filter(point__dwithin(...etc.)) and myObj.objects.filter(point__distance_lt(...etc.)) ? Are they the same thing, or are they doing subtly different things? 回答1: Ok, I did some research but I don't know if the results are of any use ;) I looked at the unit tests that they use to test the DB queries but they don't give real hints (to me). I tried to compare the generated SQL: I have already a geo application using a PostgreSQL