Questions tagged [geodjango]

GeoDjango intends to be a world-class geographic Web framework. Its goal is to make it as easy as possible to build GIS Web applications and harness the power of spatially enabled data.

GeoDjango intends to be a world-class geographic Web framework. Its goal is to make it as easy as possible to build GIS Web applications and harness the power of spatially enabled data.

http://geodjango.org/

1020 questions
94
votes
3 answers

Which Model Field to use in Django to store longitude and latitude values?

I want to store my users location using longitude and latitude, at the moment this comes from Google Maps, but I will be using GeoDango and some point to work out distances between to points also. However, my first confusion is which field in…
Prometheus
  • 32,405
  • 54
  • 166
  • 302
80
votes
10 answers

Getting 'DatabaseOperations' object has no attribute 'geo_db_type' error when doing a syncdb

I'm attempting to run heroku run python manage.py syncdb on my GeoDjango app on Heroku, but I get the following error: AttributeError: 'DatabaseOperations' object has no attribute 'geo_db_type' All of my research has yielded the same solution: make…
Gady
  • 4,935
  • 8
  • 38
  • 48
74
votes
9 answers

GeoDjango GEOSException error

Trying to install a GeoDjango on my machine. I'm really new to Python and being brought into a project that has been a very tricky install for the other team members. I installed Python 2.7 and GEOS using brew, and running PSQL 9.2.4 but keep…
armynante
  • 829
  • 1
  • 8
  • 11
41
votes
2 answers

Django: templatedoesnotexist gis/admin/openlayers.html

Here is the error: templatedoesnotexist gis/admin/openlayers.html I get the following error when I run my django admin. How can I fix? I have django installed.
user816604
39
votes
6 answers

How do you know what SRID to use for a shp file?

I am trying to put a SHP file into my PostGIS database, the the data is just a little off. I think this is because I am using the wrong SRID. The contents of the PRJ file are as…
priestc
  • 33,060
  • 24
  • 83
  • 117
32
votes
8 answers

Django sort by distance

I have the following model: class Vacancy(models.Model): lat = models.FloatField('Latitude', blank=True) lng = models.FloatField('Longitude', blank=True) How should I make a query to sort by distance (distance is infinity)? Working on…
Rukomoynikov
  • 1,385
  • 2
  • 12
  • 15
29
votes
11 answers

GeoDjango on Windows: "Could not find the GDAL library" / "OSError: [WinError 126] The specified module could not be found"

I've been trying to setup my windows computer such that I can have a local postgreSQL with PostGIS extension. With this installed I hope to be able to create a project with geodjango locally before putting it in the cloud. I have been working with…
Yorian
  • 2,002
  • 5
  • 34
  • 60
28
votes
5 answers

How to merge 2 Django QuerySets in one and make a SELECT DISTINCT

models.py class SinglePoint(models.Model): attributes = models.TextField(blank=True) name = models.CharField(max_length=100) geom = models.PointField() #Kartenposition objects = models.GeoManager() class Connection(models.Model): …
None
27
votes
5 answers

Postgis / Geodjango: Cannot determine PostGIS version for database

I'm attempting to launch a GeoDjango app. I've installed Postgres & PostGIS using brew on Lion. I created a database using template_postgis: createdb -T template_postgis test. When I run python manage.py syncdb, I get the following…
Matt Hampel
  • 5,088
  • 12
  • 52
  • 78
24
votes
2 answers

How to connect postgis to django in docker

Hi I would like to know how to connect POSTGIS to django using Docker. I am having an error could not open extension control file "/usr/share/postgresql/10/extension/postgis.control": No such file or directory output root@localhost:~/try-geodjango#…
Papouche Guinslyzinho
  • 5,277
  • 14
  • 58
  • 101
22
votes
1 answer

Error Saving geodjango PointField

I have a geo model with a PointField property. Everything works perfectly locally, but when I try to save an instance on the server, I get the following error: django.db.utils.DatabaseError: invalid byte sequence for encoding "UTF8": 0x00 I dug…
matthewwithanm
  • 3,733
  • 2
  • 21
  • 27
22
votes
1 answer

How to make/use a custom database function in Django

Prologue: This is a question arising often in SO: Equivalent of PostGIS ST_MakeValid in Django GEOS Geodjango: How to Buffer From Point Get random point from django PolygonField Django custom for complex Func (sql function) and can be applied to…
John Moutafis
  • 22,254
  • 11
  • 68
  • 112
20
votes
5 answers

How to force Django models to be released from memory

I want to use a management command to run a one-time analysis of the buildings in Massachusetts. I have reduced the offending code to an 8 line snippet that demonstrates the problem I encounter. The comments just explain why I want to do this at…
19
votes
5 answers

Change LC_CTYPE for PostgreSQL and PostGIS use

So I'm walking through the GeoDjango tutorial and I'm stuck on this error message: postgres@lucid32:~$ createdb -E UTF8 template_postgis createdb: database creation failed: ERROR: encoding UTF8 does not match locale en_US DETAIL: The chosen…
a.m.
  • 2,108
  • 5
  • 24
  • 29
19
votes
4 answers

How do I convert kilometres to degrees in Geodjango/GEOS?

I'm using the "buffer" method from the GEOS API to create a circle based on a point and a radius in GeoDjango, according to this answer: GeoDjango: How to create a circle based on point and radius As one commenter noted, you'll have to convert the…
Jonas
  • 970
  • 1
  • 8
  • 17
1
2 3
67 68