【GIS系列】GeoTools简介及工具类分享

2024-03-19 05:36

本文主要是介绍【GIS系列】GeoTools简介及工具类分享,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

本文将对GeoTools相关概念进行介绍,同时会给大家分享我工作中用到的工具类及使用方法。

作者:后端小肥肠

目录

1.前言

2. GeoTools简介

3. Geotools使用示例

3.1. 开发环境搭建

3.1.1. 所需版本和工具

3.1.2. pom依赖​​​​​​​

4. 工具类介绍

4.1. 读取shp工具类

4.1.1 准备数据

4.1.2. 部分方法

4.1.3. 完整工具类代码

4.2. 坐标转换工具类

4.2.1. 准备数据

4.2.2. 完整工具类代码

5. 结语

6. 参考链接 


1.前言

GeoTools是一个功能强大的开源GIS工具库,为地理空间数据处理和分析提供了丰富的功能和便利的接口。无论您是GIS专业人士还是对地理空间数据感兴趣的开发人员,掌握GeoTools都是必不可少的。本文将从基本概念入手,介绍GeoTools的功能和使用方法,并重点分享一些实用的工具类和技巧,希望能为您在GIS应用开发中提供帮助和启发。

2. GeoTools简介

GeoTools是一个开源的Java库,用于处理和分析地理空间数据。它提供了一系列用于读取、写入、处理和可视化地理空间数据的工具和API。以下是与GeoTools相关的一些重要概念:

  1. 地理空间数据(Geospatial Data): GeoTools主要用于处理地理空间数据,这包括地图、地形、卫星影像、矢量数据等地理信息。这些数据通常具有地理坐标信息和地理属性信息。

  2. 地理坐标系统(Geographic Coordinate System,GCS): 地理坐标系统是用于在地球上定位点的一种方法。GeoTools支持多种地理坐标系统,包括经纬度坐标系统等。

  3. 投影坐标系统(Projected Coordinate System,PCS): 投影坐标系统是将地球表面的地理坐标投影到平面上的一种方法。GeoTools提供了许多常用的投影方法和投影坐标系统的支持。

  4. 数据格式(Data Formats): GeoTools支持多种地理空间数据格式,如Shapefile、GeoJSON、KML、GML等,可以方便地读取和写入这些数据格式。

  5. 空间分析(Spatial Analysis): GeoTools提供了丰富的空间分析功能,包括缓冲区分析、空间查询、空间叠加分析等,可以帮助用户进行地理空间数据的处理和分析。

总的来说,GeoTools是一个功能丰富的GIS工具库,提供了丰富的功能和工具,可以帮助用户处理和分析各种地理空间数据,并构建地理空间应用。

3. Geotools使用示例

3.1. 开发环境搭建

3.1.1. 所需版本和工具
依赖版本
Spring Boot2.6.14
GeoTools4.4.18
java1.8以上
ArcGis10.8

我这里用的不是GeoTools的最新版本,需要最新版本的同学可登录GeoTools的官网(GeoTools The Open Source Java GIS Toolkit — GeoTools)查看最新版本和其使用规则。

如上图所示,最新版本的GeoTools跟java11适配。

3.1.2. pom依赖
         <dependency><groupId>org.geotools</groupId><artifactId>gt-shapefile</artifactId><version>${geotools.version}</version></dependency><dependency><groupId>org.geotools</groupId><artifactId>gt-geojson</artifactId><version>${geotools.version}</version></dependency><dependency><groupId>org.geotools</groupId><artifactId>gt-swing</artifactId><version>${geotools.version}</version></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-validation</artifactId></dependency>

4. 工具类介绍

4.1. 读取shp工具类

4.1.1 准备数据

打开ArcGis绘制面数据,我这里绘制了4490坐标系的几个面要素。

4.1.2. 部分方法

1. 读取shp中的空间要素信息(wkt)

