Skip to content

Manipulation of geographical and statistical data in Java, with a focus on Eurostat data

License

Notifications You must be signed in to change notification settings

eurostat/JGiscoTools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JGiscoTools

Maven Central

JGiscoTools is a Java library for the manipulation of geospatial and statistical data, with a focus on European data produced by Eurostat and Eurostat-GISCO. The main functionalities are listed here

JGiscoTools is mainly based on GeoTools, JTS Topology Suite and java4eurostat libraries.

Quick start

Load

To load geographical features from a GeoPackage, a Shapefile or a GeoJSON file, use:

Collection<Feature> featuresGPKG = GeoData.getFeatures("C:/myFile.gpkg");
Collection<Feature> featuresSHP = GeoData.getFeatures("C:/myFile.shp");
Collection<Feature> featuresGEOJSON = GeoData.getFeatures("C:/myFile.geojson");

Read

A Feature object has an identifier, a geometry and some attributes. This information can be accessed with:

//load features
Collection<Feature> features = ...;

//print number of features
System.out.println(features.size());

//go through features 
for(Feature f : features) {
	//print the feature identifier
	System.out.println(f.getID());
	//print the feature geometry
	System.out.println(f.getGeometry());
	//print the feature geometry area
	System.out.println(f.getGeometry().getArea());
	//print the feature geometry length
	System.out.println(f.getGeometry().getLength());
	//print the attribute names
	System.out.println(f.getAttributes().keySet());
	//print the attribute "myAttribute1"
	f.getAttribute("myAttribute1");
	//print the attribute "myAttribute2"
	f.getAttribute("myAttribute2");
	...
}

Modify

A Feature object can be modified directly. See for example how to change an attribute value and change the geometry with a buffer of 10m distance:

Feature f = ...
f.setAttribute("myAttribute1", "new value");
f.setGeometry( f.getGeometry().buffer(10) );

Save

To save data as a GeoPackage, a Shapefile or a GeoJSON file, use:

GeoData.save(features, "C:/myFile.gpkg", crs);
GeoData.save(features, "C:/myFile.shp", crs);
GeoData.save(features, "C:/myFile.geojson", crs);

The CRS (Coordinate Reference System) has to be specified, either from an input dataset, or from its EPSG code:

CoordinateReferenceSystem crs = GeoData.getCRS("C:/myFile.gpkg");
CoordinateReferenceSystem crsEPSG = CRS.decode("EPSG:3035")

More information

Setup

JGiscoTools uses Apache Maven. To use JGiscoTools, add it as a dependency to the pom.xml file:

<dependency>
	<groupId>eu.europa.ec.eurostat</groupId>
	<artifactId>jgiscotools</artifactId>
	<version>X.Y.Z</version>
</dependency>

Where X.Y.Z is the current version number, as available Maven central repository.

For more information on how to setup a coding environment based on Eclipse, see this page.

Documentation

See the Javadoc API.

Components

JGiscoTools allows:

  • Manipulation and transformation of vector geographical data such as clustering, generalisation, deformation, filtering, edge matching and partitionning.
  • Generalisation of geographical tesselations such as administrative units.
  • Production of gridded datasets in various GIS formats.
  • Detection of the differences between two versions of a same dataset.
  • Routing and accessibility computation. (TODO document)
  • Automatic production statistical maps (with a focus on maps based on Eurostat data and NUTS regions). (TODO document)
  • Various analyses based on NUTS regions and NUTS codes. (TODO document)
  • Some experiments on the combined use of geographical and statistical data such as
    • Statistical data disaggregation based on dasymetric mapping. (TODO document)
    • The computation of the intersection matrix between two statistical units datasets. (TODO document)
  • ...

Support and contribution

Feel free to ask support, fork the project or simply star it (it's always a pleasure).