Difference between revisions of "GIS Interface"

From Gcube Wiki
Jump to: navigation, search
(Get Instance)
Line 2: Line 2:
 
The library is designed to rely on GeoNetwork and GeoServer registered in the infrastructure.
 
The library is designed to rely on GeoNetwork and GeoServer registered in the infrastructure.
  
The implementation is based on functionalities exposed by [https://github.com/geosolutions-it/geoserver-manager/wiki geoserver-manager] and [https://github.com/geosolutions-it/geonetwork-manager/wiki geonetwork-manager]. These libraries are both developped by [http://www.geo-solutions.it/ GeoSolutions] under [http://en.wikipedia.org/wiki/MIT_License MIT License].
+
The library relies on ''org.gcube.spatial-data.geonetwork'' (see [[GeoNetwork Library]]) to interact with geonetwork.
 +
Interaction with GeoServer REST interface is based on functionalities exposed by [https://github.com/geosolutions-it/geoserver-manager/wiki geoserver-manager], developed by [http://www.geo-solutions.it/ GeoSolutions] under [http://en.wikipedia.org/wiki/MIT_License MIT License].
  
=Modules=
+
=The library=
 
+
The library is distributed in 2 separate modules :
+
*org.gcube.spatial-data.geonetwork
+
: exposes functionalities to access / write metadata on GeoNetwork. Most applications which need basic functionalities like search and access to metadata should rely only on this component.
+
 
+
*org.gcube.spatial-data.gis-interface
+
: used to manage spatial data to/from GeoServer instances. Applications which generate/publish spatial data in the infrastructure should exploit its functionalities.
+
 
+
==GeoNetwork module==
+
In order to use org.gcube.spatial-data.geonetwork in your Maven project, you need to add this dependecy in your pom.xml file
+
  
 +
The library is a maven artifact with the following coordinates :
 
<source lang="xml">
 
<source lang="xml">
<dependency>
 
 
   <groupId>org.gcube.spatial.data</groupId>
 
   <groupId>org.gcube.spatial.data</groupId>
   <artifactId>geonetwork</artifactId>
+
   <artifactId>gis-interface</artifactId>
  <version>...</version>
+
</dependency>
+
 
</source>
 
</source>
  
please, remind to follow guidelines declared in [[Developing gCube Maven Components]].
 
 
===ISO 19115:2003 metadata compliance===
 
Metadata objects used by the libraries implement [http://www.geoapi.org/ GeoAPI] interfaces, which are fully compliant to [[ISO 19115:2003/19139]]. Current implementation is based on [http://www.geotoolkit.org/modules/metadata/index.html GeoToolkit Metadata] module.
 
 
===Read GeoNetwork metadata===
 
Read Methods exposed by the library are the ones declared by the interface org.gcube.spatial.data.geonetwork.GeoNetworkReader.
 
 
Here are some snippets
 
 
==== Get Instance ====
 
Please note that the library uses the current scope in order to determine which geonetwork it should rely on.
 
<source lang="java">
 
ScopeProvider.instance.set(...);
 
GeoNetworkReader gn=GeoNetwork.get();
 
</source>
 
 
When you test your application, you might don't want to rely on current scope or connect to the gcube infrastructure. You can bypass this behaviour by setting your own configuration like in this snippet.
 
<source lang="java">
 
ConfigurationManager.setConfiguration(new Configuration(){
 
 
        @Override
 
public String getGeoNetworkEndpoint() {
 
return "http://localhost:9999/geonetwork";
 
}
 
 
@Override
 
public String getGeoNetworkUser() {
 
return "admin";
 
}
 
 
@Override
 
public String getGeoNetworkPassword() {
 
return "admin";
 
}
 
 
});
 
GeoNetworkReader localGN=GeoNetwork.get();
 
</source>
 
 
==== Query for metadata ====
 
<source lang="java">
 
// Form query object
 
GNSearchRequest req=new GNSearchRequest();
 
req.addParam(GNSearchRequest.Param.any, "aquamaps");
 
 
// Get Response Object
 
GNSearchResponse resp=gn.query(req);
 
 
if(resp.getCount()!=0) // Some metadata found
 
for(GNSearchResponse.GNMetadata metadata:resp){
 
  long id=metadata.getId(); // id to the actual metadata
 
  Metadata meta=gn.getById(metadata.getUUID());
 
  System.out.println(meta);
 
}
 
</source>
 
 
===Write GeoNetwork metadata===
 
 
==GIS-Interface module==
 
 
==Accessing GeoServer==
 
==Accessing GeoServer==
 
==GeoServer Get Methods==
 
==GeoServer Get Methods==
 
==GeoServer Put Methods==
 
==GeoServer Put Methods==

Revision as of 18:12, 23 May 2013

The GIS-Interface is a java library which exposes methods to access / modify spatial data and related metadata. The library is designed to rely on GeoNetwork and GeoServer registered in the infrastructure.

The library relies on org.gcube.spatial-data.geonetwork (see GeoNetwork Library) to interact with geonetwork. Interaction with GeoServer REST interface is based on functionalities exposed by geoserver-manager, developed by GeoSolutions under MIT License.

The library

The library is a maven artifact with the following coordinates :

  <groupId>org.gcube.spatial.data</groupId>
  <artifactId>gis-interface</artifactId>

Accessing GeoServer

GeoServer Get Methods

GeoServer Put Methods