geodjango

How to display data using openlayers with OpenStreetMap in geodjango?

I've got geodjango running using openlayers and OpenStreetMaps with the admin app. Now I want to write some views to display the data. Basically, I just want to add a list of points (seen in the admin) to the map. Geodjango appears to use a special openlayers.js file to do it's magic in the admin. Is there a good way to interface with...

3 dimension GiS data with django and postgis

I could use a third dimension in my current project, which strongly involves google-maps and django. How do I deal with this? class Waypoint(models.Model): latlng = models.PointField() >>> p = Point( 5, 10, 20) <Point object at Ox...> >>> p.kml '<Point><coordinates>5.0,10.0,20.0</coordinates></Point>' >>> w = Waypoint.objects.all(...

Should I use GeoDjango for mapping a floor plan?

I want to create a floor plan map of an interior space that has clickable regions. My first thought was to investigate GeoDjango since its the mapping app for Django. But considering the dependencies, the learning curve and overall complexity, I'm concerned that I may be trying to swat a fly with a bazooka. Should I use GeoDjango for ...

retrieve bounding box of a geodjango multipolygon object

How can I get the bounding box of a MultiPolygon object in geodjango? Can't find anything in the API http://geodjango.org/docs/geos.html ... ...

Does anyone know of any good open source Geodjango apps to dig through?

I'm looking to build a small GIS in my spare time and have been digging into Geodjango. I've been trying to find examples of open source Geodjango projects to look through, but I have had little luck, so here I am. I've been through most of the tutorials I could find, but they all seem to stop at the same point and I'm curious to loo...

Howto merge 2 Django QuerySets in one and make a SELECT DISTINCT

Hi, thats my code: ##### 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): name = models.CharField(max_length=100) #points = m...

GeoDjango - How to present points on a map?

Simple 'Example' - have millions of points within specific geography. Have everything loaded and able to see in GeoAdmin the whole 9 yards. So. How do I show all points on a map - and base it on zoom level? Are there any simple examples out there? ...

Using UTM with geodjango

I'm looking into using the UTM coordinate system with geodjango. And I can't figure out how to get the data in properly. I've been browsing the documentation and it seems that the "GEOSGeometry(geo_input, srid=None)" or "OGRGeometry" could be used with an EWKT, but I can't figure out how to format the data. It looks like the UTM SRID i...

GeoDjango Point object giving different wkt than was initialized with. What am I doing wrong?

Can someone please explain why the wkt (well-known text) of a point object in geodjango would be returning what seems to be different coordinates than the object was initialized with? I've got to imagine it's something I'm doing wrong, and not geos. The wkt should look like: "POINT (-122.432534 37.764021)" but instead it looks like: 'POI...

Adding a polygon directly in Geodjango/PostGIS

I'm messing around with Geodjango, and I just want to add a simple polygon field to a database and then run a point-in-polygon on it to to make sure everything is working okay. Here's my code in views.py: #adding a polygon pe = PolygonExample.objects.create(name="uk_polygon", poly="POLYGON((58.768200159239576, -12.12890625, 58....

Furthest distance between any two points with GeoDjango

I have a collection of Point objects. I want to find the furthest distance between any two points. Imagine a circle enclosing all of these points. I want to know the diameter of that circle. How can I do this in GeoDjango? edit: this is what I have so far: >>> r=Route.objects.get(pk=1) >>> a=Airport.objects.filter(routebase__route=r) ...

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 follows: GEOGCS["GCS_North_American_1983", DATUM["D_North_American_1983", SPHEROID["GRS_1980",6378137.0,298.257222101]], PRIMEM["Greenwich",0.0], UNIT["Degree",...

Problem getting started with GeoDjango

As soon as I add "from django.contrib.gis.db import models" instead of "from django.db import models", Django stops recognizing the app and gives this error: Error: App with label location could not be found. Are you sure your INSTALLED_APPS setting is correct? The error goes away as soon as I comment out "from django.contrib.gis.db i...

Getting GeoDjango + Spatialite running on Windows

I continue to have problems setting up a GeoDjango installation that uses Spatialite as a backend on a Windows machine. I used the GeoDjango installer and downloaded the precompiled libraries from http://www.gaia-gis.it/spatialite/binaries.html, and dumped them into my geodjango/bin directory. I upgraded my pysqlite2 installation to th...

GeoDjango distance search

I want to use GeoDjango to do basic location searches. Specifically I want to give the search function a ZIP code/city/county and find all the ZIP codes/cities/counties within 5mi, 10mi, 20mi, etc. I found the following paragraph in the documentation: Using a geographic coordinate system may introduce complications for the develope...

Using Python simplejson to return pregenerated json

I have a GeoDjango model object that I want't to serialize to json. I do this in my view: lat = float(request.GET.get('lat')) lng = float(request.GET.get('lng')) a = Authority.objects.get(area__contains=Point(lng, lat)) if a: return HttpResponse(simplejson.dumps({'name': a.name, 'area': a.a...

django, location based searches

Excuse my ignorance, I am not even sure of the correct term for this. What I want to do is search by city and state or zip code in my django application and also include results within certain distances of the location (25, 50, 75 miles). I am guessing you probably need to convert the city and state or zip code to lat and long and then...

geodjango - search by city, state or zip code

How can I use geodjango to search by city and state or zip code in my django application? I am very new to geodjango and just trying to wrap my head around what would be involved in this. Also, does anyone know of an app that already implements this functionality? ...

GeoDjango, difference between dwithin and distance_lt?

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? ...

Getting "InternalError: no such savepoint" with PostGIS in Django even when using TransactionTestCase

Just added geoDjango and moved the database over to PostGIS. I have a bunch of Unit tests that pass individually, but when run together I get an IntenalError the database being grumpy between the tests. The model that's getting used in these tests is a django.contrib.gis.db model. The tests even inherit from TransactionTestCase instead o...