openlayer web 要素查询

  var sendstr="";
   sendstr="<?xml version='1.0' encoding='UTF-8' ?>" + "/n";
   sendstr+="<wfs:GetFeature service='WFS' version='1.0.0'"+ "/n"; 
   sendstr+="outputFormat='json'"+ "/n";
   sendstr+="xmlns:topp='http://www.openplans.org/topp'"+"/n"; 
   sendstr+="xmlns:wfs='http://www.opengis.net/wfs'"+ "/n"; 
   sendstr+="xmlns:ogc='http://www.opengis.net/ogc'"+"/n";  
   sendstr+="xmlns:gml='http://www.opengis.net/gml'"+ "/n"; 
   sendstr+="xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'"+  "/n";
   sendstr+="xsi:schemaLocation='http://www.opengis.net/wfs   http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd'>"+ "/n";  
   sendstr+="<wfs:Query typeName='topp:logicline' >"+"/n";
   sendstr+="<wfs:PropertyName>the_geom</wfs:PropertyName>"+"/n";
   sendstr+="<ogc:Filter>"+ "/n";
   if(type==1)
   {
    sendstr+="<ogc:BBOX>"+"/n";
    sendstr+="<ogc:PropertyName>the_geom</ogc:PropertyName>"+"/n";
    sendstr+="<gml:Box srsName='http://www.opengis.net/gml/srs/epsg.xml#4326'>"+  "/n"; 
    sendstr+="<gml:coordinates>"+ "/n";   
    sendstr+=str+"/n" ;
    sendstr+="</gml:coordinates>"+"/n";
    sendstr+="</gml:Box>"+ "/n";
    sendstr+="</ogc:BBOX>"+"/n";
   }
      if(type==0)
   {
    sendstr+="<ogc:Intersects>"+"/n";
    sendstr+="<ogc:PropertyName>the_geom</ogc:PropertyName>"+"/n";
    sendstr+="<gml:Polygon srsName='http://www.opengis.net/gml/srs/epsg.xml#4326'>"+  "/n";
    sendstr+="<gml:outerBoundaryIs>"+ "/n";
    sendstr+="<gml:LinearRing>"+ "/n";
    sendstr+="<gml:coordinates>"+ "/n";   
    sendstr+=str+"/n" ;
    sendstr+="</gml:coordinates>"+"/n";
    sendstr+="</gml:LinearRing>"+ "/n";
    sendstr+="</gml:outerBoundaryIs>"+ "/n";
    sendstr+="</gml:Polygon>"+ "/n";
    sendstr+="</ogc:Intersects>"+"/n";   
   }
      alert(str);
   sendstr+="</ogc:Filter>"+ "/n"; 
   sendstr+="</wfs:Query>"+  "/n";
   sendstr+="</wfs:GetFeature>";

   }
      //prompt("test",sendstr);
      //alert(OpenLayers.loadURL);
      var sendRequest = OpenLayers.Request.POST({
   url : "http://192.168.0.27:8028/geoserver/wfs",
   data : sendstr,
   callback : setHTML
   });

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值