|
|
|
totom
|
Hi evrybody, I have some problems after upgrading form Geoserver 1.7.3 to 2.0
I have a vector layer (i'm using vectro instead wfs to use custom filters instead of BBOX) so defined: var fixedStrategy = new OpenLayers.Strategy.Fixed(); poly = new OpenLayers.Layer.Vector ( 'Pippo', { strategies: [fixedStrategy,saveStrategy ], projection: new OpenLayers.Projection("EPSG:4326"), styleMap: stylemm, outputFormat:'json', protocol: new OpenLayers.Protocol.WFS.v1_1_0( { version: '1.1.0', srsName: 'EPSG:4326', url: 'http://$151.100.152.220/geoserver2/wfs', featureType: 'urbis_dev:data_crash_feature', geometryName: 'the_geom', extractAttribute: true }), getFeatureByFid: function(fid) { var layer = this; if (!layer) return null; var features = layer.features; if (!features)return null; for (var i = 0; i < features.length; ++i) if (features[i].fid == fid) return features[i]; return null; } } ); map.addLayer(poly); It used to work, but after upgrading Openlayers seems to not parse the geoserver response. The server will response with correct xml (i think gml3...possible?), but if I make poly.features.length, it will return 0 instead of 3 (i have 3 features) Has anybody any ideas? maybe I have to specify the format of the response? In case, where? Thanks in advance... ps: there is a $ in the url because the request is proxied by a script that replace it with the user credential for geoserver autentication.... |
||||||||||||||||
|
totom
|
I have 2 namespaces in geoserver, urbis_2 and urbis_dev
With urbis_2 ns and prefix, openlayers parses the gml and i see the features on the map. If i use urbis_dev, geoserver replies with a (correct?) xml, but openlayers does not parse it. This is the js code poly = new OpenLayers.Layer.Vector ( 'Pippo', { strategies: [fixedStrategy,saveStrategy ], projection: new OpenLayers.Projection("EPSG:4326"), styleMap: stylemm, protocol: new OpenLayers.Protocol.WFS.v1_1_0( { version: '1.1.0', srsName: 'EPSG:4326', url: 'http://$151.100.152.220/geoserver2/wfs', featureType: 'pippo', featureNS : 'http://151.100.152.220/urbis_dev/', featurePrefix: 'urbis_dev', geometryName: 'the_geom', extractAttribute: true } ), getFeatureByFid: function(fid) { var layer = this; if (!layer) return null; var features = layer.features; if (!features)return null; for (var i = 0; i < features.length; ++i) if (features[i].fid == fid) return features[i]; return null; } } ); This is se response after requesting features in urbis_dev....where is the problem? <?xml version="1.0" encoding="UTF-8"?> <wfs:FeatureCollection numberOfFeatures="2" timeStamp="2009-11-05T11:16:35.348+01:00" xsi:schemaLocation="http://151.100.152.220/urbis_dev http://151.100.152.220:8090/geoserver/wfs?service=WFS&version=1.1.0&request=DescribeFeatureType&typeName=urbis_dev%3Adata_crash_feature http://www.opengis.net/wfs http://151.100.152.220:8090/geoserver/schemas/wfs/1.1.0/wfs.xsd" xmlns:ogc="http://www.opengis.net/ogc" xmlns:urbis_2="http://151.100.152.220/urbis_2/" xmlns:tiger="http://www.census.gov" xmlns:urbis_dev="http://151.100.152.220/urbis_dev" xmlns:wfs="http://www.opengis.net/wfs" xmlns:topp="http://www.openplans.org/topp" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sf="http://www.openplans.org/spearfish" xmlns:ows="http://www.opengis.net/ows" xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink"> <gml:featureMembers> <urbis_dev:data_crash_feature gml:id="data_crash_feature.55"> <gml:description>rosso</gml:description> <urbis_dev:_status>1</urbis_dev:_status> <urbis_dev:_type>1</urbis_dev:_type> <urbis_dev:_hide>n</urbis_dev:_hide> <urbis_dev:_fid>589</urbis_dev:_fid> <urbis_dev:_author>pippo</urbis_dev:_author> <urbis_dev:_ctime>1252857959</urbis_dev:_ctime> <urbis_dev:description>rosso</urbis_dev:description> <urbis_dev:datetime>1252857959</urbis_dev:datetime> <urbis_dev:injuried>1</urbis_dev:injuried> <urbis_dev:dead>0</urbis_dev:dead> <urbis_dev:veic>0</urbis_dev:veic> <urbis_dev:the_geom> <gml:MultiPoint srsName="http://www.opengis.net/gml/srs/epsg.xml#4326"> <gml:pointMember> <gml:Point> <gml:pos>12.467980384826 41.919139792195</gml:pos> </gml:Point> </gml:pointMember> </gml:MultiPoint> </urbis_dev:the_geom> </urbis_dev:data_crash_feature> <urbis_dev:data_crash_feature gml:id="data_crash_feature.61"> <gml:description>bbbbbb658546</gml:description> <urbis_dev:_status>1</urbis_dev:_status> <urbis_dev:_type>1</urbis_dev:_type> <urbis_dev:_hide>n</urbis_dev:_hide> <urbis_dev:_fid>680</urbis_dev:_fid> <urbis_dev:_author>tommaso</urbis_dev:_author> <urbis_dev:_ctime>1253631099</urbis_dev:_ctime> <urbis_dev:description>bbbbbb658546</urbis_dev:description> <urbis_dev:datetime>1254063099</urbis_dev:datetime> <urbis_dev:injuried>5</urbis_dev:injuried> <urbis_dev:dead>10</urbis_dev:dead> <urbis_dev:veic>55</urbis_dev:veic> <urbis_dev:the_geom> <gml:MultiPoint srsName="http://www.opengis.net/gml/srs/epsg.xml#4326"> <gml:pointMember> <gml:Point> <gml:pos>12.4915369 41.9045518</gml:pos> </gml:Point> </gml:pointMember> </gml:MultiPoint> </urbis_dev:the_geom> </urbis_dev:data_crash_feature> </gml:featureMembers> </wfs:FeatureCollection> |
||||||||||||||||
| Free Embeddable Forum Powered by Nabble | Help |