views:

5294

answers:

7

Hi,

I have used Google Maps a couple of times, but what wondering about OpenLayers...
Before starting any kind of coding, here are a couple of questions that come to my mind, and you might help me about :

  • Why would I use OpenLayers instead of Google Maps ?
    • Except for it's OSS licence, anyway
    • Did you encounter any situation in which you'd recommend absolutly not using OpenLayers ?
    • I did a search about "OpenLayers" on SO ; there are not many answers ; does it mean this solution is not used much ? Could it be a problem for long-term viability of the project ?
  • For those of you who have already used OpenLayers : are there any common pitfalls / problems I may encounter ?
    • What about using a JS Framework with it ? I've seen it's using prototype, and I know prototype, so that's be OK... But what about using something else like Mootools ? (Which is not compatible with prototype, btw)
    • Are there any kind of speed/performance related problems ? I need my application to be responsive, and can't wait hours to get a map displayed...
  • Are there maps available for many places, or are there lots of those missing ?
    • ie, I'm in France, and need my application to work at least for big cities... Will that be OK ?
    • if not, is it easy to find layers/visualisations for OpenLayers and integrate them ?
  • Is there any kind of API to display roads ?
    • For instance, to show roads that are one-way only
    • If yes, how can I do that ? Do I have to have some kind of file containing those roads informations, and, then, display them on the map by myself ?
  • Do you know any good tutorial to OpenLayers ?

Thanks in advance for your help !

I have not tried it yet, those are just out of the blue question... So sorry in advance if some are stupid ; I'm really a big ignorant, right now, when it comes to OpenLayers :-(
And, if you have any recommandation, don't hesitate : I'm always interested !

+8  A: 

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

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

Swingley
Thanks for that answer! It's nice to see the mailling-lists are quite active, before beginning working with a project ^^
Pascal MARTIN
+8  A: 

It's not necessarily a question of OpenLayers OR Google Maps. You can after all use Google Maps for your map background in OpenLayers. Some 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)

Pitfalls

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

Performance

  • 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 yuo have acess to
Nils Weinander
Nice answers ; thanks for all these informations! I don't know the details yet, but I might have to use some data from my own server, so everything should be OK, particularly with the ability to integrate several backends (If I understood correctly ^^ I'll have chances to test that in a couple of days, I hope ;-) )
Pascal MARTIN
@Pascal, I'm glad the answer was useful. I can add that the OpenLayers community is very active and the mailing lists quite helpful.
Nils Weinander
+4  A: 

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

OpenLayers have lots of examples to get you started.

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

Andrew Dwyer
Hi! Looks like "I am" your first answer here! Welcome! And thanks for your answer :-)
Pascal MARTIN
+30  A: 

These are a really great questions! I'm a professional OpenLayers developer and fan, so I'll address your questions from 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 about the long-term viability of the project. It is the premier open source client-side mapping 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/real projection like WGS84 into an OpenLayers map using Google/Yahoo/Microsoft base maps. The examples are your friend.

JS 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. http://developers.cloudmade.com/projects

Do you know any good tutorial to OpenLayers?

I hope this is useful. And I'm around SO if you have any questions!

atogle
Hi! Thanks a lot for this answer, that is indeed useful! There are definitly some interesting points (better vector support will probably be useful for the project I'm thinking about ; and it's not the only thing you're saying that is interesting !) ; Maybe I'll ask some other questions in sometime : I've not started working with OL yet (this question was quite a "prelimar" one ^^ ), but time will come, I suppose, considering the answers I've gotten!
Pascal MARTIN
+1. I've tried not to type this comment, but I can't help myself. WGS84 is not a projection. (It is worth trying to learn this stuff - I'm painfully picking up a bit of GIS, and it really helps with map stuff.)
MarkJ
+4  A: 

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

geographika
+1. I have some clients like that. And I'm not saying they are wrong. Last time I looked, the Google Maps licensing terms do indeed allow Google to introduce advertising into the maps whenever they wish.
MarkJ
Also by using GoogleMaps you are granting Google a perpetual, irrevocable, royalty-free, worldwide license to reproduce, adapt and modify your content.
MarkJ
+1  A: 

Couple of things I would add, from two perspectives: Client Usage and Data Serving.

Client 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 so, both OpenLayers and Google Maps will work with it, and you are probably going to have to decide based upon client usage.

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

Ruz
+1  A: 

I think that all response are from OpenLayers funs :)

I am to agree with all answers, but there are one very important point that nobody mention. OpenLayers and Google Maps has different targets.

OpenLayer is an excellent framework to display geodata, but Google Maps it's a pool of services than include a framework to display geodata among other services.

So, Google Maps expose a lot service and features that OpenLayes has not. Some examples of google maps features and services are region localization, sensor detection (for device with gps) and user localization, geocoding and reverse geocoding, street view, etc........

angelcervera