Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

Thanks in advance

share|improve this question
up vote 8 down vote accepted

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..)

share|improve this answer
+1 POSTGIS all the way! Forget SDE on top of any underlying DBMS. – CaptDragon Mar 28 '11 at 14:05

Postgres with PostGIS everytime

More Spatial Functions and control on the database in spatial terms

share|improve this answer
MYSQL was hacked at the weekend - by SQL injection - – Mapperz Mar 28 '11 at 15:27

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).

share|improve this answer
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 posting your answer, you agree to the privacy policy and terms of service.

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