annotate gnv-artifacts/src/main/java/de/intevation/gnv/transition/CoordinateSelectionTransition.java @ 238:a157c6042cb4

ODV-export for timeseries completed. gnv-artifacts/trunk@306 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 09 Nov 2009 13:48:50 +0000
parents ee2d4134d0b3
children
rev   line source
173
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1 /**
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
2 *
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
3 */
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
4 package de.intevation.gnv.transition;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
5
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
6 import java.util.ArrayList;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
7 import java.util.Collection;
180
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
8 import java.util.Iterator;
173
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
9
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
10 import org.apache.log4j.Logger;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
11
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
12 import com.vividsolutions.jts.geom.Point;
180
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
13 import com.vividsolutions.jts.io.ParseException;
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
14 import com.vividsolutions.jts.io.WKTReader;
173
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
15
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
16 import de.intevation.gnv.geobackend.base.Result;
180
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
17 import de.intevation.gnv.transition.describedata.DefaultKeyValueDescribeData;
173
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
18 import de.intevation.gnv.transition.describedata.KeyValueDescibeData;
180
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
19 import de.intevation.gnv.transition.describedata.NamedArrayList;
173
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
20 import de.intevation.gnv.transition.describedata.NamedCollection;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
21 import de.intevation.gnv.utils.InputValidator;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
22 import de.intevation.gnv.utils.exception.ValidationException;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
23
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
24 /**
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
25 * @author Tim Englich <tim.englich@intevation.de>
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
26 *
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
27 */
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
28 public class CoordinateSelectionTransition extends TransitionBase {
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
29
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
30 /**
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
31 * the logger, used to log exceptions and additonaly information
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
32 */
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
33 private static Logger log = Logger.getLogger(CoordinateSelectionTransition.class);
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
34
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
35 /**
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
36 * The UID of this Class
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
37 */
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
38 private static final long serialVersionUID = 6318923553625195063L;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
39
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
40 /**
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
41 * Constructor
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
42 */
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
43 public CoordinateSelectionTransition() {
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
44 super();
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
45 }
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
46
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
47 @Override
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
48 protected void purifyResult(Collection<Result> result, String uuid) {
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
49 log.debug("CoordinateSelectionTransition.purifyResult");
207
d87347142702 Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents: 205
diff changeset
50 Collection<Object> describeData = this.getDescibeData(uuid);
d87347142702 Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents: 205
diff changeset
51 if (describeData == null) {
d87347142702 Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents: 205
diff changeset
52 describeData = new ArrayList<Object>();
173
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
53 }
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
54 NamedCollection<KeyValueDescibeData> keyValueDescibeData = this
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
55 .extractKVP(result, "FEATUREID", "SHAPE");
207
d87347142702 Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents: 205
diff changeset
56 describeData.add(keyValueDescibeData);
d87347142702 Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents: 205
diff changeset
57 this.setDescibeData(uuid, describeData);
173
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
58 }
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
59
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
60 @Override
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
61 protected String prepareInputData4RegionDBQuery(String value) {
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
62 log.debug("CoordinateSelectionTransition.prepareInputData4RegionDBQuery");
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
63 double distance=0.;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
64 String returnValue = null;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
65 try {
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
66 Point center = new InputValidator().getPointValue(value);
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
67 String meshIDValue = super.inputData.get("meshid").getValue();
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
68 int segments = 97;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
69 int meshid = new Integer(meshIDValue);
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
70 if (meshid == 3 || meshid == 5){ // TODO nicht hier festbrennen.
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
71 distance = 0.15; //nord-ostsee 6nm // 97 St�tzpunkte
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
72 }else if (meshid == 1 || meshid == 4){
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
73 distance = 0.03; //Kuestenmodell 1 nm
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
74 }else if (meshid == 2 || meshid == 321){
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
75 distance = 0.3; //SST Karten ca 20km
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
76 }else if (meshid == 641){
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
77 distance = 0.3; //Eisdaten Klima
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
78 }
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
79 returnValue = center.buffer(distance,segments).toText();
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
80 } catch (NumberFormatException e) {
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
81 log.error(e,e);
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
82 } catch (ValidationException e) {
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
83 log.error(e,e);
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
84 }
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
85 return returnValue;
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
86
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
87 }
180
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
88
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
89 /**
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
90 * @see de.intevation.gnv.transition.TransitionBase#extractKVP(java.util.Collection, java.lang.String, java.lang.String)
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
91 */
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
92 @Override
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
93 protected NamedCollection<KeyValueDescibeData> extractKVP(
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
94 Collection<Result> result,
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
95 String keyid,
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
96 String valueid) {
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
97 Iterator<Result> rit = result.iterator();
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
98 NamedCollection<KeyValueDescibeData> keyValueDescibeData = new NamedArrayList<KeyValueDescibeData>(
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
99 this.dataName, result.size());
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
100 keyValueDescibeData.setMultiSelect(this.dataMultiSelect);
205
6e7952fd1744 Added the support to Display the Time and the position of an Measurement in an VerticalProfile of Type Instantaneous Point
Tim Englich <tim.englich@intevation.de>
parents: 180
diff changeset
101 String prevKey = null;
180
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
102 while (rit.hasNext()) {
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
103 Result resultValue = rit.next();
205
6e7952fd1744 Added the support to Display the Time and the position of an Measurement in an VerticalProfile of Type Instantaneous Point
Tim Englich <tim.englich@intevation.de>
parents: 180
diff changeset
104 String key = resultValue.getString(keyid);
6e7952fd1744 Added the support to Display the Time and the position of an Measurement in an VerticalProfile of Type Instantaneous Point
Tim Englich <tim.englich@intevation.de>
parents: 180
diff changeset
105 if(prevKey == null || !prevKey.equals(key)){ // m�ssen wir so machen, da die sde kein select distinct auf layern zul�sst.
6e7952fd1744 Added the support to Display the Time and the position of an Measurement in an VerticalProfile of Type Instantaneous Point
Tim Englich <tim.englich@intevation.de>
parents: 180
diff changeset
106 String geomString = this.convert2DisplayCoordinate(resultValue.getString(valueid));
6e7952fd1744 Added the support to Display the Time and the position of an Measurement in an VerticalProfile of Type Instantaneous Point
Tim Englich <tim.englich@intevation.de>
parents: 180
diff changeset
107 String value = geomString;
6e7952fd1744 Added the support to Display the Time and the position of an Measurement in an VerticalProfile of Type Instantaneous Point
Tim Englich <tim.englich@intevation.de>
parents: 180
diff changeset
108 if (resultValue.getResultDescriptor().getColumnIndex("VALUE") > 0){
6e7952fd1744 Added the support to Display the Time and the position of an Measurement in an VerticalProfile of Type Instantaneous Point
Tim Englich <tim.englich@intevation.de>
parents: 180
diff changeset
109 value = resultValue.getString("VALUE") + " - "+value;
6e7952fd1744 Added the support to Display the Time and the position of an Measurement in an VerticalProfile of Type Instantaneous Point
Tim Englich <tim.englich@intevation.de>
parents: 180
diff changeset
110 }
6e7952fd1744 Added the support to Display the Time and the position of an Measurement in an VerticalProfile of Type Instantaneous Point
Tim Englich <tim.englich@intevation.de>
parents: 180
diff changeset
111
6e7952fd1744 Added the support to Display the Time and the position of an Measurement in an VerticalProfile of Type Instantaneous Point
Tim Englich <tim.englich@intevation.de>
parents: 180
diff changeset
112
6e7952fd1744 Added the support to Display the Time and the position of an Measurement in an VerticalProfile of Type Instantaneous Point
Tim Englich <tim.englich@intevation.de>
parents: 180
diff changeset
113 keyValueDescibeData.add(new DefaultKeyValueDescribeData(key,value ));
6e7952fd1744 Added the support to Display the Time and the position of an Measurement in an VerticalProfile of Type Instantaneous Point
Tim Englich <tim.englich@intevation.de>
parents: 180
diff changeset
114 }
6e7952fd1744 Added the support to Display the Time and the position of an Measurement in an VerticalProfile of Type Instantaneous Point
Tim Englich <tim.englich@intevation.de>
parents: 180
diff changeset
115 prevKey = key;
180
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
116 }
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
117 return keyValueDescibeData;
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
118 }
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
119
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
120 protected String convert2DisplayCoordinate(String wkt){
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
121 String formattedCoordinate = null;
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
122 try {
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
123 Point p = (Point)new WKTReader().read(wkt);
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
124 double lat = p.getY();
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
125 double lon =p.getX();
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
126 String nord="N";
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
127 String ost="E";
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
128 if (lat <0 ){nord="S"; lat=-lat;}
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
129 if (lon <0 ){ost="W"; lon=-lon;}
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
130 formattedCoordinate = String.format("%1$02d�%2$1S %3$05.2f' %4$03d�%5$1S %6$05.2f'",
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
131 (int)lat, nord,60.*(lat-((int)lat)),(int)lon,ost,60.*(lon-((int)lon)));
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
132 } catch (ParseException e) {
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
133 log.error(e,e);
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
134 }
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
135
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
136 return formattedCoordinate;
72bd41ba548d Added Transformation from WKT-Coordinate Reperesentation to BSH-Coordinate Representation. issue38
Tim Englich <tim.englich@intevation.de>
parents: 173
diff changeset
137 }
173
1b2fc94766c9 Added real Coordinate-Query to TimeSeries-Mesh
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
138 }

http://dive4elements.wald.intevation.org