Eric Lemoine wrote: > On Monday, March 8, 2010, Stephen Woodbridge <[email protected]> wrote: >> OK, to partially answer some of my own questions ... inline below. >> >> Stephen Woodbridge wrote: >>> Hi all, >>> >>> I am trying to implement a vector layer that will allow editing point >>> data. The data is accessed via a PHP script that serves some arbitrary >>> XML. The layer looks like this so far: >>> >>> vector = new OpenLayers.Layer.Vector("POI", { >>> maxResolution: 360.0/16777216/2, // zoom 15 >>> styleMap: styleMap, >>> protocol: new OpenLayers.Protocol.HTTP({ >>> url: "poi-server.php", >>> params: { >>> m: 'r', >>> srs: 'EPSG:4326' >>> }, >>> format: new OpenLayers.Format.XML() >>> }), >>> strategies: [ >>> new OpenLayers.Strategy.BBOX({ratio: 1}), >>> new OpenLayers.Strategy.Save({ >>> auto: true//, >>> //save: function() { alert("Save called."); } >>> }), >>> ] >>> }); >>> >>> This seems like it almost works. But has the following problems, so >>> maybe I'm just taking the wrong approach all together. Here is a live >>> example: >>> >>> http://imaptools.com:8080/tilecache/test.html?zoom=17&lat=33.89595&lon=35.49935&layers=BT >>> >>> Issue: >>> >>> 1) the feature request does not seem to load on page load, but fires if >>> you pan the map slightly >>> >>> 2) when the features load, I get an error on line 128 of >>> OpenLayers/Format/XML.js because test.indexOf() is not a method. This is >>> because text is type Document not string? >> This appears to be because I need to write my own class like >> OpenLayers.Format.MyXML that parses the XML document the PHP returns and >> returns an array of features. Working on writing this. >> >>> 3) I assume the the XML parser will parse the response into an >>> appropriate tree object, then I need to add some code that reads the >>> tree and constructs feature objects that I then add to the layer. So is >>> the problem above because the text object passed to read IS my tree and >>> I need to pass a my own read() function to some code to do that? Where >>> do I do that? >> See 2) above. >> >>> 4) If I add a point using the toolbar add point button, I get >>> >>> Security error" code: "1000 >>> http://imaptools.com:8080/ol28/lib/OpenLayers/Format/XML.js >>> Line 198 >>> >>> data = serializer.serializeToString(node); >>> >>> What is this error and why am I getting it? I assumed that a default >>> serializer exists, I probably need to add my own it write the expected >>> XML the the PHP needs. Where would I add this and what are the exected >>> inputs and outputs? >> I'm hoping this is probably related to the above. will report back after >> I get my XML parser working. >> >>> 5) I eventually need to issue the Ajax requests by sending XML documents >>> to the server instead of issuing GET requests. So to do this I assume I >>> need to a) write code to serialize some params into a document, then b) >>> get HTTP protocol to send the document. How do I do this? The PHP code >>> is only temporary for testing and developing in my environment. >>> >>> I learned a lot today, just by reading lots of OL code but I still have >>> a ways to go. >>> >>> I would appreciate and help and guidance. >> Any thoughts on 1) or 5)? Just a pointer would be helpful :) > > Hi Steve. > > For 1) what version of OL are you using? I thought this issue was > fixed a while back. A test case demonstrating the problem would be > useful.
Hi Eric, I'm using OpenLayers 2.8. Did you have a chance to verify when this was fixed? Do I need to write a bug for this? I looked through the open bugs but did not see anything that fit this issue. Thanks, -Steve > For 5) the HTTP protocol has a readWithPost option that allows sending > read requests with POST instead of GET. But I don't think it'll work > in your case because you it will post encoded params, and you won't be > able to provide it with your XML document. So I think you need to > implement your own protocol, possibly by extending/overriding > Protocol.HTTP. > > Cheers, > _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
