[TinyOWS-users] Problem inserting features

Brian May bmay at mapwise.com
Wed Sep 21 09:16:28 EST 2011


Success in OpenLayers! Insert, modify, delete.

I did run into a few more hurdles along the way. For example, in 
OpenLayers, I had set the OpenLayers.Handler.Path multi property to true 
(multi:true) and OL was sending MultiLineStrings to tinyows, which 
dutifully passed them on to postgis, which then returned a geometry 
constraint error, because my table had been set to only allow 
LineStrings. Removed the constraint and it was fine (or I could have 
modified the constraint). And I tried to get fancy with styling the 
vectors too early in the game and found that 
OpenLayers.Control.ModifyFeature and the custom control DeleteFeature 
were not seeming to work - take out the custom style and it works.

Just a few quick pointers for anyone struggling with this (as mentioned 
before by others, just in my own words here):

1) Use the linux version of tinyows from SVN until the stable version 
comes out.
2) First get WFS working via tinyows using the sample data and QGIS as a 
client.
3) For OpenLayers, get the sample OL code working with the sample data 
first.
4) Use FireFox + Firebug for debugging - its better than Chrome because 
of the nice XML formatting FireFox does, i.e. its easier to understand 
the XML.
5) Use a "clean" custom data set to start testing with in QGIS and WFS, 
i.e. create a shapefile in your desired projection, put some dummy 
features in it, load it into postgres. Don't use 900913 as the 
projection for your data.
6) Then move on to OL using your custom data set.
7) Go very slowly and methodically with each change made to your OL 
code. Write each change in a changelog documenting your changes and the 
results. Don't try updating multiple parts of the code at once, i..e 
adding styling before you know the basics are working.
8) Log files are your friends - tinyows.log, apache access and error 
logs, postgres logs.
9) Use PGAdmin to double-check your SRS defs in the spatial_ref_sys and 
geometry columns tables. You must have your layer present in 
geometry_columns.
10) If you are getting constraint errors from postgres, make a copy the 
constraint definitions, then remove them, and see what is being sent to 
the server. Utilize postgis functions such as ST_SRID and 
ST_GeometryType to see what was written to your table record and/or what 
is currently in your table. Make changes to either the OL side or the 
postgres side accordingly.
11) A missing or extra slash, comma, etc can ruin a couple hours of your 
life.

Thanks everyone for your help!

More comments inline below:


On 9/20/2011 5:55 PM, Olivier Courtin wrote:
> Hi Brian,
>> I did with the pure windows stack which used tinyows 1rc3, and that is
>> when I was getting "premature end of script headers" on inserts.
> Ok do you have a way to check it with an Unix like,
> and to use the latest SVN version ?
>
> It should be the right way to do it,
> till the next stable version coming quite soon.
I started my testing on Windows with tinyows 1rc3 binary from MS4W, then 
switched to Linux and the latest SVN version where I found success after 
fixing my tinyows, postgres, and OL mistakes.
>
>>> So i'm curious about how you are exactly able to obtain a HTTO 500 error type.
>> OK, OpenLayers has a parameter for the geometry column, so I thought it
>> may mean something to tinyows. I just realized i am using OL 2.11rc4, so
>> will try more tests with stable 2.11.
> Could you provide the HTTP request sended by OL ?
> (you could use Firebug or TinyOWS log to catch it)
>
The HTTP 500 error was happening using the Windows tinyows 1rc3 version, 
so maybe I should wait to retest until a more recent Windows binary is 
produced. I didn't try to compile it myself.
>
>> I'll keep banging away at it and keep you posted. One thing I may be
>> able to help with in the end is some kind of trouble-shooting tips.
>> Seems like I've hit about as many pitfalls as you can. There are a lot
>> of good references in the mailing list archives, but its a bit
>> scattered. If you like I'll volunteer to help organize some of that into
>> the main site. I am really excited about the promise of this software,
>> especially WFS-T via OpenLayers.
> You're right there's a need to something more than only the actual docs.
> Something like a mix of a tutorial and an FAQ for instance.
> We could also imagine few webcasts.
> ...
>
> We also have to migrate the actual documentation to MapServer website
> using RST syntax<http://docutils.sourceforge.net/rst.html>
>
> If you want to initiate something you are really welcome !
>
OK, I briefly checked out the RST docs and it looks cool - I'd like to 
use something like that for my own internal docs as well. After I make 
headway on my current project, I can devote some time to this. What is 
the best way to move forward with contributing to docs?

Thanks,

Brian



More information about the TinyOWS-users mailing list