Could anybody give me some advice on which one should I use? OpenLayers or Leaflet

I will implement OSM on a web-app for taxi management. The requirements for the map part are:

  1. Tracking of the drivers cars using a tablet through my web app.
  2. Conversion of a given address to lat-long.
  3. Showing a route between start and destination lat-long.
  4. Completely free of charge

Your question is very open ended and doesn't really have a definitive answer. You should check out this answer to Choosing OpenLayers or Leaflet? for some good arguments for and against.

A lot of people use OpenLayers because of the huge amount of flexibility, but some people avoid it because it can be quite big (it should be pointed out that you can deploy 'Lite' versions). On the leaflet side lots of people uses it because it's ver small but some avoid it as it does not have enough flexibility for what they are after. You look like you want to keep things fairly simple so Leaflet might be the way for you, but there is no way I can make that decision for you.

One other thing I should point out is that your third requirment regarding routing cannot be achieved via OpenLayers or Leaflet, you would need some sort of routing engine or service to do that for you. Both OpeLayers and Leaflet would be able to display routes but they are not routing engines themself. You could plug into the Google Maps Directions API for that, and both Leaflet and OpenLayers will quite happily use that, or any other routing service you find.

  • Thanks for your prompt answer. I suspected that I would need some kind of routing service, but the core req. is that the map cand display routes (I will also use Nominatim for address to lat-long conversion). I forgot to mention another requirement; it has to be completely free of charge, but I think both of them fall in this category. After a quick research I was also leaning towards leaflet so +1 for leaflet:) – Lori May 16 '13 at 14:06

This basically depends about experience with libraries. OpenLayers is a one large size file library with lots of classes for several use cases. Leaflet is smaller so it has less features.

  • Tracking of the drivers cars using a tablet through my web app.

If you intend to use tablet devices you can also switch to native APIs of your system like Android and others. Since you plan to use it on vehicles this is not mandatory. Using a native application can reduce battery use, network use.

  • Conversion of a given address to lat-long.

This is not tied to map viewers, you can do it with OpenLayers by any service invocation using the OpenLayers.Request instance and parsing response. This is called geocoding.

  • Showing a route between start and destination lat-long.

This also is not tied to map viewers, you will also need a service to this. You can download and render routes with OpenLayers without problems. It will be faster then google.maps v3 in some cases. I can not tell about leaflet speed. In OpenLayers prefer the canvas renderer, it is much faster then SVG.

  • Completely free of charge

The OpenLayers client is free of charge and has most of his API documented. Leaflet should have a newer code what can include more bugs too. OpenLayers can be easily attached to google closure-compiler. I chopped off unnecessary classes from it and reduced code size about 60% of distributed size.

  • Thanks for your response. I decided to go with leaflet but if it doesen't work i'll try openlayers too. – Lori May 17 '13 at 8:06
  • +1 for mentioning the closure compiler. I squished my version of OpenLayers a lot using that, really handy and built into the python script that compiles custom versions. – Rob Quincey May 17 '13 at 9:33

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