客户端对服务器的Feature执行 增 删 改 查 操作
一.添加 Feature
function addFeature(){
var u='<wfs:Transaction service="WFS" version="1.1.0" '
+'xmlns:topp="http://www.openplans.org/topp" '
+'xmlns:gsnewmap="http://gsnewmap" '
+'xmlns:ogc="http://www.opengis.net/ogc" xmlns:wfs="http://www.opengis.net/wfs" '
+'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '
+'xmlns:gml="http://www.opengis.net/gml" '
+'xsi:schemaLocation="http://www.opengis.net/wfs '
+'http://schemas.opengis.net/wfs/1.1.0/WFS-transaction.xsd '
+'http://www.openplans.org/topp http://localhost:8181/geoserver/wfs?request=DescribeFeatureType& '
+'version=1.1.0&typeName=gsnewmap:a89-72_8-1shangpuceng_rectangle" '
+'handle="Updating Signature rock label">'
+'<wfs:Insert>'
+'<gsnewmap:a89-72_8-1shangpuceng_rectangle>'
+'<gsnewmap:the_geom>'
+'<gml:MultiSurface srsName="urn:x-ogc:def:crs:EPSG:4326">'
+'<gml:surfaceMember>' //<gml:polygonMember>
+'<gml:Polygon>'
+'<gml:exterior>'
+'<gml:LinearRing>'
+' <gml:posList>72899.84897324877 89268.97858858372 72902.18062785419 89261.97858858372 '+'72902.18062785418 89271.06679308612 72894.84897324874 89271.06679308612 72894.84897324874 '+'89261.97858858372 72899.84897324877 89268.97858858372</gml:posList> '
+'</gml:LinearRing>'
+'</gml:exterior>'
+'</gml:Polygon>'
+'</gml:surfaceMember>'
+'</gml:MultiSurface>'
+'</gsnewmap:the_geom>'
+'<gsnewmap:STORE>00000</gsnewmap:STORE> '
+'<gsnewmap:DOORNUMBER>908</gsnewmap:DOORNUMBER> '
+'<gsnewmap:PHOTO>IMG_3618</gsnewmap:PHOTO> '
+'<gsnewmap:DOORNUMB0>IMG_3618</gsnewmap:DOORNUMB0> '
+'<gsnewmap:BUSINESSRE>330181600029212</gsnewmap:BUSINESSRE> '
+'<gsnewmap:STATUSMARK>2</gsnewmap:STATUSMARK> '
+'</gsnewmap:a89-72_8-1shangpuceng_rectangle>'
+'</wfs:Insert>'
+'</wfs:Transaction>';
OpenLayers.Request.issue(
{
method: "POST",
url: "http://127.0.0.1:8181/geoserver/wfs",
data: o,
success: hxy
//proxy:""
});
}
function hxy(response){
gmlStr = response.responseText;
document.getElementById('wfsBack').innerHTML=gmlStr;
alert(gmlStr);
}
可以传参数 将字符串添加变量。
一.添加 Feature
function addFeature(){
var u='<wfs:Transaction service="WFS" version="1.1.0" '
+'xmlns:topp="http://www.openplans.org/topp" '
+'xmlns:gsnewmap="http://gsnewmap" '
+'xmlns:ogc="http://www.opengis.net/ogc" xmlns:wfs="http://www.opengis.net/wfs" '
+'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '
+'xmlns:gml="http://www.opengis.net/gml" '
+'xsi:schemaLocation="http://www.opengis.net/wfs '
+'http://schemas.opengis.net/wfs/1.1.0/WFS-transaction.xsd '
+'http://www.openplans.org/topp http://localhost:8181/geoserver/wfs?request=DescribeFeatureType& '
+'version=1.1.0&typeName=gsnewmap:a89-72_8-1shangpuceng_rectangle" '
+'handle="Updating Signature rock label">'
+'<wfs:Insert>'
+'<gsnewmap:a89-72_8-1shangpuceng_rectangle>'
+'<gsnewmap:the_geom>'
+'<gml:MultiSurface srsName="urn:x-ogc:def:crs:EPSG:4326">'
+'<gml:surfaceMember>' //<gml:polygonMember>
+'<gml:Polygon>'
+'<gml:exterior>'
+'<gml:LinearRing>'
+' <gml:posList>72899.84897324877 89268.97858858372 72902.18062785419 89261.97858858372 '+'72902.18062785418 89271.06679308612 72894.84897324874 89271.06679308612 72894.84897324874 '+'89261.97858858372 72899.84897324877 89268.97858858372</gml:posList> '
+'</gml:LinearRing>'
+'</gml:exterior>'
+'</gml:Polygon>'
+'</gml:surfaceMember>'
+'</gml:MultiSurface>'
+'</gsnewmap:the_geom>'
+'<gsnewmap:STORE>00000</gsnewmap:STORE> '
+'<gsnewmap:DOORNUMBER>908</gsnewmap:DOORNUMBER> '
+'<gsnewmap:PHOTO>IMG_3618</gsnewmap:PHOTO> '
+'<gsnewmap:DOORNUMB0>IMG_3618</gsnewmap:DOORNUMB0> '
+'<gsnewmap:BUSINESSRE>330181600029212</gsnewmap:BUSINESSRE> '
+'<gsnewmap:STATUSMARK>2</gsnewmap:STATUSMARK> '
+'</gsnewmap:a89-72_8-1shangpuceng_rectangle>'
+'</wfs:Insert>'
+'</wfs:Transaction>';
OpenLayers.Request.issue(
{
method: "POST",
url: "http://127.0.0.1:8181/geoserver/wfs",
data: o,
success: hxy
//proxy:""
});
}
function hxy(response){
gmlStr = response.responseText;
document.getElementById('wfsBack').innerHTML=gmlStr;
alert(gmlStr);
}
可以传参数 将字符串添加变量。