Re: GeoDjango: Completely Overwhelmed
> This is precisely the kind of pointer I was looking for. I've read the > documentation about a PointField, but wasn't sure what the application > was or how it works with the rest. Here's a silly question: I can > mixin theseGeoDjangofield types with the base field types from > Django, right? So, my model could have DateTimeField, PointField, > CharField etc.? > Most definitely. GeoDjango would honestly suck if you couldn't use Django's other fields in the same model. > This is in the docs, I'm sure, but is that GeoQ subclassed from the > "normal" Q object so that it has all the properties of Q combined with > GeoQ? > Yes, `GeoQ` is subclassed from `Q` -- basically it is overridden to use `GeoQuerySet` instead of `QuerySet` so that the OR'ing and AND'ing of conditionals will work with geometry fields. When queryset- refactor is merged to trunk, `GeoQ` will no longer be required (but will still be around for backward-compatibility). > Thanks so much for your response. This is great info for anyone > starting out. I certainly appreciate the specific pointers into the > docs as well. It really helps to have a subset of this stuff to start > to get familiar with. > Yes, I agree -- kudos to Nathaniel for providing a robust and informative response to your original inquiry. Best Regards, -Justin --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: GeoDjango: Completely Overwhelmed
On Tue, Apr 15, 2008 at 2:03 AM, Nathaniel Whiteinge <[EMAIL PROTECTED]> wrote: > > I'm really new to GeoDjango myself, and I agree that jumping right in > is a bit of a shock. Hopefully someone more knowledgeable will also > pipe-up, but I think I can start you off in the right direction. > > > On Apr 14, 9:43 pm, Alex Ezell <[EMAIL PROTECTED]> wrote: > > The system would then show them trips which have start, end, or both > > points in common with the locations they have entered in the search. > > "In common" being defined as within a radius of say 100 miles or so. > > If I understand your question correctly, you're only interested in the > start and end points and not the points along that line between the > two. Exactly. > So define a regular model with a ``PointField`` [1] to hold the > lat/long for a location and make sure to use a ``GeoManager`` [2] for > that model. This is precisely the kind of pointer I was looking for. I've read the documentation about a PointField, but wasn't sure what the application was or how it works with the rest. Here's a silly question: I can mixin these GeoDjango field types with the base field types from Django, right? So, my model could have DateTimeField, PointField, CharField etc.? > I've been using GeoPy [3] to obtain lat/long from > addresses and zipcodes. Yep, already using GeoPy for geocoding. > If you need to do complex lookups that you > would normally use a ``Q`` object for, make sure to use a ``GeoQ`` > object [4] instead. This is in the docs, I'm sure, but is that GeoQ subclassed from the "normal" Q object so that it has all the properties of Q combined with GeoQ? > Once you've done that and have a few items in your database you can > query proximity pretty easily [5]. You can search for other points in > the database that are within a certain radius using a regular queryset > filter like > ``yourmodel.objects.filter(point__distance_lte=(STARTINGPOINT, > D(mi=100))``. If you want to return the distance between your starting > point and a bunch of objects use the ``distance()`` manager method > [6]. Also, I've found the built-in Distance measure functions [7] > really helpful for doing conversions. This looks like it will be really great. Just to run these filters instead of the horribly nasty SQL I have right now. It will also make it easy to add other columns from my > So I just mentioned three completely different parts of GeoDjango all > named "distance", hopefully I didn't confuse you even more! :-P Thanks so much for your response. This is great info for anyone starting out. I certainly appreciate the specific pointers into the docs as well. It really helps to have a subset of this stuff to start to get familiar with. Thanks again, Alex --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: GeoDjango: Completely Overwhelmed
I'm really new to GeoDjango myself, and I agree that jumping right in is a bit of a shock. Hopefully someone more knowledgeable will also pipe-up, but I think I can start you off in the right direction. On Apr 14, 9:43 pm, Alex Ezell <[EMAIL PROTECTED]> wrote: > The system would then show them trips which have start, end, or both > points in common with the locations they have entered in the search. > "In common" being defined as within a radius of say 100 miles or so. If I understand your question correctly, you're only interested in the start and end points and not the points along that line between the two. So define a regular model with a ``PointField`` [1] to hold the lat/long for a location and make sure to use a ``GeoManager`` [2] for that model. I've been using GeoPy [3] to obtain lat/long from addresses and zipcodes. If you need to do complex lookups that you would normally use a ``Q`` object for, make sure to use a ``GeoQ`` object [4] instead. Once you've done that and have a few items in your database you can query proximity pretty easily [5]. You can search for other points in the database that are within a certain radius using a regular queryset filter like ``yourmodel.objects.filter(point__distance_lte=(STARTINGPOINT, D(mi=100))``. If you want to return the distance between your starting point and a bunch of objects use the ``distance()`` manager method [6]. Also, I've found the built-in Distance measure functions [7] really helpful for doing conversions. .. [1] http://code.djangoproject.com/wiki/GeoDjangoModelAPI#FieldTypes .. [2] http://code.djangoproject.com/wiki/GeoDjangoModelAPI#GeoManager .. [3] http://exogen.case.edu/projects/geopy/ .. [4] from django.contrib.gis.db.models import GeoQ .. [5] http://code.djangoproject.com/wiki/GeoDjangoDatabaseAPI#DistanceLookups .. [6] http://code.djangoproject.com/wiki/GeoDjangoDatabaseAPI#distance .. [7] http://code.djangoproject.com/wiki/GeoDjangoExtras#Measure So I just mentioned three completely different parts of GeoDjango all named "distance", hopefully I didn't confuse you even more! :-P Good luck. - whiteinge --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
GeoDjango: Completely Overwhelmed
I talked with a couple of folks at PyCon about using GeoDjango for my app. I am working on getting all the pieces installed, but frankly, I am completely overwhelmed by all the terminology. My use case is this: My app creates a trip which as a lat/lng pair as a starting point and a lat/lng pair as an ending point. What I would like to do is let a user into a location in for the start, end, or both. The system would then show them trips which have start, end, or both points in common with the locations they have entered in the search. "In common" being defined as within a radius of say 100 miles or so. I don't need great precision with the radius or search, so anything within a mile or so of precision is more than enough. So, with that in mind, I have two questions: 1) Can GeoDjango help me with this? 2) What part of GeoDjango should I look at first to try to accomplish this? I guess I should mention that I am not new to Django or Python, but GIS stuff is foreign to me for now. Thanks! Alex Ezell --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---