maven构建geotools应用工程
前置条件
jdk1.7+eclipse+maven
POM配置
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <groupId>com.lilei.geotools</groupId>
<artifactId>app_geotools</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging> <name>app_geotools</name>
<url>http://maven.apache.org</url> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <geotools.version>12.0</geotools.version>
</properties> <dependencies> <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency> <dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-shapefile</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-swing</artifactId>
<version>${geotools.version}</version>
</dependency> </dependencies> <repositories>
<repository>
<id>nexus2</id>
<name>internal nexus repository2</name>
<!-- <url>http://192.168.1.100:8081/nexus/content/groups/public/</url>-->
<url>http://central.maven.org/maven2/</url>
</repository> <repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net repository</name>
<url>http://download.java.net/maven/2</url>
</repository>
<repository>
<id>osgeo</id>
<name>Open Source Geospatial Foundation Repository</name>
<url>http://download.osgeo.org/webdav/geotools/</url>
</repository>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>boundless</id>
<name>Boundless Maven Repository</name>
<url>http://repo.boundlessgeo.com/main</url>
</repository> </repositories> </project>
程序
package com.lilei.geotools.app_geotools; import java.nio.charset.Charset; import org.geotools.data.shapefile.dbf.DbaseFileHeader;
import org.geotools.data.shapefile.dbf.DbaseFileReader;
import org.geotools.data.shapefile.files.ShpFiles; /**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
DbaseFileReader reader = null;
try {
reader = new DbaseFileReader(new ShpFiles("C:\\Users\\lilei3774\\Desktop\\wuhan\\1\\split-hanzi\\poi.shp"), false,
Charset.forName("utf-8"));
DbaseFileHeader header = reader.getHeader();
int numFields = header.getNumFields(); while (reader.hasNext()) {
try {
Object[] entry = reader.readEntry();
for (int i = 0; i < numFields; i++) {
String title = header.getFieldName(i);
Object value = entry[i];
System.out.println(title + "=" + value);
}
} catch (Exception e) {
e.printStackTrace();
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (reader != null) {
// �ر�
try {
reader.close();
} catch (Exception e) {
}
}
}
}
}
maven构建geotools应用工程的更多相关文章
- maven的三种工程pom、jar、war
阅读数:739 maven中的三种工程: 1.pom工程:用在父级工程或聚合工程中.用来做jar包的版本控制. 2.war工程:将会打包成war,发布在服务器上的工程.如网站或服务. 3.jar工程: ...
- maven的三种工程pom、jar、war的区别
转: maven的三种工程pom.jar.war的区别 2018年09月03日 10:02:53 houjx3 阅读数:2918更多 个人分类: maven 1.pom工程:用在父级工程或聚合工程 ...
- 从零自学Hadoop(09):使用Maven构建Hadoop工程
阅读目录 序 Maven 安装 构建 示例下载 系列索引 本文版权归mephisto和博客园共有,欢迎转载,但须保留此段声明,并给出原文链接,谢谢合作. 文章是哥(mephisto)写的,Source ...
- Maven学习(2) - Maven构建多模块Java工程
概述 项目开发时,通常会将项目分为多个模块进行开发,本文讨论如何用Maven构建多模块的Java工程. 软件环境 Java:1.6.0_26 Maven:3.1.1 OS:WindowXP SP3 项 ...
- maven构建的模块化的JavaWeb工程
最近对maven构建的模块化的JavaWeb工程,比较感兴趣,所以自己就想从头弄一个出来,在此做一个记录,供以后学习. 前置条件:电脑上有eclipse(或者myeclipse,记事本也可以,那样就得 ...
- (转)淘淘商城系列——使用maven构建工程时出现的错误
http://blog.csdn.net/yerenyuan_pku/article/details/72690846 我觉得maven就他妈是一个傻逼,反正我是对它无语了.昨天刚刚使用maven构建 ...
- (转)淘淘商城系列——使用maven构建工程
http://blog.csdn.net/yerenyuan_pku/article/details/72669269 开发工具和环境 这里,我统一规范一下淘淘商城的开发工具和环境,如下: Eclip ...
- SpringCloud核心教程 | 第二篇: 使用Intellij中的maven来快速构建Spring Cloud工程
spring cloud简介 spring cloud 为开发人员提供了快速构建分布式系统的一些工具,包括配置管理.服务发现.断路器.路由.微代理.事件总线.全局锁.决策竞选.分布式会话等等.它运行环 ...
- 使用Eclipse构建GeoTools项目
转自:http://hi.baidu.com/liushuigs/item/a62969e6667f9815585dd8b1 由于GeoTools是原本是使用Maven构建的,所以,不能直接将工程导入 ...
随机推荐
- zoj 1884 简单 键盘 字符 处理
WERTYU Time Limit: 2 Seconds Memory Limit: 65536 KB A common typing error is to place the hands ...
- Hibernate 学习笔记 - 1
一.Hibernate 的环境搭建.配置及 HelloWorld 1.在 Eclipse 中搭建 Hibernate 环境 下载 Hibernate 离线 jar 包(jbosstools-4.4.4 ...
- SQL server 数据库备份大
首先简单的介绍一下Sql server 备份的类型有: 1:完整备份(所有的数据文件和部分的事务日志文件) 2:差异备份(最后一次完成备份后数据库改变的部分) 3:文件和文件组备份(对指定的文件和文件 ...
- CSS滤镜效果
使用 filter: blur() 生成毛玻璃效果 使用 filter: drop-shadow() 生成整体阴影效果 使用 filter: opacity() 生成透明度 blur生成阴影 通常我们 ...
- win10 uwp DataContext
本文告诉大家DataContext的多种绑法. 适合于WPF的绑定和UWP的绑定. 我告诉大家很多个方法,所有的方法都有自己的优点和缺点,可以依靠自己喜欢的用法使用.当然,可以在新手面前秀下,一个页面 ...
- php header的使用,PHP常见header状态总结
<?php//200 正常状态header('HTTP/1.1 200 OK');// 301 永久重定向,记得在后面要加重定向地址 Location:$urlheader('HTTP/1.1 ...
- 面试总结之mysql
总结自己在面试过程遇到的数据库问题,以备不时之需. 1.你在你们公司用的什么版本的mysql数据库,用过mysql5.7吗? 在学校学习mysql的时候用的5.5,在公司的时候用的5.6,5.7还真没 ...
- 使用LINQ TO XML 创建xml文档,以及读取xml文档把内容显示到GridView例子
首先,准备了一个Model类 using System; using System.Collections.Generic; using System.Linq; using System.Text; ...
- 【转】各种图(流程图,思维导图,UML,拓扑图,ER图)简介
原文地址:各种图(流程图,思维导图,UML,拓扑图,ER图)简介 流程图 1.定义:流程图是对过程.算法.流程的一种图像表示,在技术设计.交流及商业简报等领域有广泛的应用. 2.案例 3.计算机语言只 ...
- vue2.0 练习项目-外卖APP(1)
前言 vue这个框架现在挺流行的,作为一个专注前端100年的代码爱好者,学习下路径流行的框架是必须的!在网上搜索vue的项目是比较少的,在官网进行了入门学后,没有一个项目练习巩固下,学了就等于没学,所 ...