Can anyone suggest me which database to be used with OpenLayers? I have to store the values in a database table and retrieve them (trivial tasks). Which is better MySQL or PostGIS? Can anybody give benefits of these?


The bostongis comparison is not a really up-to-date document but it can be a good start, at least to see which aspects is a priority to you, and what you should consider as mandatory or optional to make your choices. The comparison is generic, not related to openlayers.

For your OL project, I guess you should also consider the DB availability from your hosting unless you have no constraint regarding this point.

From Postgis, you can natively export a query result as kml and json (and easily read it with OL), which is I think impossible with MySQL (you'll have a third party call to dynamically create it through any language..)

  • 7
    +1 POSTGIS all the way! Forget SDE on top of any underlying DBMS. – CaptDragon Mar 28 '11 at 14:05

Postgres with PostGIS everytime http://en.wikipedia.org/wiki/PostGIS

More Spatial Functions and control on the database in spatial terms


If we are talking about Spatial Database, I would leave MySQL out: it is very much incomplete in respect with other OGC Simple Features SQL implementations like PostGIS (my favourite), Oracle Spatial, SQL Server Spatial or even Spatialite. Or ArcSde as a gateway to its supported RDBMS.

Please note, however, that you do not need to have a spatial database for using OpenLayers. You can feed OpenLayers with any Map Server that provides WFS/WMS/WCS etc... OGC web services implementations. For example if you are using MapServer, you will be able to feed OpenLayer with any vector layer supported by GDAL/OGR:


Given your use case ("store the values in a DB table and retrieve them") I guess you need a WFS-T implementations: you may use GeoServer (with PostGis/Oracle Spatial or MySql) or TinyWFS (only GeoServer) for this.

Note that TinyOWS is going to be included soon in the MapServer project (actually MapServer does not provide WFS-T implementation).

  • Why would he need WFS-T support? WFS should be enough for read-only. – underdark Mar 28 '11 at 18:00
  • he says: "store the values in a DB table and retrieve them" – capooti Mar 28 '11 at 22:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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