Opened 9 years ago

Closed 7 years ago

#14186 closed New feature (wontfix)

Adding GDirections wrapper to

Reported by: Miguel Araujo Owned by: Miguel Araujo
Component: GIS Version: master
Severity: Normal Keywords:
Cc: muchochini@… Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Today I needed to add support to GoogleMap GeoDjango abstraction so it could draw directions in a map. So I coded GDirections class, modified 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 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

Attachments (1)

geodjango-gdirections.patch (5.1 KB) - added by Miguel Araujo 9 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 9 years ago by Miguel Araujo

I'm not sure why but the patch diff is not showing correctly in the Trac interface, sorry.

Changed 9 years ago by Miguel Araujo

Attachment: geodjango-gdirections.patch added

comment:2 Changed 9 years ago by Thejaswi Puthraya

Component: UncategorizedGIS

comment:3 Changed 9 years ago by Miguel Araujo

Cc: muchochini@… added

comment:4 Changed 9 years ago by Russell Keith-Magee

Triage Stage: UnreviewedDesign decision needed

This seems to me like something that should be handled as an external extension, rather than a builtin feature -- but I'll defer to anyone with better GeoDjango experience.

comment:5 Changed 8 years ago by Miguel Araujo

Severity: Normal
Type: Uncategorized

As GeoDjango is moving or has moved to the new Google's API v3. This is probably not necessary, as GDirections objects don't exist anymore and directions handling is done completely different.

Last edited 8 years ago by Miguel Araujo (previous) (diff)

comment:6 Changed 8 years ago by Julien Phalip

Type: UncategorizedNew feature

comment:7 Changed 8 years ago by Jacob

milestone: 1.3

Milestone 1.3 deleted

comment:11 Changed 8 years ago by Aymeric Augustin

UI/UX: unset

Change UI/UX from NULL to False.

comment:12 Changed 8 years ago by Aymeric Augustin

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:13 Changed 7 years ago by Aymeric Augustin

Resolution: wontfix
Status: newclosed

Closing per comment 5.

Note: See TracTickets for help on using tickets.
Back to Top