当前位置:网站首页>Geoserver REST API功能解析
Geoserver REST API功能解析
2022-07-24 05:18:00 【DoYouKnowArcgis】
Geoserver REST API功能解析
1.使用Rest创建工作区
- 创建工作区
curl -v -u admin:geoserver -XPOST -H "Content-type: text/xml" -d "<workspace><name>YYYYYYYY</name></workspace>" http://localhost:8888/geoserver/rest/workspaces- 加上url对其进行规范化(推荐)
curl -v -u admin:geoserver -XPOST -H "Content-type: text/xml" -d "<namespace><prefix>PostGis_pro</prefix><uri>http://localhost:8888/pro</uri></namespace>" http://localhost:8888/geoserver/rest/namespaces删除工作区
curl -v -u admin:geoserver -XDELETE -H "Content-type: text/xml" http://localhost:8888/geoserver/rest/workspaces/YYYYYYYY2.使用Rest展示工作区列表
curl -u admin:geoserver -v -XGET -H 'Accept: text/xml' http://localhost:8888/geoserver/rest/workspaces解析Curl
curl -u admin:geoserver -v -XGET -H 'Accept: text/xml' http://localhost:8888/geoserver/rest/workspaces //直接解析rest下的workspaces返回的数据是json(返回展示在控制台中,后期使用需将其整理)
{"workspaces":{"workspace":[ {"name":"newWorkspace","href":"http:\/\/localhost:8888\/geoserver\/rest\/workspaces\/newWorkspace.json"}, {"name":"NNUC","href":"http:\/\/localhost:8888\/geoserver\/rest\/workspaces\/NNUC.json"}, {"name":"cite","href":"http:\/\/localhost:8888\/geoserver\/rest\/workspaces\/cite.json"}, {"name":"tiger","href":"http:\/\/localhost:8888\/geoserver\/rest\/workspaces\/tiger.json"}, {"name":"nurc","href":"http:\/\/localhost:8888\/geoserver\/rest\/workspaces\/nurc.json"}, {"name":"sde","href":"http:\/\/localhost:8888\/geoserver\/rest\/workspaces\/sde.json"}, {"name":"it.geosolutions","href":"http:\/\/localhost:8888\/geoserver\/rest\/workspaces\/it.geosolutions.json"}, {"name":"topp","href":"http:\/\/localhost:8888\/geoserver\/rest\/workspaces\/topp.json"}, {"name":"sf","href":"http:\/\/localhost:8888\/geoserver\/rest\/workspaces\/sf.json"}, {"name":"POST","href":"http:\/\/localhost:8888\/geoserver\/rest\/workspaces\/POST.json"}, {"name":"dsss","href":"http:\/\/localhost:8888\/geoserver\/rest\/workspaces\/dsss.json"} ]}}* Connection #1 to host localhost left intact3.使用Rest返回图层列表(对应工作区)
curl -u admin:geoserver -XGET http://localhost:8888/geoserver/rest/layers.json返回的依旧是json对象(我们需对name进行获取)
{"name":"NNUC:the_whole_world","href":"http:\/\/localhost:8888\/geoserver\/rest\/layers\/NNUC%3Athe_whole_world.json"}, {"name":"cite:SX_SJXZQ","href":"http:\/\/localhost:8888\/geoserver\/rest\/layers\/cite%3ASX_SJXZQ.json"}, {"name":"cite:ne_10m_admin_0_countries","href":"http:\/\/localhost:8888\/geoserver\/rest\/layers\/cite%3Ane_10m_admin_0_countries.json"}, {"name":"tiger:giant_polygon","href":"http:\/\/localhost:8888\/geoserver\/rest\/layers\/tiger%3Agiant_polygon.json"}, {"name":"tiger:poi","href":"http:\/\/localhost:8888\/geoserver\/rest\/layers\/tiger%3Apoi.json"}, {"name":"tiger:poly_landmarks","href":"http:\/\/localhost:8888\/geoserver\/rest\/layers\/tiger%3Apoly_landmarks.json"}, {"name":"tiger:tiger_roads","href":"http:\/\/localhost:8888\/geoserver\/rest\/layers\/tiger%3Atiger_roads.json"}, {"name":"nurc:Arc_Sample","href":"http:\/\/localhost:8888\/geoserver\/rest\/layers\/nurc%3AArc_Sample.json"}, {"name":"nurc:Img_Sample","href":"http:\/\/localhost:8888\/geoserver\/rest\/layers\/nurc%3AImg_Sample.json"}, {"name":"nurc:Pk50095","href":"http:\/\/localhost:8888\/geoserver\/rest\/layers\/nurc%3APk50095.json"}, {"name":"nurc:mosaic","href":"http:\/\/localhost:8888\/geoserver\/rest\/layers\/nurc%3Amosaic.json"}, {"name":"topp:states","href":"http:\/\/localhost:8888\/geoserver\/rest\/layers\/topp%3Astates.json"}, {"name":"topp:tasmania_cities","href":"http:\/\/localhost:8888\/geoserver\/rest\/layers\/topp%3Atasmania_cities.json"}, {"name":"topp:tasmania_roads","href":"http:\/\/localhost:8888\/geoserver\/rest\/layers\/topp%3Atasmania_roads.json"}, {"name":"topp:tasmania_state_boundaries","href":"http:\/\/localhost:8888\/geoserver\/rest\/layers\/topp%3Atasmania_state_boundaries.json"}, {"name":"topp:tasmania_water_bodies","href":"http:\/\/localhost:8888\/geoserver\/rest\/layers\/topp%3Atasmania_water_bodies.json"}, {"name":"sf:archsites","href":"http:\/\/localhost:8888\/geoserver\/rest\/layers\/sf%3Aarchsites.json"}, {"name":"sf:bugsites","href":"http:\/\/localhost:8888\/geoserver\/rest\/layers\/sf%3Abugsites.json"}, {"name":"sf:restricted","href":"http:\/\/localhost:8888\/geoserver\/rest\/layers\/sf%3Arestricted.json"}, {"name":"sf:roads","href":"http:\/\/localhost:8888\/geoserver\/rest\/layers\/sf%3Aroads.json"}, {"name":"sf:sfdem","href":"http:\/\/localhost:8888\/geoserver\/rest\/layers\/sf%3Asfdem.json"}, {"name":"sf:streams","href":"http:\/\/localhost:8888\/geoserver\/rest\/layers\/sf%3Astreams.json"}, {"name":"POST:gis_osm_buildings_a_free_1","href":"http:\/\/localhost:8888\/geoserver\/rest\/layers\/POST%3Agis_osm_buildings_a_free_1.json"}, {"name":"POST:ne_10m_admin_0_countries","href":"http:\/\/localhost:8888\/geoserver\/rest\/layers\/POST%3Ane_10m_admin_0_countries.json"}] }}* Connection #1 to host localhost left intact4.使用Rest创建图层组
curl指令
curl -v -u admin:geoserver -XPOST -d @C:\Users\111111\Desktop\shapefile_test\layers.xml -H "Content-type: text/xml" http://localhost:8888/geoserver/rest/layergroupsXml(XML可进行细化,内部参数可以增加,未仔细研究。)
<layerGroup> <name>HHHHHHHHH</name> //创建图层组的name <layers> //图层组包括的图层 <layer>VGEs_CJHH</layer> <layer>the_whole_world</layer> </layers> <styles> //对应的图层类型 <style>line</style> <style>polygon</style> </styles> </layerGroup>结果

