zoukankan      html  css  js  c++  java
  • 使用python从地图服务中提取数据

    arcgis server 发布的wmts服务,可以下载为lyr 文件,想转为shapefile。

    数据不在文件内的,复制要素,另存都无效

    import urllib.parse, urllib.request, os, arcpy
    
    url = "http://ydt.haxxxxumap.g080/arcgis/rest/services/ghg_2021/MapServer/8/query?"
    
    params = {'where': 'objectid<=2000 and objectid>1000',
    'geometryType': 'esriGeometryEnvelope',
    'spatialRel': 'esriSpatialRelIntersects',
    'relationParam': '',
    'outFields': '*',
    'returnGeometry': 'true',
    'geometryPrecision':'',
    'outSR': '',
    'returnIdsOnly': 'false',
    'returnCountOnly': 'false',
    'orderByFields': '',
    'groupByFieldsForStatistics': '',
    'returnZ': 'false',
    'returnM': 'false',
    'returnDistinctValues': 'false',
    'f': 'pjson'
    }
    
    encode_params = urllib.parse.urlencode(params).encode("utf-8")
    
    response = urllib.request.urlopen(url, encode_params)
    json = response.read()
    
    with open("mapservice.json", "wb") as ms_json:
        ms_json.write(json)
    
    ws = os.getcwd() + os.sep
    arcpy.JSONToFeatures_conversion("mapservice.json", ws + "mapservice.shp")

    来自:

    https://support.esri.com/zh-cn/technical-article/000019645

  • 相关阅读:
    安装Docker-Compose
    Docker微容器Alpine Linux
    Linux 常用命令
    如何定制博客园的个人空间
    Elasticsearch入门之从零开始安装ik分词器
    Elasticsearch入门实践
    写在2017年的总结
    开源ETL工具之Kettle介绍
    常用Java数据库连接池
    细说shiro之七:缓存
  • 原文地址:https://www.cnblogs.com/yansc/p/15304489.html
Copyright © 2011-2022 走看看