geotools

How to create and populate shp file with GeoTools API

我的未来我决定 提交于 2019-12-11 15:59:39
问题 I need to create an empty shape file and populate it with data from my java colletion. Can someone show me an example of how to achieve this? Thanks in advance. 回答1: For full details please see the CSV to Shapefile tutorial. Basically you need to define the Shapefiles columns in a SimpleFeatureType object, the easiest way to do this is to use a SimpleFeatureTypeBuilder . Here is generated from directly using a utility method to save time. final SimpleFeatureType TYPE = DataUtilities

Gradle not imported dependency with ext:pom

不羁的心 提交于 2019-12-11 10:05:39
问题 I want import library org.geotools. Added raw compile group: 'org.geotools', name: 'geotools', version: '16.1' or compile group: 'org.geotools', name: 'geotools', version: '16.1', ext: 'pom' and repo: repositories { mavenLocal() maven { url 'http://repo.boundlessgeo.com/main' } maven { url "http://download.osgeo.org/webdav/geotools/" } maven { url "http://download.java.net/maven/2" } maven { url "http://repo.opengeo.org" } mavenCentral() } BUILD SUCCESSFUL in 47s but in external libraries it

Exporting HSQLDB database with UTF-8 encoding

喜你入骨 提交于 2019-12-11 04:11:41
问题 I'm trying to export the GeoTools HSQL 2 database and load it back into HSQL 1 for a legacy system that needs the older database format. The tables include characters like the degree symbol. However, it's coming out as the escape sequence \u0080 rather the encoded character. I need to either fix that or have HSQL 1 import convert the escaped characters back into the correct encoding. e.g. cp modules/plugin/epsg-hsql/src/main/resources/org/geotools/referencing/factory/epsg/EPSG.zip /tmp cd

How to Install geotools by gradle in android studio 3.1.2

北慕城南 提交于 2019-12-11 03:26:00
问题 I wan to use geotools in my project so i've added geotools lib in my repositories project gradle : allprojects { repositories { maven { url "http://repo.boundlessgeo.com/main" } maven { url "http://download.osgeo.org/webdav/geotools/" } jcenter() google() } } I have a module called map and i haved added this dependencies to this gradle: dependencies { api 'com.google.android.gms:play-services-maps:15.0.1' api 'org.osmdroid:osmdroid-android:5.6.5' api 'com.github.MKergall:osmbonuspack:6.4' api

How to show maps using GeoTools in Android?

别说谁变了你拦得住时间么 提交于 2019-12-11 01:24:45
问题 I am using Eclipse on Windows XP. I downloaded the GeoTools 2.7.4-bin.zip file and started to add some .jar files to my project. The particularity of my project is that this is an Android one. I am developing an Android application that would allow me to show on a map (google map) some features (points but not only) so i tried to use GeoTools to do that.But Android is not supporting Swings. My code is /*code i m using */ package info.ipower.geotools; import java.io.File; import org.geotools

Show direction of linestring on map - auto zoom on map

冷暖自知 提交于 2019-12-10 22:11:14
问题 I have this code, which plots on a map a linestring which is the track of 2 coordinate points that the user supplies. public class Quickstart { public static void main(String[] args) throws Exception { // display a data store file chooser dialog for shapefiles File file = JFileDataStoreChooser.showOpenFile("shp", null); if (file == null) { return; } FileDataStore store = FileDataStoreFinder.getDataStore(file); SimpleFeatureSource featureSource = store.getFeatureSource(); GeometryFactory gf =

SchemaException in java

ぐ巨炮叔叔 提交于 2019-12-10 21:27:10
问题 I have found a useful tool to convert .csv files into shape files with geotools: But I have a problem running it, I get following maven error: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project tutorial: Command execution failed. Process exited with an error: 1 (Exit value: 1) And an error in this line: final SimpleFeatureType TYPE = DataUtilities.createType( "Location", // <- the name for our feature type "location:Point:srid=4326," + // <- the

Maven package error

自古美人都是妖i 提交于 2019-12-10 20:53:12
问题 I am working on a project which requires a geotools dependency. Before I was getting the following error: Exception in thread "main" java.lang.IllegalStateException: cannot initilize transformation: Authority "EPSG" is unknown or doesn't match the supplied hints. Maybe it is defined in an unreachable JAR file? at com.test.geometricutils.TransformProjection.initializeTransformer(TransformProjection.java:41) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect

Shortest distance between a line segment and a point in WGS84 crs using geotools api

假装没事ソ 提交于 2019-12-10 18:08:37
问题 In geotools you can find distance between two geometries using the distance function in Geometry class. There is a Point subclass of Geometry but no line segment subclass of Geometry. There is however LineSegment class which derives from LineString which is not subclass of Geometry class. I tried using JTS but it appears as JTS is only for Cartesian coordinate system. Question: How to find shortest distance (in meters) between a LineSegment and a Point in WGS84 crs. Please note: I know there

insert geospatial datatype( mutipolygon) in mysql with java( jdbc)

半城伤御伤魂 提交于 2019-12-08 22:37:16
问题 I am using geotools library to extract the location information. With that I am getting an object of type class com.vividsolutions.jts.geom.MultiPolygon I now want to store this field in my mysql table with a jdbc connection . When I directly try to insert it as pstmtInsert.setObject(4, geoobject) I am getting this error Exception in thread "main" com.mysql.jdbc.MysqlDataTruncation: Data truncation: Cannot get geometry object from data you send to the GEOMETRY field 回答1: MySql can't know how