OpenLayers中图属查询及属性过滤

本文介绍如何在OpenLayers中实现图层的属性查询及属性过滤功能,通过设置参数实现对多个图层的点击事件,获取相关图属信息。
摘要由CSDN通过智能技术生成
var map, ctrlLyrSwitcher, measureControls;
var markers;
var wfs;
var field = 'Linetype'; //属性名
var val = 'DASHED';		//参数值
var flag = true;
function init() {
	format = 'image/png';
    map = new OpenLayers.Map({
        div: "map",
        projection: "EPSG:4326",
        displayProjection: new OpenLayers.Projection("EPSG:4326"),
        numZoomLevels: 21,
        layers: [
			new OpenLayers.Layer.WMS(
                 "点",
                 [
                  "http://localhost:8080/geoserver/TJDG/wms"
                 ],
                 { layers: 'TJDG:point', transparent: true },
                 { opacity: 0.8 }
                 ),
            new OpenLayers.Layer.XYZ(
                 "tianditu",
                 [
                  //"http://t1.tianditu.cn/DataServer?T=img_c&X=${x}&Y=${y}&L=${z}"
                  "http://t1.tianditu.cn/DataServer?T=cav_c&X=${x}&Y=${y}&L=${z}"
                 ],
                 {
                 //wrapDateLine: true
             }
                 ),
                  new OpenLayers.Layer.XYZ(
                 "天地图中文注记",
                 [
                  "http://t1.tianditu.cn/DataServer?T=cva_c&X=${x}&Y=${y}&L=${z}"
                 ],
                 {
                     //wrapDateLine: true,
                     isBaseLayer: false,
                     visibility: false,
                     displayInLayerSwitcher: false
                 }
                 ),
                 new OpenLayers.Layer.XYZ(
                 "天地图卫星图标注",
                 [
                  "http://t1.tianditu.cn/DataServer?T=cia_c&X=${x}&Y=${y}&L=${z}"
                 ],
                 {
                     // wrapDateLine: true,
                     isBaseLayer: false
                 }
                 ),	
								new OpenLayers.Layer.WMS(
                 "管",
                 [
                  "http://localhost:8080/geoserver/TJDG/wms"
                 ],
                 { layers: 'TJDG:line', transparent: true },
                 { opacity: 0.8 }
                 ),	
                 				new OpenLayers.Layer.WMS(
                 "锅炉房",
                 [
                 "http://localhost:8080/geoserver/TJDG/wms"
                 ],
                 { layers: 'TJDG:GLF', transparent: true },
                 { opacity: 0.8 }
                 ),				new OpenLayers.Layer.WMS(
                 "居民点",
                 [
                 "http://localhost:8080/geoserver/TJDG/wms"
                 ],
                 { layers: 'TJDG:jmd', transparent: true },
                 { opacity: 0.8 }
                 )		                          

    ],
        center: [117.47081, 38.72762],
        zoom: 15
    });
  //*******************设置style**********************************
    var myStyles = new OpenLayers.StyleMap({  
        "default": new OpenLayers.Style({  
            pointRadius: "${type}",  
            fillColor: "#ffcc66",  
            strokeColor: "#ff9933",  
            strokeWith: 2,  
            graphicZIndex:1  
        }),  
        "select": new OpenLayers.Style({  
            fillColor: "#66ccff",  
            strokeColor: "
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值