tirsdag den 29. september 2009

Technical Overview: Mapstraction

Kortabstraktion ...

Mapstract thinking ...


Mapstraction is a JavaScript toolkit that provides an common API to eleven different mapping providers. This allows a developer to create an application that can be easily switched between different base map providers. This could be at development time (eg. if a provider introduces better data) or at runtime (eg. according to region or the whim of the end user).

Mapstraction introduces a layer of abstraction between the developer and the various map provider APIs. This allows the developer to write the application only once (for the abstration layer) and support all of the APIs simultaneously. It also allows the map provider to be chosen at runtime - eg. by region according to data coverage, or the end user's personal choice.

The Mapstraction project is under continuous development, with progress recorded in a roadmap and a feature matrix. Despite the appearance of being partially developed, Mapstraction already supports eleven "providers":

  • FreeEarth
  • Google
  • Map24
  • MapQuest
  • Microsoft Bing Maps (nee Virtual Earth)
  • MultiMap - both the commercial and OpenAPI interfaces
  • OpenLayers
  • OpenSpace (British Ordnance Survey)
  • OpenStreetMap
  • ViaMichelin
  • Yahoo

Note that not all of these are data providers as such. For example, OpenLayers is a popular JavaScript toolkit. Similarly, OpenStreetMap is a data source and not a JavaScript API.

Supported features currently include: map size/zoom/pan, add/remove controls, add/remove/declutter markers, add/remove polylines, image overlays, JSON, tile layers, and various marker & polyline attributes (icons, text, color, etc).

Mapstraction has an interactive API "sandbox". This is similar to the increasingly popular "interactive SDKs" that are often included in online documentation, but it also allows the reader to edit the code. The interactive API "sandbox" can be found athttp://mapstraction.appspot.com/ .

So how easy is it switch between different map providers 'on the fly'? Very easy as it turns out. The following example (from the interactive API sandbox) implements a set of radio buttons allowing the user to change map providers: [...]

Read more: http://www.geowebguru.com/articles/211-technical-overview-mapstraction

Ingen kommentarer:

Send en kommentar