I'm tring to do a Google Map with multiple markers on. The coordinates is stored in child nodes. I have actually made it work, but it seems very ineffective... can you help me improve it?
My "old" code is:
function initialize() { <xsl:for-each select="$currentPage/* [@isDoc and umbracoNaviHide != '1' and stayGoogleMaps != '']"> var <xsl:value-of select="umbraco.library:TruncateString(@nodeName, '3', position())"/> = new google.maps.LatLng(<xsl:value-of select="stayGoogleMaps"/>); </xsl:for-each> var LatLng = new google.maps.LatLng(<xsl:value-of select="$currentPage/destinationMaps"/>); var myOptions = { zoom: 12, mapTypeControl: true, mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.DROPDOWN_MENU }, center: LatLng, navigationControl: true, mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); <xsl:for-each select="$currentPage/* [@isDoc and umbracoNaviHide != '1' and stayGoogleMaps != '']"> var marker = new google.maps.Marker({ position: <xsl:value-of select="umbraco.library:TruncateString(@nodeName, '3', position())"/>, map: map, title: "<xsl:value-of select="@nodeName"/>" }); </xsl:for-each> }
All the TruncateString's is to make the markers unique - but I don't know much about the Google Maps API so if someone has experience with that, it is also welcome :-)
Could you be a bit more specific about your need? In your post you write that you need to have multiple markers. Isn't that what Tim's package is giving you? :-)
why not make use of tims excellent control its .net and works? I have in the past done it with xslt and javascript but its too much monkeying around just cleaner to use Tims control which is a nice wrapper around .net google library
Seeking a clever way to do Google Maps
Hi
I'm tring to do a Google Map with multiple markers on. The coordinates is stored in child nodes. I have actually made it work, but it seems very ineffective... can you help me improve it?
My "old" code is:
All the TruncateString's is to make the markers unique - but I don't know much about the Google Maps API so if someone has experience with that, it is also welcome :-)
Thank you! (I use Umbraco 4.5.2)
there is a datatype to add gecodes http://our.umbraco.org/projects/backoffice-extensions/google-maps-datatype to a document see also Tim has done a google map package see http://our.umbraco.org/projects/backoffice-extensions/locator-package
Regards
Ismail
I have tried those, but they don't really fill out my need and wishes. So if anyone has a suggestion for a solution I'm listening!
Could you be a bit more specific about your need? In your post you write that you need to have multiple markers. Isn't that what Tim's package is giving you? :-)
/Jan
Well, yes - but I think I have solved it myself.
My xslt now looks like this:
It is much like what i posted yesterday, but more clean.
What I ask about now is: This code seems to me to be a bit ineffective. Is there a way to optimize it? E.g. fewer lookups... but how?!?
Thanks for your suggestions so far!
why not make use of tims excellent control its .net and works? I have in the past done it with xslt and javascript but its too much monkeying around just cleaner to use Tims control which is a nice wrapper around .net google library
Regards
Ismail
Thanks for your advises. :)
is working on a reply...