[ACCEPTED]-OpenLayers vs Google Maps?-openlayers

Accepted answer
Score: 159

These are a really great questions! I'm 8 a professional OpenLayers developer and 7 fan, so I'll address your questions from 6 that perspective.

Why would I use OpenLayers instead of Google Maps?

  • Flexiblity: You are not tied to any particular map provider or technology. You can change anytime and not have to rewrite your entire code. Google, Yahoo, Microsoft, WMS, ArcGIS Server, MapServer, etc. are all supported out of the box.
  • Vector Support: Better support for points, polylines, and polygons.
  • Control: You have the ability to add any new features that you may need. I've personally written three plugins for OpenLayers, two of which are or will be part of the source.
  • Debugging: Much easier to debug when you can step through the source code!

I would not worry at all 5 about the long-term viability of the project. It 4 is the premier open source client-side mapping 3 library.

Are there any common pitfalls / problems I may encounter?

  • The biggest pitfall I've run into is working with the Web Mercator (Google) projection. It can be a pain to display vector data that is in a common and real projection like WGS 84 into an OpenLayers map using Google, Yahoo, and Microsoft base maps. The examples are your friend.

JavaScript Framework Compatibility

  • I use the jQuery framework for all of my work, and the only problem I've had is referencing jQuery after OpenLayers. Other than that, it's been smooth sailing.
  • Performance is great! The only issues will be with your map server or adding too many vectors to your map.

Are there maps available for many places?

  • Like I said, you can use basemaps from just about any source for anywhere in the world.

Is there any kind of API to display roads?

  • I'd check out CloudMade! The have converted the OpenStreetMap project into a map tile service and allow custom styling. I believe that you can style one-way streets (per your example) a particular way. The CloudMade Developer Zone.

Do you know any good tutorial to OpenLayers?

I hope this is useful. And I'm around 2 Stack Overflow if you have any 1 questions!

Score: 35

It's not necessarily a question of OpenLayers 3 OR Google Maps. You can after all use Google 2 Maps for your map background in OpenLayers. Some 1 more specific answers:

Why OpenLayers?

  • OpenLayers can combine maps from different sources (Google Maps background, WMS overlays, vector data from KML or GML files or WFS etc)
  • You can style OpenLayers much more thanyou can Google Maps
  • Open source, you can check the source code when debugging
  • If you need high precision in the maps, use OpenLayers with a suitable map server backend rather than Google Maps to get a better map projection (Google Maps assumes that the earth is a perfect sphere)


  • If you want to use vector (WFS) data from another server you need a proxy, due to cross site scripting limitations


  • Depends mainly on the speed of the map backend
  • Displaying many vector features (limit is browser dependent, but say > 200 on one view) takes time, but that is more a browser thing than a problem with OpenLayers

JavaScript frameworks

  • Have a look at GeoExt, which is ExtJS + OpenLayers, for example

Available maps

  • OpenLayers doesn't come with a map backend. You can use Google Maps, Yahoo Maps, MS Virtual Earth etc, or any WMS and WFS service tou have access to
Score: 23

