# uServer **Repository Path**: marsprj/uServer ## Basic Information - **Project Name**: uServer - **Description**: uServer project - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2018-10-16 - **Last Updated**: 2023-10-16 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # uServer #### 初始化 - 执行 `mvn clean` 将 `libs` 中的jar安装到本地仓库 ### 本地编译 gdal #### WINDOWS 安装 https://download.gisinternals.com/release.php 环境变量 ```shell GDAL_BIN=C:\Program Files\GDAL GDAL_DATA=C:\Program Files\GDAL\gdal-data GDAL_DRIVER=C:\Program Files\GDAL\gdalplugins PROJ_LIB=C:\Program Files\GDAL\projlib ``` 在 PATH 里面增加 `GDAL_BIN` 路径 #### MACOS ```shell # macos cd gdal-2.4.4 ./configure \ --with-threads \ --disable-static \ --without-grass \ --with-jasper=/usr/local/lib \ --with-libtiff=/usr/local/lib \ --with-jpeg=/usr/local/lib \ --with-gif=/usr/local/lib \ --with-png=/usr/local/lib \ --with-geotiff=/usr/local/lib \ --with-pcraster=internal \ --with-geos=/usr/local/lib \ --with-expat=/usr/local/lib \ --with-curl=/usr/local/lib \ --with-netcdf=/usr/local/lib \ --with-hdf5=/usr/local/lib \ --with-opencl \ --with-libz=internal \ --with-java \ --with-jvm-lib=/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home make sudo make install ``` #### 安装栅格数据滤波计算的环境 + **安装 gdal 和 python-gdal** ```shell sudo apt-get install gdal-bin sudo apt-get install libgdal-dev sudo apt-get install libgdal-java sudo apt-get install libgdal-grass sudo apt-get install python-gdal ``` 执行命令时发现找不到 libgrass 的相关库,报如下 ```shell ERROR 1: libgrass_vector.7.4.0.so: cannot open shared object file: No such file or directory ERROR 1: libgrass_vector.7.4.0.so: cannot open shared object file: No such file or directory ERROR 1: libgrass_dgl.7.4.0.so: cannot open shared object file: No such file or directory ERROR 1: libgrass_dgl.7.4.0.so: cannot open shared object file: No such file or directory ERROR 1: libgrass_vector.7.4.0.so: cannot open shared object file: No such file or directory ERROR 1: libgrass_vector.7.4.0.so: cannot open shared object file: No such file or directory ERROR 1: libgrass_dgl.7.4.0.so: cannot open shared object file: No such file or directory ERROR 1: libgrass_dgl.7.4.0.so: cannot open shared object file: No such file or directory ``` 解决方法,将libgrass 的动态链接库注册到系统中 ```shell # 在系统配置中添加链接库位置的配置信息 echo '/usr/lib/grass74/lib' | sudo tee /etc/ld.so.conf.d/libgrass.conf # 刷新配置,使其生效 sudo ldconfig ``` + **安装 scipy.ndimage 开发库** scipy.ndimage 提供了高效的栅格数据滤波处理函数 ```shell $ sudo apt-get install python-scipy ``` + **安装 userver raster 脚本** 脚本原文件存放在项目根下 /doc/script/userver_raster.py,需要添加到系统搜索路径下 ```shell $ sudo ln -s userver_raster.py /usr/local/bin/userver_raster.py ``` 添加完成后,进行测试,显示命令帮助信息表示系统能找到该命令 ```shell $ userver_raster.py 命令格式规范 : userver_raster.py [operation: mean, sobel, gaussian, laplace] ``` + **请求参数说明** 所有的请求参数里都包含如下几个通用值: ```text "sourceId" : 该值是已经注册到平台里的某一栅格数据的ID编号 "destinationName" : 指定本次对栅格数据操作完成后的结果数据存储的位置名称 "token": HTTP的Header里面需要包含登录用户的 Token 信息 ``` 1. 栅格数据二值化 band: 是做二值化需要包含的波段数 compare: 比较运算符,可选值 gt, lt, ge, le 分别代表 大于,小于,大于等于,小于等于 threshold: 比较操作的阀值 http://127.0.0.1:8080/userver/service/process/raster/binarize ```json { "sourceId": "c716b12a-1d1d-49cb-bd82-d4d733381080", "destinationName" : "world_xxx", "band":3, "compare":"gt", "threshold":200 } ``` 2. 均值滤波 size: 均值卷积核的大小,默认值5表示5x5的矩阵大小 http://127.0.0.1:8080/userver/service/process/raster/mean ```json { "sourceId": "c716b12a-1d1d-49cb-bd82-d4d733381080", "destinationName" : "world_xxx", "size": 5 } ``` 3. 高斯滤波 http://127.0.0.1:8080/userver/service/process/raster/gaussian ```json { "sourceId": "c716b12a-1d1d-49cb-bd82-d4d733381080", "destinationName" : "world_xxx" } ``` 4. Sobel边缘检测 http://127.0.0.1:8080/userver/service/process/raster/sobel ```json { "sourceId": "c716b12a-1d1d-49cb-bd82-d4d733381080", "destinationName" : "world_xxx" } ``` 5. Laplacian边缘检测 http://127.0.0.1:8080/userver/service/process/raster/laplace ```json { "sourceId": "c716b12a-1d1d-49cb-bd82-d4d733381080", "destinationName" : "world_xxx" } ```