From: Edwin C. <com...@gm...> - 2010-02-04 17:54:25
|
Hi Robert, The WFS functionality is a recent contribution by Dave, maybe he recognizes the problem easily. I still need to get working on a Java port of the Open Proxy that is necessary for the WFS functionality and that is included in the OpenLayers examples. How are you running your code? Is the Python Open Proxy implementation up? The dev list is not publicly visible as far as I am aware, but I have cc'd this reply to the devl list. Greetings, Edwin On 4 February 2010 16:54, Robert Light <rob...@ve...> wrote: > Edwin, > > I think I've found a bug either in openlayers or in gwt-openlayers code. > > if I create a WFS layer: > WFSParams wfsParams = new WFSParams(); > wfsParams.setTypename("topp:states"); > WFSOptions wfsLayerOptions = new WFSOptions(); > wfsLayerOptions.setTransitionEffect(TransitionEffect.RESIZE); > wfsLayerOptions.setExtractAttributes(true); > > WFS wfsLayer = new WFS( > "states", > "http://192.168.1.167:8080/geoserver/wfs", > wfsParams, > wfsLayerOptions); > > and then I want to get selection events so I do: > > wfsLayer.addVectorFeatureSelectedListener( new > VectorFeatureSelectedListener() { > > public void onFeatureSelected(FeatureSelectedEvent > eventObject) { > JSONObject map = new > JSONObject(eventObject.getVectorFeature().getJSObject().getProperty("attributes")); > System.out.println("Feature.id = > "+eventObject.getVectorFeature().getId()); > for( String key : map.keySet()) { > System.out.println(key+"="+map.get(key)); > } > } > }); > > This does not work... my VectorFeatureSelectListener never get's called. > > To make this work, I had to add the following: > SelectFeatureOptions selectFeatureOptions = new > SelectFeatureOptions(); > selectFeatureOptions.onSelect( new > SelectFeature.SelectFeatureListener() { > > public void onFeatureSelected(VectorFeature vectorFeature) { > JSONObject map = new > JSONObject(vectorFeature.getJSObject().getProperty("attributes")); > for( String key : map.keySet()) { > System.out.println(key+"="+map.get(key)); > } > } > }); > > SelectFeature selfeature = new SelectFeature(wfsLayer, > selectFeatureOptions); > map.getMap().addControl(selfeature); > selfeature.activate(); > > > And now BOTH my VectureFeatureSelectListener AND my SelectFeatureListener > get called when I select a feature. > > To put another wrinkle in the puzzle....instead of adding the SelectFeature > Control as above, I do just the following: > > SelectFeature selfeature = new SelectFeature(wfsLayer); > map.getMap().addControl(selfeature); > selfeature.activate(); > > My VectorFeatureSelectListener does NOT get called. > > Any ideas? Is there a developer's list I should post this query to? > > Note, I'm working off the latest set of sources that I downloaded via > mercurial. > > many thanks. > > - Bob Light > > |
From: Edwin C. <com...@gm...> - 2010-02-05 09:21:35
|
Hi Bob and Dave and GWT-OL devls, For all on the gwt-openlayers-devl list: IF NO ONE OBJECTS I WILL REMOVE THE WFS LAYER CLASSES FROM THE CODEBASE, AND CREATE A WFSPROTOCOL EXAMPLE, WHICH DOCUMENTS WHY WFS SHOULD BE DONE THAT WAY. (see below) First of all, great that it' s working now. Dave, thanks for your clever analysis of the problem. WFS indeed extends the Vector class. This was done, because in OpenLayers the WFS class inherits both from the Markers Layer and from the Vector Layer, but it seemed to me to have more Vector Layer qualities than Marker Layer qualities and since multiple inheritance is not possible in Java I let WFS extend VectorFeature. See the OL UML diagram about this: http://trac.openlayers.org/attachment/wiki/UML/ClassDiagram_OL2.7RC2-20080916.pdf Notice that according to the way it is organized in OpenLayers the WFS class indeed inherits the event "featureselected" from the Vector Layer. This is the same event the SelectFeature control will register itself for, as you pass it the Vector Layer. All of the OpenLayers WFS examples on dev seem to use the WFSProtocol (http://openlayers.org/dev/examples/ and filter on WFS), also the wfs-states example, which uses a WFS layer in the examples bundled with 2.8. The WFSProtocol should cover everything that you want to do with WFS. I am now on the track that we should deliberately not implement the WFS layer at all, especially since the dev example don't seem to use it also and an OpenLayers committer I know confided to me that the WFS layer is indeed a legacy construct that is superseded by WFSProtocol. Added bonus: It makes the libary leaner if we can omit WFS layer and use WFSProtocol. The issue you are describing with the SelectFeature Control listener versus the Vector Layer listener could also occur with a plain Vector layer it seems, as there are apparently two ways to add a "featureselected" listener. I did indeed add some classes for WFS, but hadn't come round to really wrapping the WFS stuff. Sorry, about the confusion around that. Bob, in the example code you send I saw you created a WFSParam object and a WFSOptions object, which are just empty stubs in the current Hg repo. So that's why I assumed you filled in the WFS stubs (even though it has my name above it). Sorry for putting you on the wrong track by including the WFS stubs. Greetings, Edwin On 5 February 2010 07:38, Robert Light <rob...@ve...> wrote: > Dave, > > Thanks for the analysis...this seems to explain the behavior I was seeing > from my side. I ultimately did as you suggested and created the WFS layer > with the SelectFeature control... with the SelectFeatureOptions setup > properly. > > Things are good now ...but clearly I managed to step into a tarpit which was > sort of "mystical" on why it behaved the way it did. > > We too will be having a huge number of features and will shift to using a > WMS server to paint the tiles and download it to the client... this makes it > easy to pass selection events back to the server and have the server figure > out what got clicked. > > - Bob > > Dave Koberstein wrote: > > Hi Guys, > > Sorry for the slow response. > > I haven't actually used WFS layer. In our case we have tons of features. > So I use a WMS layer to get an image of the features. Then I recently > implemented Control.GetFeature to request via WFSProtocol the features the > server returns in a bbox as described by the WMS layer. Upon callback one > can do as they wish, include adding VectorFeature()'s to a Vector Layer > (which I've done). I'm currently using markers and popups but maybe I > should look at a vector layer and vectorfeature. > > I think there may be a combination that shouldn't be allowed in the > gwt-openlayers. It looks like VectorFeatureSelected ultimately is looking > for a 'featureselected' event in OpenLayers. Layer/Vector.js will generate > that but Layer/WFS.js will not (looking at the openlayers source). > > I see that SelectFeature also can generate 'featureselected'. So apparently > when you have the SelectFeature control setup you then get 'featureselected' > events and you've got two listeners for that event. > > I think what you really want is WFS layer and SelectFeature control on that > layer. When your page loads the WFS layer gets loaded with features that > you can then select. > > VectorFeature seems only associated with vector layers. Perhaps our WFS > class shouldn't extend the Vector class like it does now. It's allowing > combinations that can't happen. > > Anyway, that's all I can come up with by looking at the code. > > Davek > > > > > On 2/4/2010 9:54 AM, Edwin Commandeur wrote: > > Hi Robert, > > The WFS functionality is a recent contribution by Dave, maybe he > recognizes the problem easily. I still need to get working on a Java > port of the Open Proxy that is necessary for the WFS functionality and > that is included in the OpenLayers examples. > > How are you running your code? Is the Python Open Proxy implementation up? > > The dev list is not publicly visible as far as I am aware, but I have > cc'd this reply to the devl list. > > Greetings, > Edwin > > > On 4 February 2010 16:54, Robert Light<rob...@ve...> wrote: > > > Edwin, > > I think I've found a bug either in openlayers or in gwt-openlayers code. > > if I create a WFS layer: > WFSParams wfsParams = new WFSParams(); > wfsParams.setTypename("topp:states"); > WFSOptions wfsLayerOptions = new WFSOptions(); > wfsLayerOptions.setTransitionEffect(TransitionEffect.RESIZE); > wfsLayerOptions.setExtractAttributes(true); > > WFS wfsLayer = new WFS( > "states", > "http://192.168.1.167:8080/geoserver/wfs", > wfsParams, > wfsLayerOptions); > > and then I want to get selection events so I do: > > wfsLayer.addVectorFeatureSelectedListener( new > VectorFeatureSelectedListener() { > > public void onFeatureSelected(FeatureSelectedEvent > eventObject) { > JSONObject map = new > JSONObject(eventObject.getVectorFeature().getJSObject().getProperty("attributes")); > System.out.println("Feature.id = > "+eventObject.getVectorFeature().getId()); > for( String key : map.keySet()) { > System.out.println(key+"="+map.get(key)); > } > } > }); > > This does not work... my VectorFeatureSelectListener never get's called. > > To make this work, I had to add the following: > SelectFeatureOptions selectFeatureOptions = new > SelectFeatureOptions(); > selectFeatureOptions.onSelect( new > SelectFeature.SelectFeatureListener() { > > public void onFeatureSelected(VectorFeature vectorFeature) > { > JSONObject map = new > JSONObject(vectorFeature.getJSObject().getProperty("attributes")); > for( String key : map.keySet()) { > System.out.println(key+"="+map.get(key)); > } > } > }); > > SelectFeature selfeature = new SelectFeature(wfsLayer, > selectFeatureOptions); > map.getMap().addControl(selfeature); > selfeature.activate(); > > > And now BOTH my VectureFeatureSelectListener AND my SelectFeatureListener > get called when I select a feature. > > To put another wrinkle in the puzzle....instead of adding the SelectFeature > Control as above, I do just the following: > > SelectFeature selfeature = new SelectFeature(wfsLayer); > map.getMap().addControl(selfeature); > selfeature.activate(); > > My VectorFeatureSelectListener does NOT get called. > > Any ideas? Is there a developer's list I should post this query to? > > Note, I'm working off the latest set of sources that I downloaded via > mercurial. > > many thanks. > > - Bob Light > > > > |
From: Edwin C. <com...@gm...> - 2010-02-05 09:45:02
|
Hi Robert, Great you found that piece of proxy code. I will put the code in and try to find out who I should attribute or I will include a ref to: http://trac.openlayers.org/browser/sandbox/august/openlayers/2.8%2B/lib/OpenLayers/Util/openlayers-proxy.jsp That is the code which I would like to take as a starting point. The code is very useful and we can slash out the couple of jsp only lines and start adding functionality so you can add a white list of servers as in the Python proxy (even though in practice I think there are more use cases for connecting to arbitrary WFS servers). Greetings, Edwin On 5 February 2010 07:31, Robert Light <rob...@ve...> wrote: > The proxy code originally came from the openlayers jsp proxy example. I > can't be sure...but here is clearly where most of the code started from: > > http://trac.openlayers.org/changeset/8099/sandbox?format=diff&new=8099 > > - Bob > > Edwin Commandeur wrote: > > Hi Bob, > > I wrongly presumed that Dave added code for the WFS Layer, but it was > for the WFSProtocol. I found out when making a start on adding a WFS > example. > > It seems to me then that the WFS implementation is yours. Would you > feel comfortable adding that to the codebase? If so, then I will add > you as a developer. Alternatively, you can send me the files and I > will make sure they make it into the codebase promptly. > > Coming monday I hope to have a bit of time to see what needs to be > done to get a new GWT-OL release out shortly and it would be nice if > the WFS stuff can be in it. > > Greetings, > Edwin > > > On 5 February 2010 01:14, Edwin Commandeur <com...@gm...> > wrote: > > > Hi Bob, > > That's great that you have already have some proxy code. Would you > mind if I merge that into GWT-OL? It looks just fine for our purposes. > > I would really have to dive into the WFS stuff to see what's going on. > > I will make it high priority to add a WFS example, so I can try to > reproduce what's going on. Sorry that I cannot help you on a shorter > notice. > > Greetings, > Edwin > > On 4 February 2010 19:33, Robert Light <rob...@ve...> wrote: > > > To proxy, I just used the servlet (see attached) which worked just fine for > me. > > - Bob > > Edwin Commandeur wrote: > > Hi Robert, > > The WFS functionality is a recent contribution by Dave, maybe he > recognizes the problem easily. I still need to get working on a Java > port of the Open Proxy that is necessary for the WFS functionality and > that is included in the OpenLayers examples. > > How are you running your code? Is the Python Open Proxy implementation up? > > The dev list is not publicly visible as far as I am aware, but I have > cc'd this reply to the devl list. > > Greetings, > Edwin > > > On 4 February 2010 16:54, Robert Light <rob...@ve...> wrote: > > > Edwin, > > I think I've found a bug either in openlayers or in gwt-openlayers code. > > if I create a WFS layer: > WFSParams wfsParams = new WFSParams(); > wfsParams.setTypename("topp:states"); > WFSOptions wfsLayerOptions = new WFSOptions(); > wfsLayerOptions.setTransitionEffect(TransitionEffect.RESIZE); > wfsLayerOptions.setExtractAttributes(true); > > WFS wfsLayer = new WFS( > "states", > "http://192.168.1.167:8080/geoserver/wfs", > wfsParams, > wfsLayerOptions); > > and then I want to get selection events so I do: > > wfsLayer.addVectorFeatureSelectedListener( new > VectorFeatureSelectedListener() { > > public void onFeatureSelected(FeatureSelectedEvent > eventObject) { > JSONObject map = new > JSONObject(eventObject.getVectorFeature().getJSObject().getProperty("attributes")); > System.out.println("Feature.id = > "+eventObject.getVectorFeature().getId()); > for( String key : map.keySet()) { > System.out.println(key+"="+map.get(key)); > } > } > }); > > This does not work... my VectorFeatureSelectListener never get's called. > > To make this work, I had to add the following: > SelectFeatureOptions selectFeatureOptions = new > SelectFeatureOptions(); > selectFeatureOptions.onSelect( new > SelectFeature.SelectFeatureListener() { > > public void onFeatureSelected(VectorFeature vectorFeature) { > JSONObject map = new > JSONObject(vectorFeature.getJSObject().getProperty("attributes")); > for( String key : map.keySet()) { > System.out.println(key+"="+map.get(key)); > } > } > }); > > SelectFeature selfeature = new SelectFeature(wfsLayer, > selectFeatureOptions); > map.getMap().addControl(selfeature); > selfeature.activate(); > > > And now BOTH my VectureFeatureSelectListener AND my SelectFeatureListener > get called when I select a feature. > > To put another wrinkle in the puzzle....instead of adding the SelectFeature > Control as above, I do just the following: > > SelectFeature selfeature = new SelectFeature(wfsLayer); > map.getMap().addControl(selfeature); > selfeature.activate(); > > My VectorFeatureSelectListener does NOT get called. > > Any ideas? Is there a developer's list I should post this query to? > > Note, I'm working off the latest set of sources that I downloaded via > mercurial. > > many thanks. > > - Bob Light > > > > > > > > |
From: Edwin C. <com...@gm...> - 2010-02-05 10:14:46
|
ESRI also has a proxy.jsp for download: http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/gmaps/help/google_start.htm#topics/ags_proxy.html Amazing that al these people use a jsp for the proxying. Possible, because it does not have to be configured in web.xml like a servlet. To my mind a servlet would seem more logical. Any thoughts anyone? Greetings, Edwin On 5 February 2010 10:36, Edwin Commandeur <com...@gm...> wrote: > Hi Robert, > > Great you found that piece of proxy code. I will put the code in and > try to find out who I should attribute or I will include a ref to: > http://trac.openlayers.org/browser/sandbox/august/openlayers/2.8%2B/lib/OpenLayers/Util/openlayers-proxy.jsp > > That is the code which I would like to take as a starting point. > > The code is very useful and we can slash out the couple of jsp only > lines and start adding functionality so you can add a white list of > servers as in the Python proxy (even though in practice I think there > are more use cases for connecting to arbitrary WFS servers). > > Greetings, > Edwin > > On 5 February 2010 07:31, Robert Light <rob...@ve...> wrote: >> The proxy code originally came from the openlayers jsp proxy example. I >> can't be sure...but here is clearly where most of the code started from: >> >> http://trac.openlayers.org/changeset/8099/sandbox?format=diff&new=8099 >> >> - Bob >> >> Edwin Commandeur wrote: >> >> Hi Bob, >> >> I wrongly presumed that Dave added code for the WFS Layer, but it was >> for the WFSProtocol. I found out when making a start on adding a WFS >> example. >> >> It seems to me then that the WFS implementation is yours. Would you >> feel comfortable adding that to the codebase? If so, then I will add >> you as a developer. Alternatively, you can send me the files and I >> will make sure they make it into the codebase promptly. >> >> Coming monday I hope to have a bit of time to see what needs to be >> done to get a new GWT-OL release out shortly and it would be nice if >> the WFS stuff can be in it. >> >> Greetings, >> Edwin >> >> >> On 5 February 2010 01:14, Edwin Commandeur <com...@gm...> >> wrote: >> >> >> Hi Bob, >> >> That's great that you have already have some proxy code. Would you >> mind if I merge that into GWT-OL? It looks just fine for our purposes. >> >> I would really have to dive into the WFS stuff to see what's going on. >> >> I will make it high priority to add a WFS example, so I can try to >> reproduce what's going on. Sorry that I cannot help you on a shorter >> notice. >> >> Greetings, >> Edwin >> >> On 4 February 2010 19:33, Robert Light <rob...@ve...> wrote: >> >> >> To proxy, I just used the servlet (see attached) which worked just fine for >> me. >> >> - Bob >> >> Edwin Commandeur wrote: >> >> Hi Robert, >> >> The WFS functionality is a recent contribution by Dave, maybe he >> recognizes the problem easily. I still need to get working on a Java >> port of the Open Proxy that is necessary for the WFS functionality and >> that is included in the OpenLayers examples. >> >> How are you running your code? Is the Python Open Proxy implementation up? >> >> The dev list is not publicly visible as far as I am aware, but I have >> cc'd this reply to the devl list. >> >> Greetings, >> Edwin >> >> >> On 4 February 2010 16:54, Robert Light <rob...@ve...> wrote: >> >> >> Edwin, >> >> I think I've found a bug either in openlayers or in gwt-openlayers code. >> >> if I create a WFS layer: >> WFSParams wfsParams = new WFSParams(); >> wfsParams.setTypename("topp:states"); >> WFSOptions wfsLayerOptions = new WFSOptions(); >> wfsLayerOptions.setTransitionEffect(TransitionEffect.RESIZE); >> wfsLayerOptions.setExtractAttributes(true); >> >> WFS wfsLayer = new WFS( >> "states", >> "http://192.168.1.167:8080/geoserver/wfs", >> wfsParams, >> wfsLayerOptions); >> >> and then I want to get selection events so I do: >> >> wfsLayer.addVectorFeatureSelectedListener( new >> VectorFeatureSelectedListener() { >> >> public void onFeatureSelected(FeatureSelectedEvent >> eventObject) { >> JSONObject map = new >> JSONObject(eventObject.getVectorFeature().getJSObject().getProperty("attributes")); >> System.out.println("Feature.id = >> "+eventObject.getVectorFeature().getId()); >> for( String key : map.keySet()) { >> System.out.println(key+"="+map.get(key)); >> } >> } >> }); >> >> This does not work... my VectorFeatureSelectListener never get's called. >> >> To make this work, I had to add the following: >> SelectFeatureOptions selectFeatureOptions = new >> SelectFeatureOptions(); >> selectFeatureOptions.onSelect( new >> SelectFeature.SelectFeatureListener() { >> >> public void onFeatureSelected(VectorFeature vectorFeature) { >> JSONObject map = new >> JSONObject(vectorFeature.getJSObject().getProperty("attributes")); >> for( String key : map.keySet()) { >> System.out.println(key+"="+map.get(key)); >> } >> } >> }); >> >> SelectFeature selfeature = new SelectFeature(wfsLayer, >> selectFeatureOptions); >> map.getMap().addControl(selfeature); >> selfeature.activate(); >> >> >> And now BOTH my VectureFeatureSelectListener AND my SelectFeatureListener >> get called when I select a feature. >> >> To put another wrinkle in the puzzle....instead of adding the SelectFeature >> Control as above, I do just the following: >> >> SelectFeature selfeature = new SelectFeature(wfsLayer); >> map.getMap().addControl(selfeature); >> selfeature.activate(); >> >> My VectorFeatureSelectListener does NOT get called. >> >> Any ideas? Is there a developer's list I should post this query to? >> >> Note, I'm working off the latest set of sources that I downloaded via >> mercurial. >> >> many thanks. >> >> - Bob Light >> >> >> >> >> >> >> >> > |
From: Edwin C. <com...@gm...> - 2010-02-05 10:16:20
|
Hi Bob, I wrongly presumed that Dave added code for the WFS Layer, but it was for the WFSProtocol. I found out when making a start on adding a WFS example. It seems to me then that the WFS implementation is yours. Would you feel comfortable adding that to the codebase? If so, then I will add you as a developer. Alternatively, you can send me the files and I will make sure they make it into the codebase promptly. Coming monday I hope to have a bit of time to see what needs to be done to get a new GWT-OL release out shortly and it would be nice if the WFS stuff can be in it. Greetings, Edwin On 5 February 2010 01:14, Edwin Commandeur <com...@gm...> wrote: > Hi Bob, > > That's great that you have already have some proxy code. Would you > mind if I merge that into GWT-OL? It looks just fine for our purposes. > > I would really have to dive into the WFS stuff to see what's going on. > > I will make it high priority to add a WFS example, so I can try to > reproduce what's going on. Sorry that I cannot help you on a shorter > notice. > > Greetings, > Edwin > > On 4 February 2010 19:33, Robert Light <rob...@ve...> wrote: >> To proxy, I just used the servlet (see attached) which worked just fine for >> me. >> >> - Bob >> >> Edwin Commandeur wrote: >> >> Hi Robert, >> >> The WFS functionality is a recent contribution by Dave, maybe he >> recognizes the problem easily. I still need to get working on a Java >> port of the Open Proxy that is necessary for the WFS functionality and >> that is included in the OpenLayers examples. >> >> How are you running your code? Is the Python Open Proxy implementation up? >> >> The dev list is not publicly visible as far as I am aware, but I have >> cc'd this reply to the devl list. >> >> Greetings, >> Edwin >> >> >> On 4 February 2010 16:54, Robert Light <rob...@ve...> wrote: >> >> >> Edwin, >> >> I think I've found a bug either in openlayers or in gwt-openlayers code. >> >> if I create a WFS layer: >> WFSParams wfsParams = new WFSParams(); >> wfsParams.setTypename("topp:states"); >> WFSOptions wfsLayerOptions = new WFSOptions(); >> wfsLayerOptions.setTransitionEffect(TransitionEffect.RESIZE); >> wfsLayerOptions.setExtractAttributes(true); >> >> WFS wfsLayer = new WFS( >> "states", >> "http://192.168.1.167:8080/geoserver/wfs", >> wfsParams, >> wfsLayerOptions); >> >> and then I want to get selection events so I do: >> >> wfsLayer.addVectorFeatureSelectedListener( new >> VectorFeatureSelectedListener() { >> >> public void onFeatureSelected(FeatureSelectedEvent >> eventObject) { >> JSONObject map = new >> JSONObject(eventObject.getVectorFeature().getJSObject().getProperty("attributes")); >> System.out.println("Feature.id = >> "+eventObject.getVectorFeature().getId()); >> for( String key : map.keySet()) { >> System.out.println(key+"="+map.get(key)); >> } >> } >> }); >> >> This does not work... my VectorFeatureSelectListener never get's called. >> >> To make this work, I had to add the following: >> SelectFeatureOptions selectFeatureOptions = new >> SelectFeatureOptions(); >> selectFeatureOptions.onSelect( new >> SelectFeature.SelectFeatureListener() { >> >> public void onFeatureSelected(VectorFeature vectorFeature) { >> JSONObject map = new >> JSONObject(vectorFeature.getJSObject().getProperty("attributes")); >> for( String key : map.keySet()) { >> System.out.println(key+"="+map.get(key)); >> } >> } >> }); >> >> SelectFeature selfeature = new SelectFeature(wfsLayer, >> selectFeatureOptions); >> map.getMap().addControl(selfeature); >> selfeature.activate(); >> >> >> And now BOTH my VectureFeatureSelectListener AND my SelectFeatureListener >> get called when I select a feature. >> >> To put another wrinkle in the puzzle....instead of adding the SelectFeature >> Control as above, I do just the following: >> >> SelectFeature selfeature = new SelectFeature(wfsLayer); >> map.getMap().addControl(selfeature); >> selfeature.activate(); >> >> My VectorFeatureSelectListener does NOT get called. >> >> Any ideas? Is there a developer's list I should post this query to? >> >> Note, I'm working off the latest set of sources that I downloaded via >> mercurial. >> >> many thanks. >> >> - Bob Light >> >> >> >> >> > |