#14186: Adding GDirections wrapper to overlays.py
---------------------------+------------------------------------------------
Reporter: maraujop | Owner: maraujop
Status: new | Milestone: 1.3
Component: Uncategorized | Version: SVN
Keywords: | Stage: Unreviewed
Has_patch: 1 |
---------------------------+------------------------------------------------
Today I needed to add support to GoogleMap GeoDjango abstraction so it
could draw directions in a map. So I coded GDirections class, modified
gmap.py to add a directions parameter and modified the template.
Directions are drawn in a path within the map, adding a directions div and
getting direction steps would be trivial with this. Take in mind only one
GDirections object is passed to the GoogleMap object, as only one route
will be drawn in the map.
You can find an example of use in the Doc strings of the class:
{{{
from django.shortcuts import render_to_response
from django.contrib.gis.maps.google.overlays import GDirections
def sample_request(request):
route = GDirections(LineString(POINT(40.44 -3.77), POINT(42.33 -3.66))
return render_to_response('mytemplate.html', {'google' :
GoogleMap(directions=route)})
}}}
You can still pass other overlays and they will get drawn in the map. Just
be careful with zoom, because GDirections will set automatically the zoom
to show the whole path.
I hope somebody finds this useful, Best regards
Miguel Araujo
--
Ticket URL: <http://code.djangoproject.com/ticket/14186>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.