ArcGis api for js从地图上下载shp文件

1.按照id生成zip压缩包,下载到本地参考博客以上博客中提供的arcpy代码文件路径及文件名必须要中文路径,笔者稍作修改,如下:1)识别中文路径:在inputname后面加上.decode(‘utf-8’).encode(‘gbk’)inputname.decode('utf-8').encode('gbk')2)固定名称:不去识别中文路径,而是给压缩包一个固定的名称outname = ‘result’ + str(cnt)全部arcpy代码:总体与上述博客相差不多,通过代码生成gp工具后
摘要由CSDN通过智能技术生成

1.按照id生成zip压缩包,下载到本地
参考博客
以上博客中提供的arcpy代码文件路径及文件名必须要中文路径,笔者稍作修改,如下:
1)识别中文路径:在inputname后面加上.decode(‘utf-8’).encode(‘gbk’)

inputname.decode('utf-8').encode('gbk')

2)固定名称:不去识别中文路径,而是给压缩包一个固定的名称
outname = ‘result’ + str(cnt)
全部arcpy代码:总体与上述博客相差不多,通过代码生成gp工具后就可以调用,下载zip包到arcgis server的安装路径,通过后台代码从服务器的arcgis server安装路径内下载到本地

# coding:utf8
# Author:PasserQi
# Time:2018/6/15
# Vesrion:0.2.1
# Param:
#	- input
#		- input_path:the feature class will be selected
#		- out_dir:the output dir of the zip file
#		- sql:query condition
#	- output
#		- out_path:the out path of the zip file
# Decs:
# 	1. Select elements by attribute
#	2. Generates the SHP file from the selected element in the specified directory
#	3. Package the SHP file to generate the zip file
#	4. Reture the path to the zip file
import arcpy
import os
import sys
import zipfile

# Generate file names without repetition
# Maximum 100 files
def getFileName(inputfilepath,outdir):
	ret_filename = None

	inputname = os.path.basename(input_path)
	if '.' 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值