I haven't seen much of a presence from OpenLayers 11 users on SO but they're out there. The OpenLayers mailing lists are 10 pretty active (I'm on Users and Dev and see anywhere 9 from 50-100 emails a day discussing various 8 things. You can search the lists from those 7 links too.).

I can't answer all your questions 6 but one thing I'll put out there is that 5 OpenLayers and google maps aren't mutually 4 exclusive. OpenLayers is a javascript library 3 and you can use it to interact with google 2 maps. Check out this example: OpenLayers using google maps. And here's 1 the main OpenLayers examples page.

Score: 13

It really depends on what you want to use 16 the map for. To simply plot points on a 15 map, Google Maps will be fine. The map layers 14 for Google Maps are also quite detailed. OpenLayers 13 on the other hand offers far more functionality 12 and is very extensible.

OpenLayers have lots 11 of examples to get you started.

As for maps, OpenLayers 10 is only an API so you need to supply it 9 will map layers. The Google Maps API will 8 be limited to the map layers supplied by 7 google. With OpenLayer you can display 6 pretty much any publicly available map service 5 (WMS, WFS, TMS, WMS-C). A very good example 4 is openstreetmap.org - (global streets map 3 collected by the community). OSM can be 2 added to openlayers as a TMS layer. Check 1 out this example for instructions.

Score: 13

One point that hasn't been fully made here 26 is that using OpenLayers avoids various 25 restrictions Google places on the terms 24 of service for its map APIs, including:

  • You 23 can't legally use a Google map solely in 22 a section of your site that requires payment 21 to access, or for a private site that the 20 public can't sign up for (e.g. a corporate 19 intranet). (IANAL, but see Terms of Service, 9.1 and the FAQ)

  • You can't 18 legally (or practically) use the Google 17 API for offline applications (i.e. where 16 the tiles are served from your own machine). Even 15 if there weren't legal restrictions, Google 14 makes this technically very difficult, while 13 OpenLayers makes it easy.

  • Google reserves 12 the right to shut down access to the API 11 if you're showing a map with content it 10 finds objectionable. The example given in the FAQ is a map of illegal 9 drugs, which gives a good sense of the gray 8 areas this restriction might cover.

See this FAQ and 7 the Terms of Service for more details.

All that said, as 6 a long-time Google Maps developer who recently 5 started using OpenLayers, I feel that Google 4 Maps has better documentation, a larger 3 user community, and a clearer and more stable 2 API than OpenLayers. So you have to make 1 a trade-off somewhere.

Score: 10

I agree with all answers, but there is one 11 very important point that nobody mentions. OpenLayers 10 and Google Maps have different targets.

OpenLayer 9 is an excellent framework to display geodata, but 8 Google Maps is a pool of services that include 7 a framework to display geodata among other 6 services.

So, Google Maps expose a lot services 5 and features that OpenLayes do not have. Some 4 examples of Google Maps features and services 3 are region localization, sensor detection 2 (for device with GPS) and user localization, geocoding 1 and reverse geocoding, street view, etc.

Score: 9

Some clients may refuse, or have strong 9 reservations, about using Google Maps. They 8 may have valid concerns that Google may 7 introduce advertising or change the API 6 without notice. However Google Maps does 5 have the benefit of integrating with other 4 Google services (placemarks, adding photos, geocoding 3 services). As its the web you can always 2 combine many different mapping services 1 and APIs.

Score: 6

I have used both APIs. I make a software 41 for corporations and this software requires 40 mapping but not all clients have a GoogleMaps 39 license, so I need to support both types 38 of maps.

I have made a common API for abstracting 37 the differences between them and let me 36 tell you, some stuff is easier to do in 35 one than the other. Like limiting the bounds 34 of where you can pan the map to, it is a 33 lot easier to do in OpenLayers, but heatmaps 32 are easier to use on GoogleMaps (it is officially 31 supported by google, unlike the available 30 OpenLayers plugins).

  1. OpenLayers support offline 29 maps. Some of my users are in private intranets 28 without internet connection.

  2. GoogleMaps has 27 two absolutely must have plugins, MarkCluster and 26 Spiderfier that makes possible visualizing a huge 25 numbers of markers.

  3. GoogleMaps InfoWindows 24 are easier to use and have better usability 23 than the OpenLayers.Popups. These are the 22 little windows that can open when you 21 click in a marker. Googlemaps InfoWindows 20 are also a lot more pretty by default, you 19 have to do some CSS wizardry with the 18 Popups.

  4. GoogleMaps has streetview which is 17 useful sometimes.

  5. GoogleMaps has more features 16 that you might need. Although many features 15 are present in OpenLayers too, but not officially supported.

Usually 14 in the end you should go with OpenLayers 13 because of the reduced headache you might 12 get from licensing and bandwith usage from 11 googlemaps. Both handle basic mapping (ie, displaying 10 markers on top of a map) very well. Unless 9 you can find a specific feature you need 8 from one that is not present on the other 7 you should go for OpenLayers. See this for more 6 information about googlemaps billing and 5 when you can use it for free.

Also GoogleMaps 4 has its basic geolocation type as 'LatLng' and 3 Openlayers use 'LonLat' which drives me 2 freaking nuts because I keep mistaking the 1 order of the parameters in function calls.

Score: 3

A couple of things I would add, from two 8 perspectives: client usage and data derving.

Client 7 usage:

  • What are you clients used to using currently? Change can be difficult.
  • How much functionality do you really need? OpenLayers has quite a bit, but if you are not using it...

Data serving:

  • Are you serving KML data? If 6 so, both OpenLayers and Google Maps will 5 work with it, and you are probably going 4 to have to decide based upon client usage.

  • Are 3 you serving other types of data services? (WMS, WFS, CSV, etc.) If 2 so, then OpenLayers very likely has examples 1 and support for it.

Score: 3

In addition to those who mentioned speed 11 problems, I would like to add that IE's 10 VML renderer can get really slow with a 9 vector layer with many features. One user 8 mentioned about 200. That's about exactly 7 what I can add before IE slows down considerable 6 to the point of freezing. If you add features 5 that are text labels, you can add half less, probably 4 because internally each text label consists 3 of two VML elements.

In Google you may create 2 a custom GOverlay whose content is a "div", which 1 gets rendered without problems in IE.

Score: 2

OL has a large fanbase and is perhaps the 20 most used Opensource geothing used in the 19 world.

You dont see that many threads and 18 posts about it in this cyberplace because 17 people here tend to discuss other kind of 16 techs, like JSF and Mobile (non geo), not 15 because OL is like struts.

However Ol has 14 some drawbacks, mainly that it's so low 13 level that you have to write lots of code 12 to do common ops. That can work in the good 11 way too, because as a developer a: you have 10 all the code upfront and b: tweaking and 9 customizing is very easy.

There are more 8 sophisticated free geotools, but all they 7 do is call openlayers and abstract some 6 of the more boring chores.

So use it confidently. It's 5 mature, robust and it's not going to die 4 in the foreseable future. However if you 3 want to speed up your developing process 2 you should try the other tools that mount 1 in top of it.

have a nice day

More Related questions