Decoding Mapping URLs

Almost everyone on the net has had the opportunity to use one of the big four web mapping sites: Google Maps, Bing Maps, Yahoo! Maps, and OpenStreetMap.  It’s possible to host a custom map on your own site using one of these services, as long as you have some programming experience.  But it only takes a few seconds to make a link to one of these sites.  Today, I’m going to explain how to construct a URL which will have your visitors clicking through in no time.

Generally, the URLs contain a number of parameters, separated by ampersands.  The order of the parameters normally doesn’t matter.  Every map must have a location, and a zoom level and a type identifier are also common.  Other parameters are possible, but most are beyond the scope of this tutorial.  For the following examples, the mapped location will be Pioneer Square, in downtown Portland, OR.  The approximate center of the Square is N45.518885, W122.679327.  In each of the examples below, latitude North will be expressed as a positive number, and longitude West will be expressed as a negative number.

Google Maps:
Google Maps is one of the easiest URLs to deconstruct, because the only pieces of information required are the location and the zoom level.  The zoom level is an integer specifying the scale of the map, with 1 showing the entire planet, and 20 being just below a square city block.  For most of the US, the maximum zoom for satellite images is 21.  To map the center of Pioneer Square, at a zoom level of 18, the URL would be:,-122.679327&z=18
This URL will show the map view, and automatically place a default marker at the location.  If you want to link to a different view, you need to add the ‘t’ parameter, signifying what type of map will be shown.  Here’s a list of the main types available: ‘e’ is Google Earth view, ‘f’ is an orthographic view with 3-D buildings, ‘h’ is hybrid satellite view (with map overlay), ‘k’ is an orthographic view, and ‘p’ is elevation view.  All other values (or no value) default to map view.  To use the ‘t’ parameter, just add a simple value after the zoom level:,-122.679327&z=18&t=h

OpenStreetMap (OSM) uses a construction similar to Google’s:
The major difference between OSM and Google is that OSM reads latitude and longitude as separate parameters.  If you would like to see a default marker at the location, use mlat and mlon; otherwise, use lat and lon.  The zoom level is similar to Google’s, except that 19 seems to be the maximum possible zoom.  The final parameter dictates what base layer map to use.  ‘M’, the default, represents tiles rendered using the Mapnik library.  Other available values include ‘O’ for Osmarender, ‘C’ for the Cycle Map, and ‘N’ for NoName.

Yahoo!’s construction methods are similar to those used above:
Latitude, longitude, and zoom level are the same as OSM, except that the maximum zoom level is 18.  The map type is somewhat different, though – unlike most other mapping parameters, the type must be at the beginning of the URL.  Possible type values are ‘m’ for map, ‘h’ for map/satellite hybrid, and ‘s’ for satellite.  Unfortunately, this URL does not show a marker at the desired location.  To do that, it is necessary to trick Yahoo!’s direction finding service by adding a point called q1.  This point will be the same latitude and longitude as our location, but it will be constucted as a single paired value instead of as 2 discrete values:,-122.679327

Bing draws really beautiful maps, but its URL construction is somewhat mysterious:
The first oddity is that Bing uses a tilde (~) as the separator between the latitude and the longitude.  Bing also uses ‘lvl’ to indicate the zoom, which goes up to 20.  There are a number of other parameters here which have little effect on the map, including ‘v’ and ‘dir’.  The last parameter, ‘sty’, indicates the style of the map.  Possible values include ‘a’ for satellite, ‘b’ (or ‘u’) for orthographic hybrid, ‘h’ for satellite hybrid, ‘o’ for orthographic, and ‘r’ for roads.  Convincing Bing to place a marker on the point involves adding an additional parameter, ‘q’, which is a coordinate pair.  But note that the coordinate pair for ‘q’ uses a comma instead of a tilde:,-122.679327

Each mapping URL can also use properly constructed string values to designate a particular business or landmark, as opposed to the simple latitude/longitude example given here.  However, this activity is left to the user.  Experiment by running a search and then examining the resulting URL.  Happy surfing!

Comments are closed.