Pebbles
My thoughts, my expressions.
Google Maps – making your map accessible to api without api key
Days back I was playing around with Google’s maps and I found it quite frustrating that the maps I created with http://maps.google.com/maps/mm is not accessible by APIs unless I authenticate by signing in to my Google account. I was getting a ‘map not api visible’ error. For those who are having similar situation, here is the solution. Use any api (java, php, python or even javascript) to set your map’s ‘api_visible’ property to true!
<script>
function login(){
token = google.accounts.user.login('http://maps.google.com/maps/feeds');
if(token) updateMap();
}
function updateMap() {
//mapUrl is the url to your map - http://maps.google.com/maps/feeds/maps/userID/full/mapID
service.getMapEntry(mapUrl, function(entryRoot) {
var entry = entryRoot.entry;
entry.addCustomProperty({name:'api_visible', value:'1'});
entry.updateEntry(
function(ent){alert('Updated!');},
function(e){alert('Upadte err...' + e);});},
function(e){alert("Err..." + e);}
);
}
</script>
<input onclick="login();" type="button" value="Authenticate!" />
<input onclick="updateMap();" type="button" value="Update!" />
Happy mapping!
please help.
do i need to run this script each time i use the map,cause i tried and got the same error ‘map not api visible’
if you can provide a complete code i will be thankful
thanks in adavnce.
If you are lazy writing codes (just kidding), visit http://makeyourpublicmapapivisible.appspot.com/ . Here you can make your maps visible to API! Also, you need not do this each and every time. Once a map is made API visible, you can continue development without worries.
—-cheers
Thank You
The error is gone,but the response doesn’t contain any search results (entry field).
any suggestions?
Nice post….thanks