public static List<String> getWktFromShp(String shpPath) {List<String> shpList = new ArrayList<>();SimpleFeatureCollection simpleFeatureCollection = null;try {//获取文件File file = new File(shpPath);// 读取到数据存储中FileDataStore dataStore = FileDataStoreFinder.getDataStore(file);// 获取特征资源SimpleFeatureSource simpleFeatureSource = dataStore.getFeatureSource();// 要素集合simpleFeatureCollection = simpleFeatureSource.getFeatures();} catch (IOException e) {e.printStackTrace();}// 获取要素迭代器SimpleFeatureIterator featureIterator = simpleFeatureCollection.features();while (featureIterator.hasNext()) {// 要素对象SimpleFeature feature = featureIterator.next();Object geometryText = feature.getDefaultGeometry();log.info(geometryText.toString());shpList.add(geometryText.toString());}featureIterator.close();return shpList;}

2. 运行结果

3. 读取shp文件并将其转换为Geojson

    /*** 构造Geojson结构体* @param featuresJson* @return*/public static JSONObject buildGeoJson(JSONArray featuresJson) {JSONObject Geojson = new JSONObject();Geojson.put("type", "FeatureCollection");Geojson.put("features", featuresJson);return Geojson;}/*** 构造Geojson的features部分 单个** @param geoObject* @param properties* @return*/public static JSONObject buildFeature(Map geoObject, Map properties) {JSONObject featureObject = new JSONObject();Map featureMap = new HashMap();featureMap.put("type", "Feature");featureMap.putAll(geoObject);featureMap.put("properties", properties);featureObject.putAll(featureMap);return featureObject;}/*** 获取空间信息并构造为Map* @param wkt* @return*/public static Map getGeoMap(String wkt) {Map<String, Object> geoMap = new HashMap<>();String json = null;try {WKTReader reader = new WKTReader();Geometry geometry = reader.read(wkt);StringWriter writer = new StringWriter();GeometryJSON g = new GeometryJSON();g.write(geometry, writer);geoMap.put("geometry", writer);} catch (Exception e) {e.printStackTrace();}return geoMap;}/*** 基于shp构造geojson并返回** @param shpPath* @return*/public static JSONObject buildGeojsonFromShp(String shpPath) {JSONArray featureArray = new JSONArray();
//        List<String>shpList=new ArrayList<>();SimpleFeatureCollection simpleFeatureCollection = null;try {
//            要素合集//获取文件File file = new File(shpPath);// 读取到数据存储中ShapefileDataStore dataStore = (ShapefileDataStore) FileDataStoreFinder.getDataStore(file);dataStore.setCharset(Charset.forName("GBK"));// 获取特征资源SimpleFeatureSource simpleFeatureSource = dataStore.getFeatureSource();// 要素集合simpleFeatureCollection = simpleFeatureSource.getFeatures();} catch (IOException e) {e.printStackTrace();}SimpleFeatureIterator featureIterator = simpleFeatureCollection.features();
//            // 要素数量int featureSize = simpleFeatureCollection.size();
//            log.info("要素数量"+featureSize);//创建properties  Mapwhile (featureIterator.hasNext()) {// 要素对象SimpleFeature feature = featureIterator.next();Collection<Property> propertyCollection = (Collection<Property>) feature.getValue();//填充属性mapMap<String, Object> properMap = new HashMap<>();for (Property property : propertyCollection) {if (property.getName().toString().equals("the_geom")) {continue;}properMap.put(property.getName().toString(), property.getValue());}//获取geo信息Object geometryText = feature.getDefaultGeometry();Map geoMap = getGeoMap(geometryText.toString());JSONObject featureObject = buildFeature(geoMap, properMap);featureArray.add(featureObject);}featureIterator.close();JSONObject GeoJson = buildGeoJson(featureArray);return GeoJson;}

4. 运行结果

4.1.3. 完整工具类代码
import lombok.extern.slf4j.Slf4j;
import org.geotools.data.FileDataStore;
import org.geotools.data.FileDataStoreFinder;
import org.geotools.data.shapefile.ShapefileDataStore;
import org.geotools.data.simple.SimpleFeatureCollection;
import org.geotools.data.simple.SimpleFeatureIterator;
import org.geotools.data.simple.SimpleFeatureSource;
import org.geotools.geojson.geom.GeometryJSON;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.GeometryFactory;
import org.locationtech.jts.geom.Point;
import org.locationtech.jts.io.ParseException;
import org.locationtech.jts.io.WKTReader;
import org.locationtech.jts.io.WKTWriter;
import org.opengis.feature.Property;
import org.opengis.feature.simple.SimpleFeature;
import java.io.File;
import java.io.IOException;
import java.io.StringWriter;
import java.nio.charset.Charset;
import java.util.*;/*** @version 1.0* @description: gis工具类* @author: chenss* @date 2024-03-14 16:19*/
@Slf4j
public class GisUtil {public static void main(String[] args) {JSONObject Geojson=buildGeojsonFromShp("D:\\arcgisdata\\mesh4490.shp");log.info(Geojson.toJSONString());
//        List<String> wkts = getWktFromShp("D:\\arcgisdata\\mesh4490.shp");
//        for (String wkt : wkts) {
//            log.info(wkt);
//        }}/*** 构造Geojson结构体* @param featuresJson* @return*/public static JSONObject buildGeoJson(JSONArray featuresJson) {JSONObject Geojson = new JSONObject();Geojson.put("type", "FeatureCollection");Geojson.put("features", featuresJson);return Geojson;}/*** 构造Geojson的features部分 单个** @param geoObject* @param properties* @return*/public static JSONObject buildFeature(Map geoObject, Map properties) {JSONObject featureObject = new JSONObject();Map featureMap = new HashMap();featureMap.put("type", "Feature");featureMap.putAll(geoObject);featureMap.put("properties", properties);featureObject.putAll(featureMap);return featureObject;}/*** 获取空间信息并构造为Map* @param wkt* @return*/public static Map getGeoMap(String wkt) {Map<String, Object> geoMap = new HashMap<>();String json = null;try {WKTReader reader = new WKTReader();Geometry geometry = reader.read(wkt);StringWriter writer = new StringWriter();GeometryJSON g = new GeometryJSON();g.write(geometry, writer);geoMap.put("geometry", writer);} catch (Exception e) {e.printStackTrace();}return geoMap;}/*** 只读取geo信息 wkt** @param shpPath* @return*/public static List<String> getWktFromShp(String shpPath) {List<String> shpList = new ArrayList<>();SimpleFeatureCollection simpleFeatureCollection = null;try {//获取文件File file = new File(shpPath);// 读取到数据存储中FileDataStore dataStore = FileDataStoreFinder.getDataStore(file);// 获取特征资源SimpleFeatureSource simpleFeatureSource = dataStore.getFeatureSource();// 要素集合simpleFeatureCollection = simpleFeatureSource.getFeatures();} catch (IOException e) {e.printStackTrace();}// 获取要素迭代器SimpleFeatureIterator featureIterator = simpleFeatureCollection.features();while (featureIterator.hasNext()) {// 要素对象SimpleFeature feature = featureIterator.next();Object geometryText = feature.getDefaultGeometry();log.info(geometryText.toString());shpList.add(geometryText.toString());}featureIterator.close();return shpList;}/*** 基于shp构造geojson并返回** @param shpPath* @return*/public static JSONObject buildGeojsonFromShp(String shpPath) {JSONArray featureArray = new JSONArray();
//        List<String>shpList=new ArrayList<>();SimpleFeatureCollection simpleFeatureCollection = null;try {
//            要素合集//获取文件File file = new File(shpPath);// 读取到数据存储中ShapefileDataStore dataStore = (ShapefileDataStore) FileDataStoreFinder.getDataStore(file);dataStore.setCharset(Charset.forName("GBK"));// 获取特征资源SimpleFeatureSource simpleFeatureSource = dataStore.getFeatureSource();// 要素集合simpleFeatureCollection = simpleFeatureSource.getFeatures();} catch (IOException e) {e.printStackTrace();}SimpleFeatureIterator featureIterator = simpleFeatureCollection.features();
//            // 要素数量int featureSize = simpleFeatureCollection.size();
//            log.info("要素数量"+featureSize);//创建properties  Mapwhile (featureIterator.hasNext()) {// 要素对象SimpleFeature feature = featureIterator.next();Collection<Property> propertyCollection = (Collection<Property>) feature.getValue();//填充属性mapMap<String, Object> properMap = new HashMap<>();for (Property property : propertyCollection) {if (property.getName().toString().equals("the_geom")) {continue;}properMap.put(property.getName().toString(), property.getValue());}//获取geo信息Object geometryText = feature.getDefaultGeometry();Map geoMap = getGeoMap(geometryText.toString());JSONObject featureObject = buildFeature(geoMap, properMap);featureArray.add(featureObject);}featureIterator.close();JSONObject GeoJson = buildGeoJson(featureArray);return GeoJson;}/*** 根据给定的wkt面求出中心点,并以wkt形式返回*/public static String calculateCenter(String wktPolygon) throws ParseException {// 创建 WKT 解析器和写入器WKTReader reader = new WKTReader(new GeometryFactory());WKTWriter writer = new WKTWriter();// 解析面的几何对象Geometry geometry = reader.read(wktPolygon);// 计算面的中心点Point center = geometry.getCentroid();// 将中心点转换为 WKT 格式String wktCenter = writer.write(center);return wktCenter;}}

4.2. 坐标转换工具类

我这个坐标转换工具只应用于同椭球(本文示例为2000坐标系-EPSG:4490)坐标投影转换。已云南的投影带为33-35,对应的EPSG为4521、4522、4523。

4.2.1. 准备数据

1. 准备4490、4521、4522、4523的shp

2. 获取.prj中坐标描述信息

3. 将坐标描述信息存放到常量Map中

static final  Map<String,String> projMap=new HashMap();
static {projMap.put("4522","PROJCS["CGCS2000_3_Degree_GK_Zone_34",GEOGCS["GCS_China_Geodetic_Coordinate_System_2000",DATUM["D_China_2000",SPHEROID["CGCS2000",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Gauss_Kruger"],PARAMETER["False_Easting",34500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",102.0],PARAMETER["Scale_Factor",1.0],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]");projMap.put("4490","GEOGCS["China Geodetic Coordinate System 2000",\n" +"    DATUM["China_2000",\n" +"        SPHEROID["CGCS2000",6378137,298.257222101,\n" +"            AUTHORITY["EPSG","1024"]],\n" +"        AUTHORITY["EPSG","1043"]],\n" +"    PRIMEM["Greenwich",0,\n" +"        AUTHORITY["EPSG","8901"]],\n" +"    UNIT["degree",0.0174532925199433,\n" +"        AUTHORITY["EPSG","9122"]],\n" +"    AUTHORITY["EPSG","4490"]]");projMap.put("4521","PROJCS["CGCS2000_3_Degree_GK_Zone_33",GEOGCS["GCS_China_Geodetic_Coordinate_System_2000",DATUM["D_China_2000",SPHEROID["CGCS2000",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Gauss_Kruger"],PARAMETER["False_Easting",33500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",99.0],PARAMETER["Scale_Factor",1.0],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]");projMap.put("4523","PROJCS["CGCS2000_3_Degree_GK_Zone_35",GEOGCS["GCS_China_Geodetic_Coordinate_System_2000",DATUM["D_China_2000",SPHEROID["CGCS2000",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Gauss_Kruger"],PARAMETER["False_Easting",35500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",105.0],PARAMETER["Scale_Factor",1.0],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]");
}
4.2.2. 完整工具类代码
import lombok.extern.slf4j.Slf4j;
import org.geotools.data.FeatureWriter;
import org.geotools.data.FileDataStoreFactorySpi;
import org.geotools.data.Transaction;
import org.geotools.data.shapefile.ShapefileDataStore;
import org.geotools.data.shapefile.ShapefileDataStoreFactory;
import org.geotools.data.simple.SimpleFeatureIterator;
import org.geotools.data.simple.SimpleFeatureSource;
import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
import org.geotools.geometry.jts.JTS;
import org.geotools.referencing.CRS;
import org.locationtech.jts.geom.Geometry;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.simple.SimpleFeatureType;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.operation.MathTransform;
import java.io.File;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;@Slf4j
public class ProjTransUtil {static final  Map<String,String> projMap=new HashMap();static {projMap.put("4522","PROJCS[\"CGCS2000_3_Degree_GK_Zone_34\",GEOGCS[\"GCS_China_Geodetic_Coordinate_System_2000\",DATUM[\"D_China_2000\",SPHEROID[\"CGCS2000\",6378137.0,298.257222101]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Gauss_Kruger\"],PARAMETER[\"False_Easting\",34500000.0],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",102.0],PARAMETER[\"Scale_Factor\",1.0],PARAMETER[\"Latitude_Of_Origin\",0.0],UNIT[\"Meter\",1.0]]");projMap.put("4490","GEOGCS[\"China Geodetic Coordinate System 2000\",\n" +"    DATUM[\"China_2000\",\n" +"        SPHEROID[\"CGCS2000\",6378137,298.257222101,\n" +"            AUTHORITY[\"EPSG\",\"1024\"]],\n" +"        AUTHORITY[\"EPSG\",\"1043\"]],\n" +"    PRIMEM[\"Greenwich\",0,\n" +"        AUTHORITY[\"EPSG\",\"8901\"]],\n" +"    UNIT[\"degree\",0.0174532925199433,\n" +"        AUTHORITY[\"EPSG\",\"9122\"]],\n" +"    AUTHORITY[\"EPSG\",\"4490\"]]");projMap.put("4521","PROJCS[\"CGCS2000_3_Degree_GK_Zone_33\",GEOGCS[\"GCS_China_Geodetic_Coordinate_System_2000\",DATUM[\"D_China_2000\",SPHEROID[\"CGCS2000\",6378137.0,298.257222101]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Gauss_Kruger\"],PARAMETER[\"False_Easting\",33500000.0],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",99.0],PARAMETER[\"Scale_Factor\",1.0],PARAMETER[\"Latitude_Of_Origin\",0.0],UNIT[\"Meter\",1.0]]");projMap.put("4523","PROJCS[\"CGCS2000_3_Degree_GK_Zone_35\",GEOGCS[\"GCS_China_Geodetic_Coordinate_System_2000\",DATUM[\"D_China_2000\",SPHEROID[\"CGCS2000\",6378137.0,298.257222101]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Gauss_Kruger\"],PARAMETER[\"False_Easting\",35500000.0],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",105.0],PARAMETER[\"Scale_Factor\",1.0],PARAMETER[\"Latitude_Of_Origin\",0.0],UNIT[\"Meter\",1.0]]");}/*** 根据传入wkt获取数据坐标系* @param wkt* @return*/public static String getProj(String wkt){String resEpsg="";int lonLatStart=-1;//根据wkt字符串判断平面坐标位于哪一度带try {for (int i = 0; i < wkt.length(); i++) {if(Integer.valueOf(wkt.charAt(i))>=48&&Integer.valueOf(wkt.charAt(i))<58){lonLatStart=i;break;}}int lonLatEnd=wkt.indexOf(",");String projLonLat=wkt.substring(lonLatStart,lonLatEnd);String[]lonlat=projLonLat.split(" ");String projLon=lonlat[0];if(projLon.substring(0,2).equals("33")){resEpsg="4521";}else if(projLon.substring(0,2).equals("34")){resEpsg="4522";}else if(projLon.substring(0,2).equals("35")){resEpsg="4523";}elsereturn "4490";} catch (Exception e) {log.info(wkt+"出错");log.error(e.getMessage(),e);}return resEpsg;}/*** 坐标转换* @param geom* @param sourceEpsg* @return*/public static Geometry lonlat2WebMactor(Geometry geom,String sourceEpsg){try{//这里是以OGC WKT形式定义的是World Mercator投影,网页地图一般使用该投影CoordinateReferenceSystem crsSource=CRS.parseWKT(projMap.get(sourceEpsg));CoordinateReferenceSystem crsTarget = CRS.parseWKT(projMap.get("4490"));// 投影转换
//            MathTransform transform = CRS.findMathTransform(DefaultGeographicCRS.WGS84, crsTarget);MathTransform transform = CRS.findMathTransform(crsSource, crsTarget);return JTS.transform(geom, transform);}catch (Exception e) {// TODO Auto-generated catch blocklog.error(e.getMessage(),e);return null;}}/***给定inputshp转换为targetEpsg坐标系,并输出到outputShp位置* @param inputShp* @param outputShp* @param targetEpsg* @return*/public static Map projectShape(String inputShp, String outputShp,String targetEpsg){Map map = new HashMap();try {//源shape文件ShapefileDataStore shapeDS = (ShapefileDataStore) new ShapefileDataStoreFactory().createDataStore(new File(inputShp).toURI().toURL());//创建目标shape文件对象Map<String, Serializable> params = new HashMap<String, Serializable>();FileDataStoreFactorySpi factory = new ShapefileDataStoreFactory();File file=FileUtil.createFileByPath(outputShp);
//            if(!file.exists()){params.put(ShapefileDataStoreFactory.URLP.key,file.toURI().toURL());ShapefileDataStore ds = (ShapefileDataStore) factory.createNewDataStore(params);
//            Charset charset = Charset.forName("UTF-8");
//            ds.setCharset(charset);// 设置属性SimpleFeatureSource fs = shapeDS.getFeatureSource(shapeDS.getTypeNames()[0]);//下面这行还有其他写法,根据源shape文件的simpleFeatureType可以不用retype,而直接用fs.getSchema设置
//            CoordinateReferenceSystem crs = CRS.parseWKT(strWKTMercator);CoordinateReferenceSystem crs = CRS.parseWKT(projMap.get("4490"));ds.createSchema(SimpleFeatureTypeBuilder.retype(fs.getSchema(), crs));//设置writerFeatureWriter<SimpleFeatureType, SimpleFeature> writer = ds.getFeatureWriter(ds.getTypeNames()[0], Transaction.AUTO_COMMIT);//写记录SimpleFeatureIterator it = fs.getFeatures().features();try {while (it.hasNext()) {SimpleFeature f = it.next();SimpleFeature fNew = writer.next();fNew.setAttributes(f.getAttributes());Geometry geom = lonlat2WebMactor((Geometry)f.getAttribute("the_geom"),targetEpsg);fNew.setAttribute("the_geom", geom);}}finally {it.close();}writer.write();writer.close();ds.dispose();shapeDS.dispose();
//            }map.put("status", "success");map.put("message", outputShp);}catch (Exception e) {log.error(e.getMessage(),e);map.put("status", "failure");map.put("message", e.getMessage());}return map;}//    public static void main(String[] args) {
//        String input="D:\\jsonshp\\test.shp";
//        String output="D:\\jsonshp\\test4490.shp";
//        projectShape(input,output);
//    }}

5. 结语

本文对GeoTools的基本概念进行了简介,之后介绍了Geotools的工具类及其具体用法。下一篇文章将讲解Postgis+Geotools+MybatisPlus实现数据的读取,写入及前端展示。对Gis开发领域感兴趣的同学可动动你们发财的小手点点关注~

6. 参考链接 

常见2000坐标系对应的EPSG代号 - 知乎

这篇关于【GIS系列】GeoTools简介及工具类分享的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/824959

相关文章

java图像识别工具类(ImageRecognitionUtils)使用实例详解

《java图像识别工具类(ImageRecognitionUtils)使用实例详解》:本文主要介绍如何在Java中使用OpenCV进行图像识别,包括图像加载、预处理、分类、人脸检测和特征提取等步骤... 目录前言1. 图像识别的背景与作用2. 设计目标3. 项目依赖4. 设计与实现 ImageRecogni

Golang操作DuckDB实战案例分享

《Golang操作DuckDB实战案例分享》DuckDB是一个嵌入式SQL数据库引擎,它与众所周知的SQLite非常相似,但它是为olap风格的工作负载设计的,DuckDB支持各种数据类型和SQL特性... 目录DuckDB的主要优点环境准备初始化表和数据查询单行或多行错误处理和事务完整代码最后总结Duck

Golang的CSP模型简介(最新推荐)

《Golang的CSP模型简介(最新推荐)》Golang采用了CSP(CommunicatingSequentialProcesses,通信顺序进程)并发模型,通过goroutine和channe... 目录前言一、介绍1. 什么是 CSP 模型2. Goroutine3. Channel4. Channe

基于Python开发电脑定时关机工具

《基于Python开发电脑定时关机工具》这篇文章主要为大家详细介绍了如何基于Python开发一个电脑定时关机工具,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 目录1. 简介2. 运行效果3. 相关源码1. 简介这个程序就像一个“忠实的管家”,帮你按时关掉电脑,而且全程不需要你多做

基于C#实现PDF文件合并工具

《基于C#实现PDF文件合并工具》这篇文章主要为大家详细介绍了如何基于C#实现一个简单的PDF文件合并工具,文中的示例代码简洁易懂,有需要的小伙伴可以跟随小编一起学习一下... 界面主要用于发票PDF文件的合并。经常出差要报销的很有用。代码using System;using System.Col

redis-cli命令行工具的使用小结

《redis-cli命令行工具的使用小结》redis-cli是Redis的命令行客户端,支持多种参数用于连接、操作和管理Redis数据库,本文给大家介绍redis-cli命令行工具的使用小结,感兴趣的... 目录基本连接参数基本连接方式连接远程服务器带密码连接操作与格式参数-r参数重复执行命令-i参数指定命

Java中的Opencv简介与开发环境部署方法

《Java中的Opencv简介与开发环境部署方法》OpenCV是一个开源的计算机视觉和图像处理库,提供了丰富的图像处理算法和工具,它支持多种图像处理和计算机视觉算法,可以用于物体识别与跟踪、图像分割与... 目录1.Opencv简介Opencv的应用2.Java使用OpenCV进行图像操作opencv安装j

将Python应用部署到生产环境的小技巧分享

《将Python应用部署到生产环境的小技巧分享》文章主要讲述了在将Python应用程序部署到生产环境之前,需要进行的准备工作和最佳实践,包括心态调整、代码审查、测试覆盖率提升、配置文件优化、日志记录完... 目录部署前夜:从开发到生产的心理准备与检查清单环境搭建:打造稳固的应用运行平台自动化流水线:让部署像

C#读取本地网络配置信息全攻略分享

《C#读取本地网络配置信息全攻略分享》在当今数字化时代,网络已深度融入我们生活与工作的方方面面,对于软件开发而言,掌握本地计算机的网络配置信息显得尤为关键,而在C#编程的世界里,我们又该如何巧妙地读取... 目录一、引言二、C# 读取本地网络配置信息的基础准备2.1 引入关键命名空间2.2 理解核心类与方法

Python pyinstaller实现图形化打包工具

《Pythonpyinstaller实现图形化打包工具》:本文主要介绍一个使用PythonPYQT5制作的关于pyinstaller打包工具,代替传统的cmd黑窗口模式打包页面,实现更快捷方便的... 目录1.简介2.运行效果3.相关源码1.简介一个使用python PYQT5制作的关于pyinstall