修改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配置
@ -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、设置开机启动
@ -415,8 +392,6 @@ export JAVA_HOME=/newData/installPackage/jdk1.8.0_291
WantedBy=multi-user.target WantedBy=multi-user.target
``` ```
- 配置开机启动: - 配置开机启动:
```shell ```shell
@ -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配置跨域**
@ -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. 数据库备份的分类类型
@ -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)
@ -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,7 +249,7 @@ 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 备份文件格式(应该自动进行)
@ -264,7 +257,7 @@ pg_restore[ connection-option...] [ option...] [ filename]
-v, --verbose 详细模式 -v, --verbose 详细模式
-V, --version 输出版本信息, 然后退出 -V, --version 输出版本信息, 然后退出
-?, --help 显示此帮助, 然后退出 -?, --help 显示此帮助, 然后退出
``` ```
恢复控制选项: 恢复控制选项:
@ -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

@ -71,8 +71,6 @@ 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
@ -187,7 +183,6 @@ $ git pull 仓库地址 master
#更新拉取远程master的代码 #更新拉取远程master的代码
$ git pull origin master $ git pull origin master
``` ```
#### 3.提交操作 #### 3.提交操作
@ -202,16 +197,18 @@ $ 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`:上传代码并合并
@ -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 仓库地址
``` ```
**分支** **分支**
场景:有时候我们开发需要开一个分支,这样可以有效的并行开发. 场景:有时候我们开发需要开一个分支,这样可以有效的并行开发.
@ -309,8 +300,6 @@ $ git set-url origin 仓库地址
$ 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
@ -73,8 +69,6 @@ tags:
</dependencies> </dependencies>
``` ```
#### 3. 主程序 #### 3. 主程序
```java ```java
@ -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库形成了一个软件“堆栈”每个模块都建立在前一个定义的模块之上。
@ -32,14 +32,14 @@ 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 |
@ -49,7 +49,7 @@ 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

@ -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
@ -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

@ -17,9 +17,9 @@ 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. 资金拨付