It is possible to connect a WMS layer to a SQL database or other type of database?

Example: I have created an application with GeoServer and OpenLayers. Now I can see the data from attribute table. But can I make the SHP layer to connect to a SQL database by a custom ID? I want to use this to update some data directly from SQL. After the update was made, I can see in GeoServer the data updated.

  • Would you be able to edit your question to indicate whether you are using OpenLayers 2 or OpenLayers 3, please? – PolyGeo Mar 26 '15 at 21:11
  • I am using OpenLayers2 – Sasu Andrei Mar 27 '15 at 18:21

I'm not sure I understand your question, but GeoServer has a SQL Server Plugin: http://docs.geoserver.org/stable/en/user/data/database/sqlserver.html if that is what you are after. It comes with PostgreSQL database support natively.

  • In QGIS, you have a shapefile and you create a ID for each polygon. With that ID you can bring data in attribute table with a CSV file using JOIN. The CSV file must contain that ID from shapefile. In QGIS, I managed to insert a DBF file and make a join with shapefile. Everytime I update the DBF file, the attribute table of the shapefile is updated in real-time. I wondered if it is possible to use same operations or schema in Geoserver and Openlayers. – Sasu Andrei Mar 27 '15 at 18:24

If you want to update a database through some application, and that database is the source of a WMS provided by GeoServer accessed by OpenLayers, then Yes it is possible, as per the answer provided by @maw269.

If you want users to be able to edit the data in the database through OpenLayers, then that is also possible, but not using WMS, for that you will need a WFS-T service, which can be provided by GeoServer.

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.