saving user input to a postgis table strategy
I have openlayers, geoserve开发者_StackOverflowr 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:
- User adds point to a map.
- On 'featureadded' event you show a popup with input fields and 'Save' button
- When user clicks 'Save' you save both point and input data using OpenLayers.Strategy.Save() via WFS-T
精彩评论