I have openlayers, geoserver and postgis/postgres working quite nicely. I'm trying to create an app that allows a user to add a point to a map. After the point is created, I need a popup form to show with various controls that allows the user to input info about the location the point has been added to.

With postgis, do I create a seperate table to hold the user input based on the p key of the added point? Seems like a good idea to me, but I noticed the featureadded event of openlayers is triggered before the point is added to the database. Can I use geoserver to handle saving the user input, or do I need to create my own module to handle user input?

有帮助吗?

解决方案

'featureadded' event in OpenLayers is totally client-side that occurs when you add feature to a vector layer. It has no idea whether you save feature to the database or not.

Why don't you do it like this:

  1. User adds point to a map.
  2. On 'featureadded' event you show a popup with input fields and 'Save' button
  3. When user clicks 'Save' you save both point and input data using OpenLayers.Strategy.Save() via WFS-T
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top