You are not logged in.
Pages: 1
I am using rss_google_map to display Google Maps in my articles.
I like this plugin a lot, but it uses Google Maps Javascript API v2, and that will be faced out in May, 2013.
I have looked at the Google Map plugins at textpattern.org, but there is no replacement for rss_google_map (pro_googlemapv3 is for a single map on a site, I understand).
Do you have any suggestions on what I can do to keep Google Maps on my site working?
• Photojournalist.jp – News and photos (100% txp)
• JapaneseStreets.com – Japanese street fashion (mostly txp)
• Old Photos of Japan – Japan between 1860 and 1940 (100% txp)
• MeijiShowa – Stock photos of Japan between 1860 and 1940 (100% txp)
Offline
Best bet for public side is to build your map from scratch using the google api or a jquery google maps plugin.
Here is an example using coordinates stored in your articles custom fields.
Offline
MattD wrote:
Best bet for public side is to build your map from scratch using the google api or a jquery google maps plugin.
Here is an example using coordinates stored in your articles custom fields.
Thanks, Matt.
I had actually looked at the forum thread for msd_google_map. I thought you wrote that you hadn’t had the time yet to upgrade this plugin to Google Maps Javascript API v3?
• Photojournalist.jp – News and photos (100% txp)
• JapaneseStreets.com – Japanese street fashion (mostly txp)
• Old Photos of Japan – Japan between 1860 and 1940 (100% txp)
• MeijiShowa – Stock photos of Japan between 1860 and 1940 (100% txp)
Offline
msd_google_map is an admin side plugin that helps add coordinates to articles. It does not provide public side maps.
I have not had the time to convert it to v3. I’ve gotten close to producing a new version with out the custom marker options but it’s not working completly yet.
Offline
MattD wrote:
msd_google_map is an admin side plugin that helps add coordinates to articles. It does not provide public side maps.
I have not had the time to convert it to v3. I’ve gotten close to producing a new version with out the custom marker options but it’s not working completly yet.
So it is not necessary to use msd_google_map in order to implement the Google Maps v3 Example as displayed on http://photographdaddy.com/txp/google-maps-v3-example?
By the way, what is the thing with the creation of a fake article in the example?
• Photojournalist.jp – News and photos (100% txp)
• JapaneseStreets.com – Japanese street fashion (mostly txp)
• Old Photos of Japan – Japan between 1860 and 1940 (100% txp)
• MeijiShowa – Stock photos of Japan between 1860 and 1940 (100% txp)
Offline
It’s not neccessary to use msd_google_maps. If your articles have location data then this will work. Just change the custom field names to your lat/lng field names.
* A fake article comes last to avoid the need to determine if we're on the last
* article in the result. We'll skip this one later.
I was just being lazy. You could use txp:if_last_article instead like this:
<script type="text/javascript" src="<txp:site_url/>textpattern/jquery.js"></script>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=YOUR-API-KEY&sensor=false"></script>
<script type="text/JavaScript">
<!-- to hide script contents from old browsers
$(document).ready(function() {
initialize();
});
function initialize() {
var myOptions = {
zoom: 5,
center: new google.maps.LatLng(36.6, -121.9),
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
setMarkers(map, articles);
}
/**
* Data for the markers consisting of a name, a LatLng an image and a description
* for the article.
*/
var articles= [<txp:article_custom limit="99" lat="_%" long="_%">
['<txp:title no_widow="0" />', <txp:custom_field name="lat" />, <txp:custom_field name="long" />, '<txp:images limit="1"><txp:image_url thumnail="1"/></txp:images>','Read more about this picture and <txp:permlink><txp:title /></txp:permlink>']<txp:if_last_article><txp:else/>,</txp:if_last_article></txp:article_custom>
];
function setMarkers(map, locations) {
for (var i = 0; i < locations.length; i++) {
var article= locations[i];
var myLatLng = new google.maps.LatLng(article[1], article[2]);
var marker = new google.maps.Marker({
position: myLatLng,
map: map,
title: article[0],
desc: article[4],
img: article[3]
});
var infowindow = new google.maps.InfoWindow({
content: " "
});
// Add infoWindows for each Marker
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent('<div id="mapCont"><img class="mapImg" src="'+this.img+'" width="100px"/>' +
'<div class="mapTitle">'+this.title+'</div>' +
'<p>'+this.desc+'</p></div>');
infowindow.open(map, this);
});
}
}
// end hiding contents from old browsers -->
</script>
Last edited by MattD (2012-12-19 16:46:14)
Offline
Another option, which is simpler, is using Google Static Maps on the public side if you only need one marker. I’m using this on some of my articles
I use adi_variables to set these:
<txp:variable name="google_map_key" value="YOUR-API-KEY" />
<txp:variable name="map_type" value="hybrid" />
<txp:variable name="map_marker" value="green" />
Then in my article form I have
<!--display a static map image from Google.-->
<img class="frameleft2" width="580" height="200"
src="http://maps.google.com/staticmap?center=<txp:custom_field name="lat" />,<txp:custom_field name="long" />&zoom=14&size=580x200&maptype=<txp:variable name="map_type"/>&markers=<txp:custom_field name="lat" />,<txp:custom_field name="long" />,<txp:variable name="map_marker"/>&key=<txp:variable name="google_map_key"/>&sensor=false" alt="map" />
edit: looks like they do support multiple markers.
Last edited by MattD (2012-12-20 19:15:08)
Offline
Thanks a lot, Matt! This week-end I will try your suggestion from yesterday.
• Photojournalist.jp – News and photos (100% txp)
• JapaneseStreets.com – Japanese street fashion (mostly txp)
• Old Photos of Japan – Japan between 1860 and 1940 (100% txp)
• MeijiShowa – Stock photos of Japan between 1860 and 1940 (100% txp)
Offline
Pages: 1