Opened 14 years ago

Closed 12 years ago

#14186 closed New feature (wontfix)

Adding GDirections wrapper to overlays.py

Reported by: Miguel Araujo Owned by: Miguel Araujo
Component: GIS Version: dev
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

Description

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

Attachments (1)

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

Download all attachments as: .zip

Change History (11)

comment:1 by Miguel Araujo, 14 years ago

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

by Miguel Araujo, 14 years ago

Attachment: geodjango-gdirections.patch added

comment:2 by Thejaswi Puthraya, 14 years ago

Component: UncategorizedGIS

comment:3 by Miguel Araujo, 14 years ago

Cc: muchochini@… added

comment:4 by Russell Keith-Magee, 14 years ago

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 by Miguel Araujo, 14 years ago

Severity: Normal
Type: Uncategorized

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

Version 0, edited 14 years ago by Miguel Araujo (next)

comment:6 by Julien Phalip, 14 years ago

Type: UncategorizedNew feature

comment:7 by Jacob, 13 years ago

milestone: 1.3

Milestone 1.3 deleted

comment:11 by Aymeric Augustin, 13 years ago

UI/UX: unset

Change UI/UX from NULL to False.

comment:12 by Aymeric Augustin, 13 years ago

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:13 by Aymeric Augustin, 12 years ago

Resolution: wontfix
Status: newclosed

Closing per comment 5.

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