5.使用Rest删除图层组
curl -v -u admin:geoserver -XDELETE -H "Content-type: text/xml" http://localhost:8888/geoserver/rest/layergroups/HAHA6.在已有图层组新增/删除图层
暂未实现。
如果重复在已有图层上传,则会覆盖内容。
边栏推荐
猜你喜欢
随机推荐
5.模板缓存,绘制一个正方形只能在三角形内移动
【dp】数字三角形
Tabs标签页(el-tabs)_造成页面卡死问题
C2 random generation function seed, numpy. Random. Seed(), TF. Random. Set_ Seed Learning + reprint and sorting
Add, delete, modify and check JDBC
Introduction to reflection
Modify jupyter save path
谈谈对未来的想法
gdb调试core/dump
Some experience of using D2L package and related environment configuration
C语言进阶篇 四.自定义类型详解
c语言中的变量与常量
关于作为行业人从业人员的一点思考
C语言实现扫雷游戏
Implementation and comparison of nine sorting (ten thousand words summary)
C语言进阶篇 六.文件的操作
4. 在屏幕上绘制一个红色三角形,一个黄色正方形。三角形在后,小;正方形在前,大。使用融合技术,使得可以透过正方形看到三角形,源和目标融合因子分别为GL_SRC_ALPHA和GL_ONE_MINUS
函数_this关键字
OPENGL在屏幕上绘制2个点,右边一个蓝色的点,采用反走样技术,左边一个红色的点,不采用反走样技术。比较两个点的区别。
visibility:hidden 和 display:none









