Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

When i perform wfs-t insert operation using postgis database only spatial data and primary key gets inserted.

Can anyone point me to some examples in which attribute data are also inserted along with spatial data using openlayers?

share|improve this question
    
Have you found a nice way to do this? –  Mike001 Sep 4 '12 at 11:32
    
no, i haven't. If you are an expert user then i suggest adding extra paremeters to wfs-t request. WFS-t request works fine when i add parameters manually in the xml request. but i don't know how to generate the edited XML request using openlayers. –  neogeomat Sep 5 '12 at 2:05
    
or if you are using single type of geometry only, then you can save the geometry of feature in an input element. then use php to insert it into database along with non-spatial data. my code looks like this document.getElementById('geometry').value = oFeature.geometry; to store value in element then $geom=$_POST['geometry']; to read the value into php and finally pg_query("INSERT INTO response1(responder_id, nearby_water, defect_type, geom) VALUES (".$id.",False,'".$checkbox1."',ST_GeomFromText('".$geom."', 4326))"')"); to inset it alomg with other data –  neogeomat Sep 5 '12 at 2:13
add comment

1 Answer

I have been struggling with the same issue, and so far the simple solution is to force the server side WFS-T handler (in my case tinyows v1.0.0) to ignore the schema validation. This has potential security side effects, so it is not a 'production-ready' solution, but a step in the right direction.

Looking at the generated XML, it appears that the schema for inserts and for updates is not the same, and combining them does not work.

But to recap, using check_schema="0" in the configuration file of tinyows, you can send attributes along with the spatial data and save everything in postGIS.

share|improve this answer
add comment

Your Answer

 
discard

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.