[OpenLayers-Users] render geometry data from geoserver
Danjun
byeautumn at gmail.com
Wed Jul 27 09:58:10 EDT 2011
Hi, all
I have been stuck for several days about this problem.
1. I added a shapefile layer in the geoserver and want to render geometry
data by openlayers from this layer in the geoserver.
2. My code is like this way:
MobileTiled = new OpenLayers.Layer.WMS(
"Brandband:Other_Project - Tiled",
"http://127.0.0.1:8081/geoserver/Brandband/wms",
{
LAYERS: 'Brandband:Mobile_project',
STYLES: '',
format: format,
tiled: !pureCoverage,
tilesOrigin : map.maxExtent.left + ',' +
map.maxExtent.bottom
},
{
buffer: 0,
displayOutsideMaxExtent: true,
isBaseLayer: true
}
);
var saveStrategy = new OpenLayers.Strategy.Save();
wfslayer = new OpenLayers.Layer.Vector("WFS", {
strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
projection: new OpenLayers.Projection("EPSG:4326"),
protocol: new OpenLayers.Protocol.WFS({
url: "http://localhost:8081/geoserver/wfs",
version: "1.1.0",
srsName: "EPSG:4326",
featureNS : "Brandband",
featureType: "Mobile_project",
schema:
"http://localhost:8081/geoserver/wfs/DescribeFeatureType?version=1.1.0&typename=Brandband:Mobile_project"
}),
reportError: true,
renderers: ['Canvas', 'SVG', 'VML']
});
map.addLayers([MobileTiled, wfslayer]);
3. I also added ModifyFeature control, but can't see any features in the
wfslayer.
4. When I set url as
"http://127.0.0.1:8081/geoserver/Brandband/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=Brandband:Mobile_project&maxFeatures=50",
I can see
<wfs:FeatureCollection xmlns="http://www.opengis.net/wfs"
xmlns:wfs="http://www.opengis.net/wfs"
xmlns:Brandband="www.mbakercorp.com/Brandband"
xmlns:gml="http://www.opengis.net/gml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="www.mbakercorp.com/Brandband
http://127.0.0.1:8081/geoserver/Brandband/wfs?service=WFS&version=1.0.0&request=DescribeFeatureType&typeName=Brandband%3AMobile_project
http://www.opengis.net/wfs
http://127.0.0.1:8081/geoserver/schemas/wfs/1.0.0/WFS-basic.xsd">
<gml:boundedBy>
<gml:null>unknown</gml:null>
</gml:boundedBy>
<gml:featureMember>
<Brandband:Mobile_project fid="Mobile_project.1">
<Brandband:the_geom>
<gml:MultiPolygon srsName="http://www.opengis.net/gml/srs/epsg.xml#3857">
<gml:polygonMember>
<gml:Polygon>
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates xmlns:gml="http://www.opengis.net/gml" decimal="." cs=","
ts=" ">
-8729827.6436,4052279.3156 -8730097.9274,4052279.3156
-8730165.4983,4052360.9895 -8730165.4983,4052687.8254
-8730165.4983,4053014.5362 -8730097.9274,4053096.2154
-8729895.2146,4053341.2564 -8729827.6436,4053422.938
-8729557.2486,4053422.938 -8729286.9649,4053422.938
-8729219.3939,4053341.2564 -8729016.6811,4053096.2154
-8728949.1102,4053014.5362 -8728949.1102,4052687.8254
-8728949.1101,4052360.9895 -8729016.6811,4052279.3156
-8729286.965,4052279.3156 -8729557.2486,4052279.3156
-8729827.6436,4052279.3156
</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</gml:polygonMember>
<gml:polygonMember>
<gml:Polygon>
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates xmlns:gml="http://www.opengis.net/gml" decimal="." cs=","
ts=" ">
-8438634.7308,4187198.1974 -8439174.5259,4186981.0872
-8439056.6102,4187125.1524 -8438994.7818,4187230.2986
-8438634.7308,4187198.1974
</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</gml:polygonMember>
<gml:polygonMember>
<gml:Polygon>
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates xmlns:gml="http://www.opengis.net/gml" decimal="." cs=","
ts=" ">
-8437907.1028,4187545.9477 -8438330.0637,4187341.1429
-8438245.0203,4187455.0579 -8438185.716,4187560.1419
-8437907.1028,4187545.9477
</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</gml:polygonMember>
<gml:polygonMember>
<gml:Polygon>
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates xmlns:gml="http://www.opengis.net/gml" decimal="." cs=","
ts=" ">
-8437382.9111,4187827.2485 -8437721.4226,4187555.5367
-8437907.1028,4187545.9477 -8437715.7003,4187803.7501
-8437593.3591,4187864.2463 -8437382.9111,4187827.2485
</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</gml:polygonMember>
<gml:polygonMember>
<gml:Polygon>
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates xmlns:gml="http://www.opengis.net/gml" decimal="." cs=","
ts=" ">
-8414918.1607,4200093.3668 -8415149.6773,4200113.3069
-8415252.7036,4200251.1763 -8415265.4443,4200524.8842
-8414987.1193,4200439.4299 -8414918.1607,4200093.3668
</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</gml:polygonMember>
....
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/render-geometry-data-from-geoserver-tp6626253p6626253.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list