On 6/15/06, nick <[EMAIL PROTECTED]> wrote: > Hi - as a person investigating django for managing metadata that will > also have a spatial/gis component (lat/lon bounding boxes), would the > reccommended approach be to create a new field for use in my models? > Admittedly this would be specific to the postgres+postgis backend. > > I'd be looking to implement a basic a polygon datatype and at runtime > allowing for queries to search for intersections of these with > user-defined points. The postgres+postgis && operator acheives this in > simple sql: > > SELECT > ID, NAME > FROM ROADS_GEOM > WHERE > GEOM && GeomFromText('POLYGON((191232 243117,191232 243119,191234 > 243117,191232 243117))',-1);
Hey Nick, I've been using Django successfully with PostgreSQL/PostGIS for more than a year on http://www.chicagocrime.org/ . What I do is deliberately *exclude* the "GEOM" field from being defined in the model (because it doesn't yet have a Python/Django field class), and I use custom SQL statements in model methods to do the queries I want to do. Django doesn't really care if the database defines columns that aren't in the model, as long as you don't try to insert/change into that undefined field with the Django database API -- so I'm exploiting that. So, yeah, it's totally possible and easy to do. I'd be happy to post sample model code if you're interested. Adrian -- Adrian Holovaty holovaty.com | djangoproject.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---