修改geotools的内容

This commit is contained in:
qiushijie 2024-01-16 17:19:24 +08:00
parent c4e8f7c0dc
commit 1fdeb5ea66
7 changed files with 99 additions and 246 deletions

View File

@ -33,11 +33,8 @@ CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7" CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos" REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7" REDHAT_SUPPORT_PRODUCT_VERSION="7"
``` ```
### 2.安装PostgreSQL ### 2.安装PostgreSQL
> 官方教程https://www.postgresql.org/download/linux/redhat/ > 官方教程https://www.postgresql.org/download/linux/redhat/
@ -80,8 +77,6 @@ GRANT
#exit可退出bash命令行 #exit可退出bash命令行
``` ```
#### 2.2.配置连接 #### 2.2.配置连接
> 安装完pg之后默认是只接受本地访问连接。 > 安装完pg之后默认是只接受本地访问连接。
@ -137,7 +132,6 @@ host all all ::1/128 scram-sha-256
local replication all peer local replication all peer
host replication all 127.0.0.1/32 scram-sha-256 host replication all 127.0.0.1/32 scram-sha-256
host replication all ::1/128 scram-sha-256 host replication all ::1/128 scram-sha-256
``` ```
3、重启pg 3、重启pg
@ -160,7 +154,6 @@ success
# 检查是否生效 # 检查是否生效
[root@localhost data]# firewall-cmd --zone=public --query-port=5432/tcp [root@localhost data]# firewall-cmd --zone=public --query-port=5432/tcp
yes yes
``` ```
```shell ```shell
@ -173,10 +166,6 @@ ps -ef|grep svn
netstat -lntup netstat -lntup
``` ```
### 3安装PostGIS ### 3安装PostGIS
> 官方教程https://postgis.net/install/ > 官方教程https://postgis.net/install/
@ -239,13 +228,10 @@ postgis31_14-gui.x86_64 : GUI for PostGIS
postgis31_14-utils.x86_64 : The utils for PostGIS postgis31_14-utils.x86_64 : The utils for PostGIS
Name and summary matches only, use "search all" for everything. Name and summary matches only, use "search all" for everything.
``` ```
[这里](https://trac.osgeo.org/postgis/wiki/UsersWikiPostgreSQLPostGIS)可以查看postgis与pg版本支持的对应关系。 [这里](https://trac.osgeo.org/postgis/wiki/UsersWikiPostgreSQLPostGIS)可以查看postgis与pg版本支持的对应关系。
3、在指定的数据库(`test`)中启用postgis空间扩展 3、在指定的数据库(`test`)中启用postgis空间扩展
```shell ```shell
@ -290,8 +276,6 @@ CREATE EXTENSION address_standardizer_data_us;
CREATE EXTENSION postgis_tiger_geocoder; CREATE EXTENSION postgis_tiger_geocoder;
``` ```
### 4.GeoServer ### 4.GeoServer
#### 4.1 查看是否有jre #### 4.1 查看是否有jre
@ -301,7 +285,6 @@ CREATE EXTENSION postgis_tiger_geocoder;
java version "1.8.0_291" java version "1.8.0_291"
Java(TM) SE Runtime Environment (build 1.8.0_291-b10) Java(TM) SE Runtime Environment (build 1.8.0_291-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.291-b10, mixed mode) Java HotSpot(TM) 64-Bit Server VM (build 25.291-b10, mixed mode)
``` ```
#### 4.2 安装Tomcat #### 4.2 安装Tomcat
@ -314,7 +297,6 @@ Java HotSpot(TM) 64-Bit Server VM (build 25.291-b10, mixed mode)
[root@localhost Downloads]# wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.68/bin/apache-tomcat-9.0.68.tar.gz [root@localhost Downloads]# wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.68/bin/apache-tomcat-9.0.68.tar.gz
[root@localhost Downloads]# tar xvf apache-tomcat-9.0.68.tar.gz -C /usr/local/ [root@localhost Downloads]# tar xvf apache-tomcat-9.0.68.tar.gz -C /usr/local/
[root@localhost Downloads]# mv /usr/local/apache-tomcat-9.0.68/ /usr/local/tomcat/ [root@localhost Downloads]# mv /usr/local/apache-tomcat-9.0.68/ /usr/local/tomcat/
``` ```
2、修改tomcat配置 2、修改tomcat配置
@ -331,7 +313,7 @@ export JAVA_HOME=/newData/installPackage/jdk1.8.0_291
配置tomcat的方式有很多 配置tomcat的方式有很多
- 在全局的/etc/profile中添加`TOMCAT_HOME`、`CATALINA_HOME`、`CLASS_PATH`,网上示例: - 在全局的/etc/profile中添加`TOMCAT_HOME`、`CATALINA_HOME`、`CLASS_PATH`,网上示例:
```shell ```shell
export JAVA_HOME=/usr/local/java export JAVA_HOME=/usr/local/java
export TOMCAT_HOME=/usr/local/tomcat export TOMCAT_HOME=/usr/local/tomcat
@ -341,7 +323,7 @@ export JAVA_HOME=/newData/installPackage/jdk1.8.0_291
``` ```
- 在`catalina.sh`文件和`setclasspath.sh`文件添加Java的路径 - 在`catalina.sh`文件和`setclasspath.sh`文件添加Java的路径
```shell ```shell
#修改setclasspath.sh #修改setclasspath.sh
vi /usr/local/tomcat/bin/setclasspath.sh vi /usr/local/tomcat/bin/setclasspath.sh
@ -354,8 +336,6 @@ export JAVA_HOME=/newData/installPackage/jdk1.8.0_291
export JAVA_HOME=/newData/installPackage/jdk1.8.0_291 export JAVA_HOME=/newData/installPackage/jdk1.8.0_291
``` ```
3、修改端口 3、修改端口
```shell ```shell
@ -370,8 +350,6 @@ export JAVA_HOME=/newData/installPackage/jdk1.8.0_291
:wq :wq
``` ```
```shell ```shell
# 暴露端口 # 暴露端口
[root@localhost bin]# firewall-cmd --add-port=8088/tcp --permanent [root@localhost bin]# firewall-cmd --add-port=8088/tcp --permanent
@ -385,7 +363,6 @@ export JAVA_HOME=/newData/installPackage/jdk1.8.0_291
[root@localhost bin]# cd /usr/local/tomcat/bin && sh startup.sh [root@localhost bin]# cd /usr/local/tomcat/bin && sh startup.sh
[root@localhost bin]# cd /usr/local/tomcat/bin && sh shutdown.sh [root@localhost bin]# cd /usr/local/tomcat/bin && sh shutdown.sh
``` ```
5、设置开机启动 5、设置开机启动
@ -393,7 +370,7 @@ export JAVA_HOME=/newData/installPackage/jdk1.8.0_291
配置Tomcat开机启动很简单将Tomcat配置为系统服务即可。 配置Tomcat开机启动很简单将Tomcat配置为系统服务即可。
- 配置tomcat9.service - 配置tomcat9.service
```shell ```shell
#创建Tomcat9服务文件 #创建Tomcat9服务文件
vi /usr/lib/systemd/system/tomcat9.service vi /usr/lib/systemd/system/tomcat9.service
@ -415,10 +392,8 @@ export JAVA_HOME=/newData/installPackage/jdk1.8.0_291
WantedBy=multi-user.target WantedBy=multi-user.target
``` ```
- 配置开机启动: - 配置开机启动:
```shell ```shell
#设置Tomcat9开机启动 #设置Tomcat9开机启动
systemctl enable tomcat9 systemctl enable tomcat9
@ -427,8 +402,6 @@ export JAVA_HOME=/newData/installPackage/jdk1.8.0_291
systemctl start tomcat9 systemctl start tomcat9
``` ```
#### 4.3 部署geoserver.war包 #### 4.3 部署geoserver.war包
```shell ```shell
@ -436,7 +409,6 @@ export JAVA_HOME=/newData/installPackage/jdk1.8.0_291
[root@localhost webapps]# pwd [root@localhost webapps]# pwd
/usr/local/tomcat/webapps /usr/local/tomcat/webapps
[root@localhost webapps]# wget https://sourceforge.net/projects/geoserver/files/GeoServer/2.21.2/geoserver-2.21.2-war.zip [root@localhost webapps]# wget https://sourceforge.net/projects/geoserver/files/GeoServer/2.21.2/geoserver-2.21.2-war.zip
``` ```
下载失败! 下载失败!
@ -449,8 +421,6 @@ export JAVA_HOME=/newData/installPackage/jdk1.8.0_291
重新启动一下tomcat 重新启动一下tomcat
### 补充 ### 补充
**Tomcat配置跨域** **Tomcat配置跨域**
@ -458,7 +428,7 @@ export JAVA_HOME=/newData/installPackage/jdk1.8.0_291
1. 引用跨域报 `cors-filter.jar`、`java-property-utils.jar` 1. 引用跨域报 `cors-filter.jar`、`java-property-utils.jar`
2. 修改Tomcat的配置文件`config\web.xml`,在根节点追加: 2. 修改Tomcat的配置文件`config\web.xml`,在根节点追加:
```xml ```xml
<filter> <filter>
<filter-name>CORS</filter-name> <filter-name>CORS</filter-name>
@ -471,12 +441,3 @@ export JAVA_HOME=/newData/installPackage/jdk1.8.0_291
``` ```
3. 重启Tomcat 3. 重启Tomcat

View File

@ -8,8 +8,6 @@ categories:
- Database - Database
--- ---
## Postgresql 备份方式 ## Postgresql 备份方式
### 1. 数据库备份的分类类型 ### 1. 数据库备份的分类类型
@ -68,14 +66,14 @@ COPY webapi.concept_of_interest (id, concept_id, concept_of_interest_id) FROM st
当该脚本作为sql脚本运行时它会失败并显示以下错误。 当该脚本作为sql脚本运行时它会失败并显示以下错误。
- 用IDEA连接去执行sql文件时会报错 - 用IDEA连接去执行sql文件时会报错
```shell ```shell
[57014] ERROR: COPY from stdin failed: COPY commands are only supported using the CopyManager API. [57014] ERROR: COPY from stdin failed: COPY commands are only supported using the CopyManager API.
[11:21:06] 在位置COPY webapi.concept_of_interest, line 1 [11:21:06] 在位置COPY webapi.concept_of_interest, line 1
``` ```
- 用pgAdmin 还原时,会报错: - 用pgAdmin 还原时,会报错:
```shell ```shell
pg_restore.exe --host "192.168.1.1" --port "5432" --username "postgres" --no-password --dbname "webapi" --verbose "D:\\backup\\webapi.sql" pg_restore.exe --host "192.168.1.1" --port "5432" --username "postgres" --no-password --dbname "webapi" --verbose "D:\\backup\\webapi.sql"
pg_restore: 错误: 输入文件看起来像是文本格式的dump. 请使用psql. pg_restore: 错误: 输入文件看起来像是文本格式的dump. 请使用psql.
@ -190,8 +188,6 @@ pg_dump.exe -d "rural_house_330000" -h "192.168.4.199" -p "5432" -U "postgres" -
pg_dump. --inserts --dbname=postgresql://postgres:rural_house_330000@192.168.4.199:5432/rural_house_330000 -t "risk_census_house_330100_jffx" >D:\augurit\backup\jffx.sql pg_dump. --inserts --dbname=postgresql://postgres:rural_house_330000@192.168.4.199:5432/rural_house_330000 -t "risk_census_house_330100_jffx" >D:\augurit\backup\jffx.sql
``` ```
**可能遇到的问题:** **可能遇到的问题:**
`pg_dump`命令需要输入密码才能执行。若想无需密码导数据有以下两种解决方法: `pg_dump`命令需要输入密码才能执行。若想无需密码导数据有以下两种解决方法:
@ -208,7 +204,6 @@ export PGPASSWORD=''
# TYPE DATABASE USER ADDRESS METHOD # TYPE DATABASE USER ADDRESS METHOD
# IPv4 local connections: # IPv4 local connections:
host all all 127.0.0.1/32 md5 host all all 127.0.0.1/32 md5
``` ```
- TYPE连接方式'local'unix-domain的socket连接、`host` (TCP/IP socket)、`hostssl`(SSL加密的TCP/IP socket) - TYPE连接方式'local'unix-domain的socket连接、`host` (TCP/IP socket)、`hostssl`(SSL加密的TCP/IP socket)
@ -220,15 +215,15 @@ host all all 127.0.0.1/32 md5
- ADDRESS该参数可以为 `主机名称` 或者`IP/32(IPV4) `或 `IP/128(IPV6)`,主机名称以 `.`开头,`samehost`或`samenet` 匹配任意Ip地址 - ADDRESS该参数可以为 `主机名称` 或者`IP/32(IPV4) `或 `IP/128(IPV6)`,主机名称以 `.`开头,`samehost`或`samenet` 匹配任意Ip地址
- METHOD该值可以为"trust", "reject", "md5", "password", "scram-sha-256","gss", "sspi", "ident", "peer", "pam", "ldap", "radius" or "cert" - METHOD该值可以为"trust", "reject", "md5", "password", "scram-sha-256","gss", "sspi", "ident", "peer", "pam", "ldap", "radius" or "cert"
> trust:无条件地允许联接。建议测试用 > trust:无条件地允许联接。建议测试用
> >
> reject:联接无条件拒绝。从一个组中"过滤"某些主机。 > reject:联接无条件拒绝。从一个组中"过滤"某些主机。
> >
> md5:密码认证方式。密码是以md5形式传送给数据库 > md5:密码认证方式。密码是以md5形式传送给数据库
> >
> password要求客户端提供一个未加密的口令进行认证。 > password要求客户端提供一个未加密的口令进行认证。
> >
> ident是Linux下PostgreSQL默认的local认证方式 > ident是Linux下PostgreSQL默认的local认证方式
例子表示允许 ip为127.0.0.1的所有用户通过md5加密的密码方式连接主机上的所有数据库 例子表示允许 ip为127.0.0.1的所有用户通过md5加密的密码方式连接主机上的所有数据库
@ -242,8 +237,6 @@ host all all 127.0.0.1/32 md5
8 -> 192.0.0.0/8 表示只要来自192.0.0.0 ~ 192.255.255.255的都合法; 8 -> 192.0.0.0/8 表示只要来自192.0.0.0 ~ 192.255.255.255的都合法;
``` ```
### 3.还原pg_restore ### 3.还原pg_restore
pg_restore — 从pg_dump创建的档案文件中恢复PostgreSQL数据库是一种实用程序用于以非明文格式之一的[pg_dump](https://www.postgresql.org/docs/12/app-pgdump.html)创建的存档文件中恢复PostgreSQL数据库 pg_restore — 从pg_dump创建的档案文件中恢复PostgreSQL数据库是一种实用程序用于以非明文格式之一的[pg_dump](https://www.postgresql.org/docs/12/app-pgdump.html)创建的存档文件中恢复PostgreSQL数据库
@ -256,43 +249,43 @@ pg_restore[ connection-option...] [ option...] [ filename]
一般选项: 一般选项:
```javascript ```javascript
-d, --dbname=名字 连接数据库名字 -d, --dbname=名字 连接数据库名字
-f, --file=文件名 输出文件名 -f, --file=文件名 输出文件名
-F, --format=c|d|t 备份文件格式(应该自动进行) -F, --format=c|d|t 备份文件格式(应该自动进行)
-l, --list 打印归档文件的 TOC 概述 -l, --list 打印归档文件的 TOC 概述
-v, --verbose 详细模式 -v, --verbose 详细模式
-V, --version 输出版本信息, 然后退出 -V, --version 输出版本信息, 然后退出
-?, --help 显示此帮助, 然后退出 -?, --help 显示此帮助, 然后退出
``` ```
恢复控制选项: 恢复控制选项:
```javascript ```javascript
-a, --data-only 只恢复数据, 不包括模式 -a, --data-only 只恢复数据, 不包括模式
-c, --clean 在重新创建之前,先清除(删除)数据库对象 -c, --clean 在重新创建之前,先清除(删除)数据库对象
-C, --create 创建目标数据库 -C, --create 创建目标数据库
-e, --exit-on-error 发生错误退出, 默认为继续 -e, --exit-on-error 发生错误退出, 默认为继续
-I, --index=NAME 恢复指定名称的索引 -I, --index=NAME 恢复指定名称的索引
-j, --jobs=NUM 执行多个并行任务进行恢复工作 -j, --jobs=NUM 执行多个并行任务进行恢复工作
-L, --use-list=FILENAME 从这个文件中使用指定的内容表排序输出 -L, --use-list=FILENAME 从这个文件中使用指定的内容表排序输出
-n, --schema=NAME 在这个模式中只恢复对象 -n, --schema=NAME 在这个模式中只恢复对象
-O, --no-owner 不恢复对象所属者 -O, --no-owner 不恢复对象所属者
-P, --function=NAME(args) 恢复指定名字的函数 -P, --function=NAME(args) 恢复指定名字的函数
-s, --schema-only 只恢复模式, 不包括数据 -s, --schema-only 只恢复模式, 不包括数据
-S, --superuser=NAME 使用指定的超级用户来禁用触发器 -S, --superuser=NAME 使用指定的超级用户来禁用触发器
-t, --table=NAME 恢复命名表 -t, --table=NAME 恢复命名表
-T, --trigger=NAME 恢复指定名字的触发器 -T, --trigger=NAME 恢复指定名字的触发器
-x, --no-privileges 跳过处理权限的恢复 (grant/revoke) -x, --no-privileges 跳过处理权限的恢复 (grant/revoke)
-1, --single-transaction 作为单个事务恢复 -1, --single-transaction 作为单个事务恢复
--disable-triggers 在只恢复数据的过程中禁用触发器 --disable-triggers 在只恢复数据的过程中禁用触发器
--enable-row-security 启用行安全性 --enable-row-security 启用行安全性
--if-exists 当删除对象时使用IF EXISTS --if-exists 当删除对象时使用IF EXISTS
--no-data-for-failed-tables 对那些无法创建的表不进行数据恢复 --no-data-for-failed-tables 对那些无法创建的表不进行数据恢复
--no-security-labels 不恢复安全标签信息 --no-security-labels 不恢复安全标签信息
--no-tablespaces 不恢复表空间的分配信息 --no-tablespaces 不恢复表空间的分配信息
--section=SECTION 恢复命名节 (数据前、数据及数据后) --section=SECTION 恢复命名节 (数据前、数据及数据后)
--use-set-session-authorization 使用 SESSION AUTHORIZATION 命令代替ALTER OWNER 命令来设置所有权 --use-set-session-authorization 使用 SESSION AUTHORIZATION 命令代替ALTER OWNER 命令来设置所有权
``` ```
联接选项: 联接选项:
@ -328,8 +321,6 @@ pg_restore --host "192.168.1.1" --port "5432" --username "postgres" --no-passwor
如果pg的数据目录没有挂载出来可以用`docker cp [source] [target]`命令将备份文件拷贝出来或获取备份文件。 如果pg的数据目录没有挂载出来可以用`docker cp [source] [target]`命令将备份文件拷贝出来或获取备份文件。
### 参考文章 ### 参考文章
[1] https://www.jianshu.com/p/74063898e9ff [1] https://www.jianshu.com/p/74063898e9ff
@ -337,12 +328,3 @@ pg_restore --host "192.168.1.1" --port "5432" --username "postgres" --no-passwor
[2] https://blog.csdn.net/u011365831/article/details/79497596 [2] https://blog.csdn.net/u011365831/article/details/79497596
[3] https://www.5axxw.com/questions/content/u5jus5 [3] https://www.5axxw.com/questions/content/u5jus5

View File

@ -28,7 +28,7 @@ categories:
4. 相对容易处理冲突。 4. 相对容易处理冲突。
5. 大部分操作在本地完成,不需要联网。 5. 大部分操作在本地完成,不需要联网。
## 二、安装配置 ## 二、安装配置
**windows** **windows**
@ -51,13 +51,13 @@ Git 提供了一个叫做 git config 的工具(译注:实际是 git-config
配置Git环境 配置Git环境
- 全局配置:/etc/gitconfig 文件:系统中对所有用户都普遍适用的配置。 - 全局配置:/etc/gitconfig 文件:系统中对所有用户都普遍适用的配置。
```shell ```shell
$ git config --system user.name "John Doe" $ git config --system user.name "John Doe"
``` ```
- 用户级别配置:~/.gitconfig 文件:用户目录下的配置文件只适用于该用户。 - 用户级别配置:~/.gitconfig 文件:用户目录下的配置文件只适用于该用户。
```shell ```shell
# 一般使用用户级别 # 一般使用用户级别
# 创建Gitbase账号 # 创建Gitbase账号
@ -71,9 +71,7 @@ Git 提供了一个叫做 git config 的工具(译注:实际是 git-config
$ git config --list $ git config --list
``` ```
## 三、`Git`常用命令
## 三、`Git`常用命令
![image-20210105165728632](./images/image-20210105165728632.png) ![image-20210105165728632](./images/image-20210105165728632.png)
@ -142,8 +140,6 @@ $ git log
2. `git reset HEAD`— 已经git add的文件可以用这个取消add然后用上一条命令恢复 2. `git reset HEAD`— 已经git add的文件可以用这个取消add然后用上一条命令恢复
3. `git reset hard HEAD `—把全部更改的文件都恢复(慎用) 3. `git reset hard HEAD `—把全部更改的文件都恢复(慎用)
**远程服务器** **远程服务器**
```shell ```shell
@ -178,7 +174,7 @@ $ git remote add origin 仓库地址
- `git fetch <remote>`:会抓取克隆或上次抓取后所有的新推送 - `git fetch <remote>`:会抓取克隆或上次抓取后所有的新推送
- `git pull <remote>`:会从最初克隆的服务器上抓取数据并自动尝试合并到当前所在的分支(**更新操作**) - `git pull <remote>`:会从最初克隆的服务器上抓取数据并自动尝试合并到当前所在的分支(**更新操作**)
> `git fetch` 命令只会将数据下载到你的本地仓库,它并不会自动合并或修改你当前的工作。 > `git fetch` 命令只会将数据下载到你的本地仓库,它并不会自动合并或修改你当前的工作。
```shell ```shell
@ -187,7 +183,6 @@ $ git pull 仓库地址 master
#更新拉取远程master的代码 #更新拉取远程master的代码
$ git pull origin master $ git pull origin master
``` ```
#### 3.提交操作 #### 3.提交操作
@ -202,21 +197,23 @@ $ git push -u origin master
- `git remote remove <remote>`:移除远程仓库 - `git remote remove <remote>`:移除远程仓库
- `git remote rename <oldname> <newname>`:重命名 - `git remote rename <oldname> <newname>`:重命名
#### 4.分支 #### 4.分支
- `git branch`:显示所有本地分支 - `git branch`:显示所有本地分支
- `git branch 分支名`:创建分支 - `git branch 分支名`:创建分支
- `git branch -d 分支名`:删除本地分支 - `git branch -d 分支名`:删除本地分支
- `git checkout 分支名`:切换分支 - `git checkout 分支名`:切换分支
- `git pull origin master`拉取远程master分支 - `git pull origin master`拉取远程master分支
- `git merge 分支名`:合并指定分支到当前分支 - `git merge 分支名`:合并指定分支到当前分支
- `git push origin master`:上传代码并合并 - `git push origin master`:上传代码并合并
- `git push origin feature-branch:feature-branch` //推送本地的feature-branch(冒号前面的)分支到远程origin的feature-branch(冒号后面的)分支(没有会自动创建) - `git push origin feature-branch:feature-branch` //推送本地的feature-branch(冒号前面的)分支到远程origin的feature-branch(冒号后面的)分支(没有会自动创建)
```shell ```shell
$ git pull $ git pull
@ -226,10 +223,6 @@ $ git commit -m '备注'
$ git push $ git push
``` ```
## 四、应用 ## 四、应用
在`gitlab`上创建一个git仓库空项目有三种情况上传项目 在`gitlab`上创建一个git仓库空项目有三种情况上传项目
@ -280,8 +273,6 @@ $ git remote -v
$ git set-url origin 仓库地址 $ git set-url origin 仓库地址
``` ```
**分支** **分支**
场景:有时候我们开发需要开一个分支,这样可以有效的并行开发. 场景:有时候我们开发需要开一个分支,这样可以有效的并行开发.
@ -289,28 +280,26 @@ $ git set-url origin 仓库地址
开分支有两种方式: 开分支有两种方式:
+ 一种是在远程开好分支,本地直接拉下来; + 一种是在远程开好分支,本地直接拉下来;
```shell ```shell
git checkout -b 本地分支名 origin/远程分支名XXX //检出远程的XX分支到本地 git checkout -b 本地分支名 origin/远程分支名XXX //检出远程的XX分支到本地
``` ```
使用这种方式会在本地仓库新建分支xxx并自动切换到新建的分支xxx当然了远程分支xxx的代码也拉取到了本地分支xxx中。采用这种方法建立的本地分支会和远程分支建立映射关系。 使用这种方式会在本地仓库新建分支xxx并自动切换到新建的分支xxx当然了远程分支xxx的代码也拉取到了本地分支xxx中。采用这种方法建立的本地分支会和远程分支建立映射关系。
+ 一种是本地开好分支,推送到远程. + 一种是本地开好分支,推送到远程.
```shell ```shell
$ git checkout -b feature-branch //创建并切换到分支feature-branch $ git checkout -b feature-branch //创建并切换到分支feature-branch
$ git push origin feature-branch:feature-branch //推送本地的feature-branch(冒号前面的)分支到远程origin的feature-branch(冒号后面的)分支(没有会自动创建) $ git push origin feature-branch:feature-branch //推送本地的feature-branch(冒号前面的)分支到远程origin的feature-branch(冒号后面的)分支(没有会自动创建)
``` ```
+ 当本地没有其他分支时,可以直接克隆分支下来
+ 当本地没有其他分支时,可以直接克隆分支下来
```shell ```shell
$ git clone -b 分支名 仓库地址 $ git clone -b 分支名 仓库地址
``` ```
> git fetch 命令可以刷新本地的远程分支列表 > git fetch 命令可以刷新本地的远程分支列表
项目实战: 项目实战:
@ -327,21 +316,4 @@ git pull origin dev
# 4.合并远程的分支到dev分 # 4.合并远程的分支到dev分
git merge origin 分支名 git merge origin 分支名
``` ```

View File

@ -8,8 +8,6 @@ tags:
- GeoTools - GeoTools
--- ---
### GeoTools-快速起步 ### GeoTools-快速起步
#### 1.maven构建 #### 1.maven构建
@ -22,8 +20,6 @@ tags:
![image-20231120113304413](./images/image-20231120113304413.png) ![image-20231120113304413](./images/image-20231120113304413.png)
#### 2. 添加依赖 #### 2. 添加依赖
```xml ```xml
@ -31,7 +27,7 @@ tags:
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target> <maven.compiler.target>1.7</maven.compiler.target>
<!-- 指定geotools的版本号--> <!-- 指定geotools的版本号-->
<geotools.version>31-SNAPSHOT</geotools.version> <geotools.version>31-SNAPSHOT</geotools.version>
<maven.deploy.skip>true</maven.deploy.skip> <maven.deploy.skip>true</maven.deploy.skip>
</properties> </properties>
@ -73,8 +69,6 @@ tags:
</dependencies> </dependencies>
``` ```
#### 3. 主程序 #### 3. 主程序
```java ```java
@ -104,7 +98,7 @@ public class Quickstart {
* contents on the screen in a map frame * contents on the screen in a map frame
*/ */
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
File file = JFileDataStoreChooser.showOpenFile("shp", null); File file = JFileDataStoreChooser.showOpenFile("shp", null);
if (file == null) { if (file == null) {
return; return;
@ -133,8 +127,6 @@ public class Quickstart {
注意shp文件没有被加载到内存中而是每次需要时都从磁盘读取它。这种方式允许您处理大于内存的数据集。 注意shp文件没有被加载到内存中而是每次需要时都从磁盘读取它。这种方式允许您处理大于内存的数据集。
#### 4. advance #### 4. advance
为了更好的交互体验,我们可以通过`DataStoreFinder`获取数据源时添加额外的参数,如设置缓存、创建空间索引等方法来优化。 为了更好的交互体验,我们可以通过`DataStoreFinder`获取数据源时添加额外的参数,如设置缓存、创建空间索引等方法来优化。
@ -151,4 +143,3 @@ params.put("charset", "UTF-8");
DataStore store = DataStoreFinder.getDataStore(params); DataStore store = DataStoreFinder.getDataStore(params);
SimpleFeatureSource featureSource = store.getFeatureSource(store.getTypeNames()[0]); SimpleFeatureSource featureSource = store.getFeatureSource(store.getTypeNames()[0]);
``` ```

View File

@ -14,10 +14,10 @@ tags:
GeoTools是一个开源(LGPL) Java代码库它为地理空间数据的操作提供了符合标准的方法例如实现地理信息系统。GeoTools库数据结构基于开放地理空间联盟(OGC)规范。 GeoTools是一个开源(LGPL) Java代码库它为地理空间数据的操作提供了符合标准的方法例如实现地理信息系统。GeoTools库数据结构基于开放地理空间联盟(OGC)规范。
了解GeoTools库是如何构建的这有助于您找出需要在应用程序中包含哪些jar。
### 2. GeoTools 库 ### 2. GeoTools 库
> 了解GeoTools库是如何构建的这有助于您找出需要在应用程序中包含哪些jar。
![image-20231128145948967](./images/image-20231128145948967.png) ![image-20231128145948967](./images/image-20231128145948967.png)
GeoTools库形成了一个软件“堆栈”每个模块都建立在前一个定义的模块之上。 GeoTools库形成了一个软件“堆栈”每个模块都建立在前一个定义的模块之上。
@ -31,25 +31,25 @@ GeoTools库形成了一个软件“堆栈”每个模块都建立在前一个
下面是各个模块的作用: 下面是各个模块的作用:
| Module | Purpose | | Module | Purpose |
| :--------------- | :----------------------------------------------------------- | |:---------------- |:--------------------------------------------------------------- |
| `gt-render` | Map API, with Java2D rendering engine for mapping. | | `gt-render` | Map API, with Java2D rendering engine for mapping. |
| `gt-jdbc` | Implements for accessing spatial database | | `gt-jdbc` | Implements for accessing spatial database |
| `gt-xml` | Implements of common spatial XML formats | | `gt-xml` | Implements of common spatial XML formats |
| `gt-cql` | Implements of Common Query Language for filters | | `gt-cql` | Implements of Common Query Language for filters |
| `gt-coverage` | Implementation for accessing raster information | | `gt-coverage` | Implementation for accessing raster information |
| `gt-main` | Data API, with default implementations of filter, feature, etc… | | `gt-main` | Data API, with default implementations of filter, feature, etc… |
| `gt-referencing` | Implementation of co-ordinate location and transformation | | `gt-referencing` | Implementation of coordinate location and transformation |
| `gt-metadata` | Implementation of identification and description | | `gt-metadata` | Implementation of identification and description |
| `gt-api` | Definition of interfaces for common spatial concepts | | `gt-api` | Definition of interfaces for common spatial concepts |
| `jts` | JTS Topology Suite (external library) implementing Geometry | | `jts` | JTS Topology Suite (external library) implementing Geometry |
### 3. GeoTools 插件 ### 3. GeoTools 插件
GeoTools提供插件来支持额外的数据格式和不同的坐标参考系统等功能。 GeoTools提供插件来支持额外的数据格式和不同的坐标参考系统等功能。
| Module | JAR | Plugin | | Module | JAR | Plugin |
| :--------------- | :------------------ | :------------------------------- | |:---------------- |:------------------- |:-------------------------------- |
| `gt-render` | | | | `gt-render` | | |
| `gt-jdbc` | `gt-jdbc-db2` | Geometry in DB2 | | `gt-jdbc` | `gt-jdbc-db2` | Geometry in DB2 |
| | `gt-jdbc-h2` | Pure Java “H2” database | | | `gt-jdbc-h2` | Pure Java “H2” database |
@ -76,8 +76,6 @@ GeoTools提供插件来支持额外的数据格式和不同的坐标参考系统
通常每个层至少需要一个插件才能让GeoTools做一些事情。 通常每个层至少需要一个插件才能让GeoTools做一些事情。
### 4.GeoTools 扩展 ### 4.GeoTools 扩展
更进一步在GeoTools库的基础上实现了一些有趣的“扩展”。这些扩展提供了使用核心库的全部功能构建在GeoTools之上的额外功能。 更进一步在GeoTools库的基础上实现了一些有趣的“扩展”。这些扩展提供了使用核心库的全部功能构建在GeoTools之上的额外功能。
@ -87,7 +85,7 @@ GeoTools提供插件来支持额外的数据格式和不同的坐标参考系统
这些扩展相互独立,可能在您的应用程序中使用: 这些扩展相互独立,可能在您的应用程序中使用:
| JAR | Extension | | JAR | Extension |
| :-------------- | :--------------------------------------------------- | |:--------------- |:---------------------------------------------------- |
| `gt-app-schema` | Map from application schema to complex feature model | | `gt-app-schema` | Map from application schema to complex feature model |
| `gt-brewer` | Generation of styles using color brewer | | `gt-brewer` | Generation of styles using color brewer |
| `gt-complex` | Support for making custom complex feature model | | `gt-complex` | Support for making custom complex feature model |
@ -105,7 +103,7 @@ GeoTools提供插件来支持额外的数据格式和不同的坐标参考系统
为了支持GeoTools中的XML模块我们以JAR形式捆绑了几个XML模式(以避免每次需要时都需要从Internet下载它们)。此外这些jar包含一个由Eclipse Modeling Framework生成的Java数据结构。 为了支持GeoTools中的XML模块我们以JAR形式捆绑了几个XML模式(以避免每次需要时都需要从Internet下载它们)。此外这些jar包含一个由Eclipse Modeling Framework生成的Java数据结构。
| JAR | Schema | | JAR | Schema |
| :---------------- | :---------------------------- | |:----------------- |:----------------------------- |
| `net.opengis.ows` | open web services schema | | `net.opengis.ows` | open web services schema |
| `net.opengis.wfs` | web feature service | | `net.opengis.wfs` | web feature service |
| `net.opengis.wps` | web processing service schema | | `net.opengis.wps` | web processing service schema |
@ -116,7 +114,7 @@ GeoTools提供插件来支持额外的数据格式和不同的坐标参考系统
XSD解析器通过一系列XSD插件使用这些工具。这些插件指示如何使用Eclipse XSD库解析和编码附加内容以解析XML模式文档并提供“绑定”显示如何解析和编码Java类如String、Date、URL和Geometry。 XSD解析器通过一系列XSD插件使用这些工具。这些插件指示如何使用Eclipse XSD库解析和编码附加内容以解析XML模式文档并提供“绑定”显示如何解析和编码Java类如String、Date、URL和Geometry。
| JAR | Bindings | | JAR | Bindings |
| :-------------- | :-------------------------------- | |:--------------- |:--------------------------------- |
| `gt-xsd-core` | Basic types defined by XML schema | | `gt-xsd-core` | Basic types defined by XML schema |
| `gt-xsd-fes` | filter 2.0 | | `gt-xsd-fes` | filter 2.0 |
| `gt-xsd-filter` | filter (used by OGC CAT and WFS) | | `gt-xsd-filter` | filter (used by OGC CAT and WFS) |
@ -130,6 +128,22 @@ XSD解析器通过一系列XSD插件使用这些工具。这些插件指示如
| `gt-xsd-wms` | web map service | | `gt-xsd-wms` | web map service |
| `gt-xsd-sld` | style layer descriptor | | `gt-xsd-sld` | style layer descriptor |
#### 参考文章 ### 6. 不支持的部分
还有一些“不支持”的插件和扩展。这些模块不是由项目管理委员会作为GeoTools下载的一部分分发的但是它们可以通过maven或个人下载获得。
| Unsupported | Purpose |
| ------------ | ----------------------------------------- |
| `gt-swt` | Standard widget toolkit interactive map |
| `gt-swing` | Swing interactive map |
| `gt-oracle` | retired oracle support |
| `gt-postgis` | retired PostGIS support`gt-jdbc-postgis` |
| `gt-db2` | retired db2 support |
| `gt-wps` | Web Processing Service client |
| `gt-process` | Job system for spatial data |
### 参考文章
[1] architecture https://docs.geotools.org/latest/userguide/welcome/architecture.html [1] architecture https://docs.geotools.org/latest/userguide/welcome/architecture.html

View File

@ -11,7 +11,7 @@ tags:
### GeoTools-创建要素 ### GeoTools-创建要素
> csv2shp通过csv转点shp文件学习 > csv2shp通过csv转点shp文件学习
> >
> 1. 如何创建`FeatureType`、`FeatureCollection`和`Features` > 1. 如何创建`FeatureType`、`FeatureCollection`和`Features`
> 2. 通过`GeometryFactory`构建`Points`点集; > 2. 通过`GeometryFactory`构建`Points`点集;
> 3. 输出shp文件 > 3. 输出shp文件
@ -40,8 +40,6 @@ LAT, LON, CITY, NUMBER
50.733992,7.099814,Bonn,700,2016 50.733992,7.099814,Bonn,700,2016
``` ```
#### 2.添加依赖 #### 2.添加依赖
```xml ```xml
@ -75,8 +73,6 @@ LAT, LON, CITY, NUMBER
</repositories> </repositories>
``` ```
#### 3. 示例 #### 3. 示例
```java ```java
@ -217,7 +213,7 @@ public class Csv2Shape {
* 添加类型描述 * 添加类型描述
*/ */
newDataStore.createSchema(TYPE); newDataStore.createSchema(TYPE);
/* /*
* Write the features to the shapefile * Write the features to the shapefile
* 创建“create”类型的事务输出shapefile文件 * 创建“create”类型的事务输出shapefile文件
@ -293,17 +289,14 @@ public class Csv2Shape {
return newFile; return newFile;
} }
} }
``` ```
#### 4. 归纳 #### 4. 归纳
下面是Java中的一些对象与`Geospatial`中的类的对应关系: 下面是Java中的一些对象与`Geospatial`中的类的对应关系:
| Java | Geospatial | | Java | Geospatial |
| :------- | :------------ | |:-------- |:------------- |
| `Object` | `Feature` | | `Object` | `Feature` |
| `Class` | `FeatureType` | | `Class` | `FeatureType` |
| `Field` | `Attribute` | | `Field` | `Attribute` |
@ -312,16 +305,12 @@ public class Csv2Shape {
1. 先创建 `SimpleFeatureType`,就像新建了一个`shpefile`文件一样定义了shp 文件名和属性字段。 1. 先创建 `SimpleFeatureType`,就像新建了一个`shpefile`文件一样定义了shp 文件名和属性字段。
2. 通过缓冲流解析文件中的坐标和属性信息,使用`GeometryFactory`几何工厂实例创建几何实例,再通过`featureBuilder`构建要素实例`feature` 2. 通过缓冲流解析文件中的坐标和属性信息,使用`GeometryFactory`几何工厂实例创建几何实例,再通过`featureBuilder`构建要素实例`feature`
##### 数据存储 ##### 数据存储
![image-20231130111920373](./images/image-20231130111920373.png) ![image-20231130111920373](./images/image-20231130111920373.png)
`DataStore`代表一份要素数据的物理的源,如`shpaefile`文件、数据库要素会转为SimpleFeature实例对象 `DataStore`代表一份要素数据的物理的源,如`shpaefile`文件、数据库要素会转为SimpleFeature实例对象
##### 要素存储 ##### 要素存储
`FeatureSource` 提供更易于操作feature data要素数据的API当使用数据源(如shapefile或数据库表)时,您将首先创建一个`DataStore`对象来连接到物理源,然后检索一个`FeatureSource`来处理要素数据。 `FeatureSource` 提供更易于操作feature data要素数据的API当使用数据源(如shapefile或数据库表)时,您将首先创建一个`DataStore`对象来连接到物理源,然后检索一个`FeatureSource`来处理要素数据。
@ -336,12 +325,6 @@ FileDataStore store = FileDataStoreFinder.getDataStore(file);
FeatureSource featureSource = store.getFeatureSource(); FeatureSource featureSource = store.getFeatureSource();
``` ```
##### **事务** ##### **事务**
`Transaction` 是有要素存储`FeatureStore`的事务控制器。 `Transaction` 是有要素存储`FeatureStore`的事务控制器。
@ -350,12 +333,6 @@ FeatureSource featureSource = store.getFeatureSource();
所有操作都被认为是在一个事务中进行的。`Transaction.AUTO_COMMIT`用于表示自动提交事务模式。 所有操作都被认为是在一个事务中进行的。`Transaction.AUTO_COMMIT`用于表示自动提交事务模式。
#### 参考文章 #### 参考文章
[1] Feature Tutorial https://docs.geotools.org/latest/userguide/tutorial/feature/csv2shp.html [1] Feature Tutorial https://docs.geotools.org/latest/userguide/tutorial/feature/csv2shp.html

View File

@ -16,13 +16,13 @@ tags:
个人观点Java关于`JDBC`的一些概念,与`GeoTools`中的类的对应关系如下: 个人观点Java关于`JDBC`的一些概念,与`GeoTools`中的类的对应关系如下:
| GeoTools | JDBC | | | GeoTools | JDBC | |
| :-------------------- | :-------------------------- | ---------------------- | |:--------------------- |:------------------- | ----------- |
| `FeatureStore` | `Connection` | 数据库连接 | | `FeatureStore` | `Connection` | 数据库连接 |
| `FeatureSource` | `PreparedStatement`|`Table` | 句柄:语句执行者 | | `FeatureSource` | `PreparedStatement` | `Table` |
| `FeatureCollection` | `ResultSet` | 结果集 | | `FeatureCollection` | `ResultSet` | 结果集 |
| `AttributeDescriptor` | `ResultSetMetaData` | 结果集元数据(属性列) | | `AttributeDescriptor` | `ResultSetMetaData` | 结果集元数据(属性列) |
| `FeatureIterator` | | | | `FeatureIterator` | | |
示例: 示例:
@ -63,50 +63,6 @@ while(simpleFeatureIterator.hasNext()) {
``` ```
从上述可以看到,不管是什么类型的数据源,访问的顺序是先通过`FeatureStore`连接数据源,然后从`store`中获取`FeatureSource`(类似于表),最后通过`cql`类来构建查询条件传入`FeatureSource`的`getFeatures`方法中,可以得到满足条件的要素集`FeatureCollection`。 从上述可以看到,不管是什么类型的数据源,访问的顺序是先通过`FeatureStore`连接数据源,然后从`store`中获取`FeatureSource`(类似于表),最后通过`cql`类来构建查询条件传入`FeatureSource`的`getFeatures`方法中,可以得到满足条件的要素集`FeatureCollection`。
1. 对接数据
2. 数据录入
3. 数据展示
4. 资金拨付