zoukankan      html  css  js  c++  java
  • openlayers wms空间查询


    //绑定鼠标移动事件,获取坐标点

    map.on('pointermove', function(evt) {

        if (evt.dragging) {
            return;
        }
        displayFeatureInfo(evt);

    });

    //查询

        var displayFeatureInfo = function (evt) {

    //获取wms生成的资源url, fdLayer.getSource().getGetFeatureInfoUrl

            var url = fdLayer.getSource().getGetFeatureInfoUrl(evt.coordinate, map.getView().getResolution(),
                'EPSG:4326', { 'INFO_FORMAT': 'application/json',

                'FEATURE_COUNT': 1 });

    //http请求结果数据

            $.ajax({
                url: url,
                async: false,
                dataType:'json',
                success: function (data) {

                        if (data.features.length > 0) {

    //解析geojson结果

                            var feature = data.features[0];

    //获取wms服务中想要的属性

                            var fdid = feature.properties.fdid;
                            var fdno = feature.properties.fdno;       
                        } else {
                            content.innerHTML = '';
                            overlay.setPosition(undefined);
                        }
                }
            })

    };


    GIS开发https://www.giserdqy.comGIS,WebGIS,ArcGIS,OpenLayers,Leaflet,Geoserver,PostGIS,BIM,空间大数据,GeoAI技术分享
  • 相关阅读:
    django基础篇
    oracle中的intersect和minus
    Mybatis中的DTD文件
    ibatis 大于 小于 等。。
    Mysql的DATE_FORMAT()日期格式转换
    mybatis中配置批量insert list
    java split 函数
    Hadoop全分布式模式安装
    Linux免密远程登陆
    Hadoop伪分布式搭建
  • 原文地址:https://www.cnblogs.com/dqygiser/p/9215838.html
Copyright © 2011-2022 走看看