当前位置:网站首页>GeoServer automatically uploads shapefiles
GeoServer automatically uploads shapefiles
2022-07-24 05:33:00 【DoYouKnowArcgis】
geosever Provides a rest Interface , Some functions can be realized through this interface , Then through the relevant code , It can realize the automation of some functions .
Here are shapefile Several methods of data upload Automation .
official API https://docs.geoserver.org/stable/en/user/rest/stores.html
(1) upload ZIP, To publish Services
Parsing code :
pro.zip( The uploaded shp Compressed files , This file will directly shp Data compressed into files , Don't put it under a folder and compress it !)
curl -v -u admin:geoserver // user name password
-XPUT -H "Content-type: application/zip" // file type
--data-binary @C:\Users\111111\Desktop\shapefile_test\pro.zip // File path
http://localhost:8888/geoserver/rest/workspaces/HZP/datastores/pro/file.shp?charset=GBKcurl operational demo
curl -v -u admin:geoserver -XPUT -H "Content-type: application/zip" --data-binary @C:\Users\111111\Desktop\shapefile_test\pro.zip http://localhost:8888/geoserver/rest/workspaces/HZP/datastores/pro/file.shp?charset=GBKIt's written in java Form to call Curl Release
String filePath;
String fileName;
String workspaceName;
// Get the file name , Users upload their local zip, You need to know the file first
// The address of , namely filepath, Right again filepath Handle
// obtain filename
/*File tempFile =new File( filepath.trim());
/*String fileName = tempFile.getName();
String CurlDOS = "curl -v -u admin:geoserver -XPUT -H \"Content-type: application/zip\" --data-binary @"+filePath+" http://localhost:8888/geoserver/rest/workspaces/"+workspaceName+"/datastores/"+fileName+"/file.shp?charset=GBK"(2) By calling XML Methods to achieve publishing services .
( Publish vector data in the specified folder )
//2 Medium workspace Need and 4 In the same ,
//4 Medium datastores The following parameters need to be consistent with XML Medium name Agreement .
//4 Medium <featureType><name> The corresponding is uploaded shp The name of the file .Curl Direct manipulation demo:
// Execute first 2
curl -u admin:geoserver -XPOST -H "Content-type:text/xml" -d @C:\Users\111111\Desktop\shapefile_test\pro.xml http://localhost:8888/geoserver/rest/workspaces/HZP/datastores.xml
// Re execution 4
curl -u admin:geoserver -XPOST -H "Content-type:text/xml" -d "<featureType><name>pro</name></featureType>" http://localhost:8888/geoserver/rest/workspaces/HZP/datastores/pro/featuretypesXML
<dataStore>
<name>pro</name> // Here name Refers to the name of the storage space
<type>Shapefile</type>
<enabled>true</enabled>
<connectionParameters>
<entry key="url">file:/C:/Users/111111/Desktop/shapefile_test/pro</entry>
<entry key="charset">GBK</entry>
</connectionParameters>
<__default>false</__default>
</dataStore>Reference Edition XML
<dataStore>
<name>pro</name>
<description>tiger counties created from REST</description>
<!-- Upload the type of data storage -->
<type>Shapefile</type>
<!-- Whether the data storage is available -->
<enabled>true</enabled>
<connectionParameters>
<!-- Use memory mapped buffers -->
<entry key="memory mapped buffer">false</entry>
<!-- If the spatial index is missing or out of date , Rebuild spatial index -->
<entry key="create spatial index">true</entry>
<!-- DBF Character set for -->
<entry key="charset">GBK</entry>
<!-- Data file type -->
<entry key="filetype">shapefile</entry>
<!-- If the spatial index is missing or out of date , Rebuild spatial index -->
<entry key="cache and reuse memory maps">true</entry>
<!-- The path to upload the data file -->
<entry key="url">C:\Users\111111\Desktop\shapefile_test\pro\pro.shp</entry>
<entry key="namespace">http://HZP</entry>
</connectionParameters>
<__default>false</__default>
</dataStore>

(3) Use curl Complete the data Postgis Release of data in
Method 1 ( Failure )
1. New workspace
curl -v -u admin:geoserver -XPOST -H "Content-type: text/xml" -d "<namespace><prefix>PostGis_test</prefix><uri>http://localhost:8888/POSTGIS</uri></namespace>" http://localhost:8888/geoserver/rest/namespacesMethod 2 :
1. First define the uploaded database .
2. After data change , Add more data .
name For the file name .
curl -u admin:geoserver -XPOST -H "Content-type:text/xml" -d "<featureType><name>50m_admin_0_countries</name></featureType>" http://localhost:8888/geoserver/rest/workspaces/PostGis_pro/datastores/postgis/featuretypes
边栏推荐
- special effects - 鼠标点击,出现烟花炸裂效果
- 关于作为行业人从业人员的一点思考
- MySQL的使用
- 关键字_01return
- Hurry in!! Take you to understand what is multi file, and easily master the usage of extern and static C language keywords!!!
- New grammar 01_ ES6 new syntax
- C文件读写加链表增删改查
- canvas - 填充
- Find the flops of the network
- special effects - 樱花飘落背景特效
猜你喜欢
随机推荐
闲来写博~简单说说let和var和const
es10小计flat和flatMap
OpenGL draws two points on the screen, a blue point on the right, using anti aliasing technology, and a red point on the left, without anti aliasing technology. Compare the difference between the two
Draw a circle and a square on the screen. The square is in front and the circle is behind. You can move the square through the keyboard. In the following cases, the square can only move within the cir
新语法01_Es6新语法
面向 对象
根据数组中对象的某个属性值进行排序
day(0~6)代表每月第一天起始位置,stop代表每月天数,每天之间空两个空格。输入不同的day和stop,输出每月日历的样子。假设day为2,stop为31,则输出样式为
Summary of data types
Draw a square on the screen and use ice BMP texture maps the square; Draw a yellow teapot after the square. Assuming that the square is transparent, draw the mixed effect of teapot and square; Adjust
函数闭包
9.使用网格技术,在屏幕上绘制一个五角形。
Promise_async与await
微信小程序报错request:fail -2:net::ERR_FAILED
赶紧进来!!带你了解什么是多文件,并轻松掌握 extern和static c语言关键字的用法!!!
Draw a moving teapot on the screen. The teapot first moves slowly towards the screen, becoming smaller and smaller, becoming more and more blurred; Then it grows bigger and clearer, and keeps repeatin
4. Draw a red triangle and a yellow square on the screen. Triangle in the back, small; Square in front, big. Using the fusion technology, the triangle can be seen through the square, and the source an
Hurry in!! Take you to understand what is multi file, and easily master the usage of extern and static C language keywords!!!
OPENGL在屏幕上绘制2个点,右边一个蓝色的点,采用反走样技术,左边一个红色的点,不采用反走样技术。比较两个点的区别。
Tabs标签页(el-tabs)_造成页面卡死问题









