I am attempting to build an application that imports GeoRSS files into Google Maps, however I am seeing strange behavior where I can't get the map to zoom out after I import the file. It is stuck zoomed right into the first pin that is imported by the file.
See below code for example:
<script type="text/javascript">
function initialize() {
var myOptions = {
zoom:0,
mapTypeId: google.maps.MapTypeId.SATELLITE
};
var map = new google.maps.Map(document.getElementById("map_canvas"),myOptions);
var georssLayer = new google.maps.KmlLayer('https://twitter.com/statuses/user_timeline/findingnewo.rss');
georssLayer.setMap(map);
map.setZoom(0);
}
</script>
Anyone seen similar behavior?
Here's your answer:
https://developers.google.com/maps/documentation/javascript/layers#KMLLayers
When you add a KML layer, the default behaviour is to zoom and position the map to fit the layer contents. You can supply an option to prevent this from happening.
Options:
https://developers.google.com/maps/documentation/javascript/reference#KmlLayerOptions
Example:
var options = { preserveViewport: true },
georssLayer = new google.maps.KmlLayer('https://twitter.com/statuses/user_timeline/findingnewo.rss', options);