I’ve been playing around with Facebook Connect for iOS and posting messages to the wall that include a static map. I started out by trying to use a URL to a static Google map. Problem: the map didn’t show up or was showing the wrong thing. I found some threads on Facebook forums etc of people experiencing the same thing. This is the reason maps don’t show up as expected.
When you include an image in a wall post Facebook use their own servers to fetch and cache that image. Google Maps has a request limit of 1000 requests per day per IP. Given the amount of posts made on Facebook that include a google map their servers will hit this daily request limit. It’s also not possible to pass the image data along with the wall post, otherwise the device would have 1000 shares with maps per day and your app could share more or less an unlimited number of maps.
Bing also has static map functionality and their request limit for developers is much more generous than Google Maps. Just like everything Microsoft there is an extensive terms of usage document which makes it somewhat confusing which limits actually apply. Using Bing service requires a Bing Maps Key, the same problem scenario apply for Bing even though the request limit is higher.
Exactly! But look at the url of the map in posted check-ins. Here’s the address to the static map for a check in at Valtech: http://foursquare.com/mapproxy/59.3280/18.0506/map.png. They have their own proxy setup for handling static maps. So have they acquired tons of IP’s for fetching maps? No. According to this blog post the author of the blog was contacted by a co-founder of Foursquare and writes:
I finally got a reply from Dennis, co-founder Foursquare regarding this and this has nothing to do with Microsoft-Facebook deal. It is purely a technical decision. Google has a limit on the number of requests per day, Foursquare kept hitting that limit, the guys at Redmomd decided to lift the limit for Foursquare as a result Foursquare is using Bing Maps on Facebook.
So Microsoft decided Foursquare was good PR for their service.
Exactly, they do. If you use places and and look at the map urls you’ll see: http://fb.ecn.api.tiles.virtualearth.net/api/GetMap.ashx?b=r,mkt.en-US,stl.h&h=100&td=1&w=100&z=13&ppl=37,,59.3280,18.0506
Facebook and Microsoft has a partnership that enable them to map away with no limits. Of course I tried to abuse this url to post my own maps but no map was shown at all. Weird, right? It seems Facebook is blocking people (deliberate or not) from using this static mapping url
Yahoo! Maps also offer static maps, but with a 50.000 req/day limit. API-key required.
There are three ways of doing it. One really questinable, one somewhat questionable and one legitimate.
Foursquare can map without limits through their proxy, so can you too. Just change the coordinates in the URL and you’re done! http://foursquare.com/mapproxy/59.3280/18.0506/map.png.
Facebook blocks http://fb.ecn.api.tiles.virtualearth.net/api/GetMap.ashx?b=r,mkt.en-US,stl.h&h=100&td=1&w=100&z=13&ppl=37,,59.3280,18.0506 from API wall posts but when I use this shortened url http://bit.ly/ijiHZ8, which point to the very same URL as above, the map is correctly shown in the wall! Trying to get around this by setting up a cname pointer on your own domain doesn’t work, unfortunately. bit.ly has an API which is super easy to use.
If you’re working on a serious project you probably don’t want to abuse and rely on something that could very well change any time. Sign up for Bing Maps or a Yahoo! Maps and set up a service that downloads the map image and returns the very same image. Super simple and could easily be hosted in a cloud service (like AppEngine) if you don’t have a server available.
If you are lucky enough to expect 50.000+ shares per day from your application you could just use multiple maps services. If you’re pushing more wall posts than that you could probably contact Microsoft and get yourself an “all you can share” deal.
With this blog I try to provide useful tips and solutions for programming .NET, Objective-C and more. My name is Björn Sållarp, and I love writing code.