John Brennan
2010-Jul-27 17:39 UTC
[Mapstraction] custom info bubbles and google v3 clustering
Hi All! Work on project for philanthropy. Have supported Google Maps for a year now, but customers are asking for OpenStreetMaps. I know Andrew and figured I''d see if I can make Mapstraction play nice since I''m currently refactoring a lot of our code. ----------- PROBLEM ----------- I need at the very minimum Google v3 to work with clustering switch and ability to create custom HTML bubbles. Attaching a marker event to handle it on the fly would probably be the best solution. I''ve been reading through the source code and I thought of doing something like this to create custom bubbles, but it would require me to line up the HTML div myself (do I have access to the pixel location of the map marker?): var markerEventHandler = function(sEvtName, oEvtSource, oEvtArgs){ alert( ''Marker event: '' + sEvtName + '' - '' + oEvtSource.labelText + ''<br/>''); }; marker.click.addHandler(markerEventHandler); Or perhaps I could fire off the marker like this.. but this needs some tuning: var markerEventHandler = function(sEvtName, oEvtSource, oEvtArgs){ var marker = oEvtSource.toProprietary(); google.maps.event.addListener(marker, ''click'', function() { infowindow.open(oEvtSource.map, marker); }); }; marker.click.addHandler(markerEventHandler); Has anyone done this and just not committed to github yet? Am I missing something or is there a lot of googlev3 code missing? thanks! john -- John Brennan Co-Founder | OpenAction twitter.com/worldlyjohn http://openaction.org Brooklyn, NY ------- Discovering Projects. Connecting People. OpenAction is the first, truly open platform to showcase projects, exchange knowledge and empower local champions. Tell organizations that are doing good in this world today! =) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20100727/3554dd0f/attachment.htm>
Ed Freyfogle
2010-Jul-27 22:56 UTC
[Mapstraction] custom info bubbles and google v3 clustering
welcome to the project John. have a look at http://www.nestoria.co.uk/hoxton/property/buy the map is googlev3 via mxn. click on a pin to get a custom bubble. I don''t have the code in front of me right now, but there are tools you can use (yslow for example) to pretty print our javascript. In short, yes, we line up the bubble div ourselves. BTW, if you want to see the same page w/ an OSM map (via cloudmade) try http://openstreetmap.nestoria.co.uk/hoxton/property/buy I haven''t gotten bubbles working there, though in fairness I haven''t spent any time on it, I''m sure it''s doable. Let me know if this points you down the right path, otherwise I''ll try to dive deeper, but unfortunately won''t be back online until thursday ciao, Ed 2010/7/27 John Brennan <johnb at openaction.org>:> Hi All! > Work on project for philanthropy. ?Have supported Google Maps for a year > now, but customers are asking for OpenStreetMaps. ?I know Andrew and figured > I''d see if I can make Mapstraction play nice since I''m currently refactoring > a lot of our code. > > ----------- ?PROBLEM?----------- > I need at the very?minimum?Google v3 to work with clustering switch and > ability to create custom HTML bubbles. ?Attaching a marker event to handle > it on the fly would probably be the best solution. > I''ve been reading through the source code and I thought of doing something > like this to create custom bubbles, but it would require me to line up the > HTML div myself (do I have access to the pixel location of the map marker?): > > ?? ? ? ?var markerEventHandler = function(sEvtName, oEvtSource, oEvtArgs){ > alert( ''Marker event: '' + sEvtName + '' - '' + oEvtSource.labelText + > ''<br/>''); > }; > marker.click.addHandler(markerEventHandler); > > Or perhaps I could fire off the marker like this.. but this needs some > tuning: > ?? ? ? ?var markerEventHandler = function(sEvtName, oEvtSource, oEvtArgs){ > var marker = oEvtSource.toProprietary(); > google.maps.event.addListener(marker, ''click'', function() { > ?? ? ? ? ? ? ?infowindow.open(oEvtSource.map, marker); > ?? ? ? ? ? ?}); > ?? ? ? ?}; > marker.click.addHandler(markerEventHandler); > > Has anyone done this and just not committed to github yet? ?Am I missing > something or is there a lot of googlev3 code missing? > > thanks! > john > -- > John Brennan > Co-Founder | OpenAction > twitter.com/worldlyjohn > http://openaction.org > > Brooklyn, NY > ------- > Discovering Projects.? Connecting People. > OpenAction is the first, truly open platform to showcase projects, exchange > knowledge and empower local champions.? Tell organizations that are doing > good in this world today!? =) > > _______________________________________________ > Mapstraction mailing list > Mapstraction at lists.mapstraction.com > http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com > >