Thursday, 28 December 2017

Choosing OpenLayers or Leaflet?



I was debating with one of my collegues on OpenLayers v/s Leaflet. I made a point that OpenLayers is much better API if we wish to build a project, where you need direct connectivity to the Geoserver and PostGIS.


Then I found Open Data Kit, which looks pretty new but has the features of connectivity with the Geoserver and PostGIS.


So my project details are as follows,



  1. Use the map interface to fetch Feature Info

  2. Create a customized tool that takes the lat/lon from user as to where he/she clicks on the map and then fetches the Climate Data from the raster (which is handled by a py script on the server)

  3. Allows user to upload excel, which is sent to the py script, which returns a GeoJSON, which creates Vector Features on the map

  4. Allow user to create vector polygons, which will fetch the Features it intersects from the WFS Layer.

  5. Fetches Layer from the PostGIS Datastore on GeoServer and displays the layers on the map.



So now I am confused on which is better and why using OpenLayers over Leaflet makes more sense or not?



Answer



I have used both OpenLayers and Leaflet in my apps. There has been so much discussion on this topic in this forum and others on planet-internet. They usually fall into 2 camps - features and flexibility of OpenLayers versus simplicity of Leaflet. I would not be surprised if someone spawns an "OpenLeaf" initiative soon marrying the best of both worlds!


I found Leaflet very simple to use, a petite 64K size, compared to over 700K Openlayers, and in very few steps you can create apps that have the freshness and eye-candy of today's web and mobile GIS apps. Your stack - GeoServer, PostGIS etc., is a standard stack, so OpenLayers or Leaflet could easily be incorporated.


Having said that, I would still go with OpenLayers for the following reasons



  1. There is just a TON of material around OpenLayers. It is a lot more mature than Leaflet.

  2. Check out the comparison on commits and users.

  3. OpenLayers, GeoServer, PostGIS stack is so proven in the FOSS world that you are going on a path that is solid.


  4. OpenLayers has tad bit more features on Map Controls.

  5. While its a bit more work to create transitions and visual-effects, it can be done in OpenLayers.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...