geodjango

display MultiPolygonField data on Geodjango/OpenLayers

Hi all, I'm a Geodjango novice and would like to get some help on the following: I have a MultiPolygonField field, for a GeoDjango application, and would like to display it on my view as cool as it gets displayed on django admin Say for example I have def index(request): "Index,main view" border = WorldBorders.objects.get(na...

How hard is it to modify the Django Models?

I am doing geolocation, and Django does not have a PointField. So, I am forced to writing in RAW SQL. GeoDjango, the Django library, does not support the following query for MYSQL databases (can someone verify that for me?) cursor.execute("SELECT id FROM l_tag WHERE\ (GLength(LineStringFromWKB(LineString(asbinary(utm),a...

Clarification regarding geodjango

I am new to geodjango. I am using a geodjango model for my application. in one of my geodjango model class I am using a location field of type PointField() . I want to store the location for each entry into that model class Table. Could anyone please help me how to insert values into that field, Or could anyone please suggest a referenc...

Break up a polygon into smaller ones

Hi, I am working with geodjango and I want to breakup a 2D Rectangular Polygon into smaller ones. My input is a big rectangle and I want to subdivide it in smaller rectangles. The sum of the smaller rectangles must be the original rectangle. All subrectangles should be equal size. How can I do that? Thank you. ...

Is this feasbile with GIS?

I'm just getting myself to familiarize with GIS but i like to know before hand if the following is feasible with current GIS apps/tools... I get the point for an address by geocoding. Easy part. Now if the point falls within a boundary (may be a city/county/state) then i need to get the data (any id/flag) associated with the boundary. ...

Geodjango Tutorial - links in admin view aren't working

I'm new to Geodjango, and was really enjoying the tutorial at djangoproject.org. But when I got to the "Google / Geographic Admin" section I was unable to display the WorldBorders entries on a map. I can pull up http://localhost:800/admin in my browser, and I see something like this: DJANGO ADMINSTRATION SITE ADMINISTRATION Auth Group...

GeoDjango: is there an out-of-the-box way to generate clusters of points?

Hi, I'm trying to compute clusters on a set of points in Python, using GeoDjango. The problem: Given a set of points, output a set of clusters of those points. (i'm fine specifying # of clusters/cluster size/distance in advance to simplify) There are a few solutions on the web to do clustering, so it's a well known problem. I thought ...

standard geographic tilizing/binning method?

I'm trying to learn and understand more about mapping and displaying values on a map. (GIS) At the moment I'M looking to take some values and apply those values to a tile or bin on a map. Ideally I'd like the tile sizes to be uniform, like 100 meters, 500 meters, etc. Is there a standard method for creating uniform tile sizes? Or Are ...

How to create a HTML world map with GeoDjango ?

The GeoDjango tutorial explains how to insert world borders into a spatial database. I would like to create a world Map in HTML with these data, with both map and area tags. Something like that. I just don't know how to retrieve the coordinates for each country (required for the area's coords attribute). from world.models import World...

Split or save a subset of a ESRI Shape SHP file to a new file?

I'm working with shape files in GeoDjango. Right now I'm trying to write a test for code that loads in a shape file and saves it to a database. The shape file currently has a feature count of 64,118. I'd like to reduce this to a handful so the test can quickly load it and confirm everything is right. Since shape files aren't in a tex...

Rendering spatial data of GeoQuerySet in a custom view on GeoDjango

Hello. I have just started my first project on GeoDjango. As a matter of fact, with GeoDjango powered Admin application we all have a great possibility to view/edit spatial data, associated with the current object. The problem is that after the objects having been populated I need to render several objects' associated geometry at once...

Django & Postgis : Distance lookup using ST_Distance_sphere

In Django documentation, I read this (http://docs.djangoproject.com/en/dev/ref/contrib/gis/geoquerysets/#id7): On every distance lookup but dwithin, an optional third element, 'spheroid', may be included to tell GeoDjango to use the more accurate spheroid distance calculation functions on fields with a geodetic coordinate system (e.g...

making a call to add_postgis_srs before GeoDjango model tables get created

Here is my model definition for a model in a GeoDjango app (with a PostGIS 8.4 database) meant to represent a Chicago neighborhood boundary: class Neighborhoods(models.Model): objectid = models.IntegerField() pri_neigh_field = models.CharField(max_length=3) pri_neigh = models.CharField(max_length=50) sec_neigh_field = mo...

geoDjango - coercing to Unicode: need string or buffer, LineString found

I'm running a Django installation with geoDjango, and have created a model like this: #models.py from django.contrib.gis.db import models class Route(models.Model): name = models.CharField(max_length=100) path = models.LineStringField(srid=4326) objects = models.GeoManager() def __unicode__(self): return str(s...

Geodjango: importing data from OSGB_1936, displaying in WGS84?

Hi everyone I have some polygon data saved in a PostGIS database with projection SRID 27700. geom = models.MultiPolygonField(srid=27700) I want to display the shapes on OpenStreetMap, i.e. with SRID 900913 (I think?). So, two questions: How do I change the code below to output with the right SRID for OpenStreetMap? How can I cha...

GeoDjango setup: ERROR: could not access file "$libdir/postgis-1.5": No such file or directory

Update: thought I'd solved it, but I hadn't... please see below. I'm installing GeoDjango on Mac OSX. I've followed the Mac install instructions, which all went smoothly, and am now creating a spatial database template for PostGIS. However, when I try to load the PostGIS SQL routines, I get ERROR: could not access file "$libdir/post...

GeoDjango: editing the standard PostGIS template to include OSGB36

I've just installed GeoDjango (yay) and now I'm trying to follow these instructions to set up an existing GeoDjango project, which needs OSGB36: After you've installed and got a PostGIS template, log in to it and update the proj4text column of SRID 27700 to include +datum=OSGB36, and update SRID 29902 to have +datum=ire65. However. I...

How to efficiently query large multi-polygons with PostGIS

I am working with radio maps that seem to be too fragmented to query efficiently. The response time is 20-40 seconds when I ask if a single point is within the multipolygon (I have tested "within"/"contains"/"overlaps"). I use PostGIS, with GeoDjango to abstract the queries. The multi-polygon column has a GiST index, and I have tried VA...

GeoDjango with Ushahidi

Hi, I successfully installed Ushahidi and Swiftrever on My server. My ushahidi instance in getting feed from swiftrever. This is fine. Now I want to use GeoDjango with Ushahidi to display and create spatial data. can I do this? If yes then how can i do this? ...

How to import Lat/Long data into PostgreSQL

Hello all, PostgreSQL / Django / newbie here. I've got a bunch of JSON data with venues and lat/long information, and I'm looking to import it into my database. So far I've fenagled a script to format my JSON into SQL statements, so I can import them with a slew of INSERT statements. But my 'location' field (a PointField) is giving me...