• openlayers4+geoserver wfs实现空间分析、属性查询


    openlayers4,geoserver wfs实现空间分析、属性查询

    原理
    这里写图片描述

    1. 工作区启用WFS
      这里写图片描述
      这里写图片描述
    2. 工作区下发布图层
    3. 代码
    var featureRequest = new ol.format.WFS().writeGetFeature({
                srsName: 'EPSG:4326',//坐标系统
                featureNS: 'zjk',//命名空间 URI
                featurePrefix: 'sf',//工作区名称
                featureTypes: '',//查询图层,可以同一个工作区下多个图层,逗号隔开
                outputFormat: 'application/json',
                filter: ol.format.filter.intersects(//查询过滤条件
                    'the_geom',//
                    geometry//
            });
            //http请求数据
    fetch(geoserverUrl + 'wfs', {//geoserver wfs地址如localhost:8080/geoserver/wfs
                method: 'POST',
                body: new XMLSerializer().serializeToString(featureRequest)
            }).then(function (response) {
                return response.json();
            }).then(function (json) {
              //查询结果
            })
    1. 查询过滤条件openlayers api
      根据查询的空间关系选择对应filter,传相应参数即可
      这里写图片描述
    GIS开发https://www.giserdqy.comGIS,WebGIS,ArcGIS,OpenLayers,Leaflet,Geoserver,PostGIS,BIM,空间大数据,GeoAI技术分享
  • 相关阅读:
    检测mysq组复制的脚本
    centos7安装NFS
    mysql组复制安装
    springboot+VUE(一)
    redis集群配置
    codevs 3139 栈练习3
    codevs 3138 栈练习2
    codevs 2622 数字序列
    codevs 1054 电梯
    codevs 1507 酒厂选址
  • 原文地址:https://www.cnblogs.com/dqygiser/p/9215837.html
Copyright © 2020-2023  润新知