Brian, I can get data on the maps with no problem. It is just making it change when the user selects something. If you are trying to get data on a map, I have a handy way for you to do it. This is only for your template. You will have to find a way to geocode everything ahead of time. GeoDjango can do this or something like GeoPy can also. There are also snippets on Django snippets that have different ways doing it. Sorry if you already know how to do this and I just misunderstood. This worked for me because I already had the lat and long for what I was doing.
# In your template do this. The gmap will load in the div with the id of map. # You can style the div to be different sizes. You can also get a smaller map # control from google. <head> <script src="http://maps.google.com/maps? file=api&v=2&key=GOOGLE KEY GOES HERE!" </head> <body onunload="GUnload()"> <div id="map"> <script type="text/javascript"> //<![CDATA[ // A function to create the marker and set up the event window // Dont try to unroll this function. It has to be here for the function closure // Each instance of the function preserves the contends of a different instance // of the "marker" and "html" variables which will be needed later when the event triggers. function createMarker(point,html) { var marker = new GMarker(point); GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); return marker; } // Display the map, with some controls and set the initial location var map = new GMap2(document.getElementById("map")); map.addControl(new GLargeMapControl()); map.addControl(new GMapTypeControl()); // Starting position of map and starting zoom level map.setCenter(new GLatLng (26.979910721880167,-82.16880798339844),11); // Set up markers with info windows {% for model in object_list %} var point = new GLatLng({{ model.latitude }}, {{ model.longitude }}); var marker = createMarker(point,'') map.addOverlay(marker); {% endfor %} //]]> </script> </div> </body> On Feb 4, 11:20 pm, Brian Neal <bgn...@gmail.com> wrote: > Hi - > > I'm working on a very similar problem (displaying data on a Google > map). I haven't totally implemented this yet, but my way forward is to > use AJAX to request the map data from my Django application, which > will serve it as JSON (by serializing it). You then "deserialize" it > in the Javascript code, turning it into a Javascript datastructure on > the client side. If you are using jQuery for example, jQuery will > deserialize it for you. If you are writing the Javascript by hand, you > deserialize it by doing an "eval" on the received data. > > BN > > On Feb 4, 10:09 pm, issya <floridali...@gmail.com> wrote: > > > Thanks for the reply. I was aware of that but I guess I don't > > understand how to go about using it. I do understand that I can > > serialize a queryset. But I cannot just go and use the serialized data > > as template context. From the options I've seen, it looks like if I > > did something like that I would have to process everything with the > > javascript including iterating through the data and making an html > > layout. I may be confused though, little sleep and a lack of knowledge > > will do that. > > > I was just trying to check to see if you could maybe deserialize it > > with a custom template tag or some other easy thing. > > > On Feb 4, 10:45 pm, Russell Keith-Magee <freakboy3...@gmail.com> > > wrote: > > > > On Thu, Feb 5, 2009 at 8:35 AM,issya<floridali...@gmail.com> wrote: > > > > > My ideal situation would be to initially load the data through ajax > > > > and update through ajax. But I cannot find an easy way to do this. If > > > > I searialize the data, I don't see an easy way to deserialize it. > > > > Are you aware of the following: > > > >http://docs.djangoproject.com/en/dev/topics/serialization/ > > > > ? > > > > Yours, > > > Russ Magee %-) --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---