Home : Products : Gossamer Links : Development, Plugins and Globals :

Products: Gossamer Links: Development, Plugins and Globals: Re: [Andy] [NEW PLUGIN] GoogleMapByCat v1: Edit Log

Here is the list of edits for this post
Re: [Andy] [NEW PLUGIN] GoogleMapByCat v1
This 'quick' work around is OK if you want to use 'precise' co-ordinates for the location map on the DETAILED page, as sometimes the ZIP / postcode will only provide a general location marker.

By adding Latitude + Longitude fields to the Links properties table, which can be used for manually adding location co-ordinates. Then editing / adding some extra code to the 'Google Maps' code that goes into the detailed.html page.

This only works for the DETAILED page and will not effect / update the 'category' map, this will still use the location co-ordinates from the address fields.

NOTE: the Plugin "GoogleMap" has a tool to 'refresh' the lat / long' co-ordinates, using the link labelled "Delete a Links long/lat values" - this will then 'grab' the new data during next build.

<%-- START GOOGLE MAP STUFF --%>
<%if LongVal%>
<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2.x&key=<%API_Key%>"></script>
<style>.gmap {
margin: 0px;
padding: 0px;
}
.middleColumn {
margin: 0px;
padding: 0px;
}</style>
<div style="padding: 10px 10px 10px 10px;">
<div id="ForumMembers_mapdisplay" style="width: 500px; height: 300px" class="gmap display"></div>
</div>
<script type="text/javascript">
//<![CDATA[
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("ForumMembers_mapdisplay"));
var center = new GLatLng(<%if Latitude%><%Latitude%><%else%><%LatVal%><%endif%>,<%if Longitude%><%Longitude%><%else%><%LongVal%><%endif%>);

map.setCenter(center, 15);
map.enableContinuousZoom();
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());

m0 = new GMarker(new GLatLng(<%if Latitude%><%Latitude%><%else%><%LatVal%><%endif%>,<%if Longitude%><%Longitude%><%else%><%LongVal%><%endif%>));
GEvent.addListener(m0, "click", function() {
m0.openInfoWindowHtml("<h2><%Title%></h2>");
});
map.addOverlay(m0);

}
else {
alert("Your browser is not compatible with the mapping tool.");
}
//]]>
</script>
<%endif%>
<%-- END GOOGLE MAP STUFF --%>


As a quick work around, this appears to work
Colin Thompson

Last edited by:

colintho: Oct 28, 2008, 4:31 AM

Edit Log: