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

I am new to OpenLayers. I am trying to load data from a datasource and show it on a OSM map, then also add the functions such as tagging and making new features as well as editing their attributes. My questions are:

1- whats the best (efficient in means of speed) solution for data storage? should i store data in DBMS such as MySQL, or how is to store points in XML (GML) file and read and write the file?? How many users can load and save xml files at the same time?

2- If I want to do it with xml, how can I do it? any good posts that explain this?


share|improve this question
Too many questions. Start by researching what is the role of openlayers, and how apps are stacked to produce web – Pablo Oct 4 '12 at 12:27
postgis is a good choice of backend database - it spatial and can do many server-sided geo-processing functions and return xml – Mapperz Oct 4 '12 at 13:36

As you know OpenLayers is based on JavaScript with 0 server-side scripting languages (PHP,Python) used. you cannot directly read a database.

For option 1: (database) you can use db in OpenLayers indirectly. you need to have a OGC WFS-T implementation. you can use lightweight libs such as tinyOWS or heavy ones such as GeoServer and MapServer. setup Postgis and create the layer in db.

Now OpenLayers can access those layers from db using your WFS service.

You can get a nice tutorial to setup postGIS and use OpenLayers to render the layer using tinyOWS here.

Rendering GML is pretty easy and you can find direct examples on As I stated in the first line OpenLayers's Javascript nature force it to load all features from the map on client side. So if you have "big data" this will be a problem in both cases(GML/postGIS), but OpenLayers provides some strategy for rendering.

In my opinion OpenLayers is perfect for rendering WMS and small vector layers. To help with large data they are using strategies.

You can check for JS xml parser for parsing gml. By the way, GML is a standard so most of the parsers follow a similar method. OpenLayers have a class called see API documentation for docs/files/OpenLayers/Format/GML-js.html. You dont need to have a custom parser if its a standard GML file. OpenLayers will read and provide you access to features and geometry in the layer.

share|improve this answer

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.