Revision 23de68fc
Added by Andreas Müller almost 2 years ago
cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/geo/kml/GeometryBuilder.java | ||
---|---|---|
16 | 16 |
import javax.measure.UnitConverter; |
17 | 17 |
import javax.measure.quantity.Length; |
18 | 18 |
|
19 |
import org.apache.log4j.Logger; |
|
19 |
import org.apache.logging.log4j.LogManager; |
|
20 |
import org.apache.logging.log4j.Logger; |
|
20 | 21 |
import org.geotools.data.DataUtilities; |
21 | 22 |
import org.geotools.feature.SchemaException; |
22 | 23 |
import org.geotools.feature.simple.SimpleFeatureBuilder; |
... | ... | |
48 | 49 |
|
49 | 50 |
/** |
50 | 51 |
* See : |
51 |
*
|
|
52 |
* |
|
52 | 53 |
* https://gis.stackexchange.com/questions/311272/create-dynamic-circle-polygon-from-specific-lat-long-using-geotools |
53 | 54 |
* https://gis.stackexchange.com/questions/283183/using-geometricshapefactory-to-create-circle-with-radius-in-miles |
54 |
*
|
|
55 |
* |
|
55 | 56 |
* https://stackoverflow.com/questions/36481651/how-do-i-create-a-circle-with-latitude-longitude-and-radius-with-geotools#36528805 |
56 |
*
|
|
57 |
*
|
|
57 |
* |
|
58 |
* |
|
58 | 59 |
* Another great library for creating shapes is https://github.com/locationtech/spatial4j |
59 |
*
|
|
60 |
* |
|
60 | 61 |
* @author Andreas Kohlbecker |
61 | 62 |
* @since Apr 21, 2020 |
62 | 63 |
*/ |
63 | 64 |
public class GeometryBuilder { |
64 | 65 |
|
65 |
private final static Logger logger = Logger.getLogger(GeometryBuilder.class); |
|
66 |
private final static Logger logger = LogManager.getLogger(GeometryBuilder.class);
|
|
66 | 67 |
|
67 | 68 |
public enum CircleMethod { |
68 | 69 |
circle, simpleCircleSmall, simpleCircle, reprojectedCircle; |
... | ... | |
71 | 72 |
/** |
72 | 73 |
* Fails with javax.measure.IncommensurableException: m is not compatible with |
73 | 74 |
* deg |
74 |
*
|
|
75 |
* |
|
75 | 76 |
* see |
76 | 77 |
* https://gis.stackexchange.com/questions/283183/using-geometricshapefactory-to-create-circle-with-radius-in-miles |
77 |
*
|
|
78 |
* |
|
78 | 79 |
* @param radius |
79 | 80 |
* @param latitude |
80 | 81 |
* @param longitude |
... | ... | |
104 | 105 |
/** |
105 | 106 |
* Only suitable for small radius (> 1000 m) as the circles are heavily |
106 | 107 |
* distorted otherwise. |
107 |
*
|
|
108 |
* |
|
108 | 109 |
* @param radius |
109 | 110 |
* @param latitude |
110 | 111 |
* @param longitude |
... | ... | |
128 | 129 |
/** |
129 | 130 |
* Creates perfect circles which are looking good but might be projected |
130 | 131 |
* incorrectly for the resulting map |
131 |
*
|
|
132 |
* |
|
132 | 133 |
* @param distance |
133 | 134 |
* @param latitude |
134 | 135 |
* @param longitude |
... | ... | |
159 | 160 |
|
160 | 161 |
/** |
161 | 162 |
* This Method should produces the best circles. |
162 |
*
|
|
163 |
* |
|
163 | 164 |
* The code is based on an example published by Ian Turton on stackoverflow: |
164 |
*
|
|
165 |
* |
|
165 | 166 |
* https://stackoverflow.com/questions/36481651/how-do-i-create-a-circle-with-latitude-longitude-and-radius-with-geotools#36528805 |
166 |
*
|
|
167 |
* |
|
167 | 168 |
* see https://gist.github.com/ianturton/973563fe5004985ba35a6e2247f7d823 and |
168 | 169 |
* https://gitlab.com/snippets/17558 |
169 |
*
|
|
170 |
* |
|
170 | 171 |
* @param feature |
171 | 172 |
* @param distance |
172 | 173 |
* @return |
Also available in: Unified diff
ref #9359 upgrade cdmlib to log4j 2