I'm working on a web project (PHP, jQuery) which currently using Google Maps powering up the map functionality of the application, however we need to make it multi-platform like you can go to the dashboard and choose one from 5-10 map providers (which Goolge Maps is just one of them) to underlying your map functionality.

So, as the application is supposed to show the data on map, almost in every single place we have to deal with the API provided by that specific map provider. Currently we are thinking about revising our modular structure and/or making something like an adapter for each provider to deal with their native syntax but via our standard methods.

I wish to have your ideas and your experiences, specially if you ever made an interface for dealing via 2-3 different map providers. That would helps much and I really appreciate that.

If you need any further information, just ask me to update the question.


As Vicky Chijwani suggested Mapstraction, now I'm also wondering which one is more better (pros & cons), having an adapter implemented on Javascript or PHP?

1 Answer 1


An adapter strategy sounds good enough for this case, i.e., define a common interface and then proceed to implement that interface for each provider. The choice for which map provider to use can be a configurable option in the settings.

Also see Mapstraction, a JavaScript library that provides a common interface for several map providers, including Google, Bing, Yahoo, and OpenStreetMap. It is licensed under the BSD license.

UPDATE [25th Oct '12], taken from my answer to your other follow-up question, for completeness here:

As far as I can see, there are no benefits to implementing your adapters on the server-side rather than in JavaScript. In fact you would be better off with JavaScript because it is the ubiquitous language of the web; if in the future you decide to re-write your backend using another technology, you wouldn't have to re-write the adapters.

If you're hesitant to go with JavaScript because you don't have enough experience with it, even then my suggestion would remain unchanged, because every modern, client-heavy web application demands that you be comfortable with it.

Besides, you're getting a mature, tested JavaScript adapter library - with a fairly permissive BSD license - in the form of Mapstraction, which I mentioned above, so that's a very good option if you can use it. Either way, I think JavaScript is the way to go for you.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.