On Thu, May 31, 2012, DF <donfernandez@gmail.com> wrote:
>Any insight on how to properly loop through items in a stored Django object
>with lat, lon info and place these on a Google Map using the API would be
>very appreciated.
I do it like this:
<https://github.com/evildmp/Arkestra/blob/master/contacts_and_people/templates/contacts_and_people/place_map.html>
The view for that template is:
<https://github.com/evildmp/Arkestra/blob/master/contacts_and_people/views.py#L234>
It provides the template with the place; the place ("Building" in the models, before I realised I needed to be concerned with places that were not actual buildings) will belong to a Site. Each Site can have one or more Buildings (i.e. places), each of which might have a map.
The Site.maps property in:
<https://github.com/evildmp/Arkestra/blob/master/contacts_and_people/models.py#L36>
contains a list of Buildings that should have a map for each Site.
The template loops over all those buildings to produce the map, right here:
<https://github.com/evildmp/Arkestra/blob/master/contacts_and_people/templates/contacts_and_people/place_map.html#L45>
Results look for example like:
<http://www.aikidocardiff.com/place/talybont-sports-centre/map/>
or
<http://medicine.cf.ac.uk/place/heath-park-henry-wellcome-building/map/>.
However many items are on the map, it will scale to fit them in its bounds.
Let me know here or on irc://irc.freenode.net/arkestra if you need more information.
Daniele
--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment