Commit a709e0ae authored by bruse's avatar bruse
Browse files

Coordinate Reference Systems are listed by an enumeration type now

parent 7e0e8154
package eu.simstadt.nf4j;
/**
* This enumeration lists some of the "well known texts" (WKT) which are used to identify
* coordinate reference systems (CRS).
*
* @author Marcel Bruse
*
*/
public enum CRSWKT {
EPSG_31467("EPSG:31467"), // DHDN Gauss-Kruger zone 3
EPSG_4326("EPSG:4326"); // WGS 84
/** The well known texts for a CRS. */
public String wkt;
private CRSWKT(String wkt) {
this.wkt = wkt;
}
}
...@@ -261,7 +261,7 @@ public static ProjCoordinate transformCoordinate(ProjCoordinate wgs84Position, ...@@ -261,7 +261,7 @@ public static ProjCoordinate transformCoordinate(ProjCoordinate wgs84Position,
CoordinateReferenceSystem targetCRS) { CoordinateReferenceSystem targetCRS) {
ProjCoordinate result = new ProjCoordinate(); ProjCoordinate result = new ProjCoordinate();
CRSFactory f = new CRSFactory(); CRSFactory f = new CRSFactory();
CoordinateReferenceSystem sourceCRS = f.createFromName("EPSG:4326"); // WGS 84 (used by Google Maps / OpenStreetMap) CoordinateReferenceSystem sourceCRS = f.createFromName(CRSWKT.EPSG_4326.wkt); // WGS 84 (used by Google Maps / OpenStreetMap)
BasicCoordinateTransform transform = new BasicCoordinateTransform(sourceCRS, targetCRS); BasicCoordinateTransform transform = new BasicCoordinateTransform(sourceCRS, targetCRS);
transform.transform(wgs84Position, result); transform.transform(wgs84Position, result);
return result; return result;
...@@ -279,7 +279,7 @@ private static Element appendRegionPolygon(Document doc, List<Coord> regionPolyg ...@@ -279,7 +279,7 @@ private static Element appendRegionPolygon(Document doc, List<Coord> regionPolyg
Element polygon = doc.createElement("polygon"); Element polygon = doc.createElement("polygon");
polygon.setAttribute("srs", "31467"); polygon.setAttribute("srs", "31467");
CRSFactory f = new CRSFactory(); CRSFactory f = new CRSFactory();
CoordinateReferenceSystem targetCRS = f.createFromName("EPSG:31467"); // DHDN Gauss-Kruger zone 3 CoordinateReferenceSystem targetCRS = f.createFromName(CRSWKT.EPSG_31467.wkt); // DHDN Gauss-Kruger zone 3
for (Coord coord : regionPolygon) { for (Coord coord : regionPolygon) {
ProjCoordinate sourcePosition = new ProjCoordinate(coord.longitude, coord.latitude); ProjCoordinate sourcePosition = new ProjCoordinate(coord.longitude, coord.latitude);
ProjCoordinate targetPosition = transformCoordinate(sourcePosition, targetCRS); ProjCoordinate targetPosition = transformCoordinate(sourcePosition, targetCRS);
......
package eu.simstadt.nf4j; package eu.simstadt.nf4j;
public class Main { public class Main {
public static void main(String[] args) { public static void main(String[] args) {
NFConnector connector = new NFConnectorImpl("193.196.136.164"); NFConnector connector = new NFConnectorImpl("193.196.136.164");
ExportJob job = connector.requestExportJob(583); ExportJob job = connector.requestExportJob(584);
System.out.println(job.getJobId() + ": " + job.getStatus() + " - " + job.getStatus().getMessage()); System.out.println(job.getJobId() + ": " + job.getStatus() + " - " + job.getStatus().getMessage());
connector.requestExportJobResult(583);
} }
} }
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment