Revision 359 org.gvsig.projection.jcrs/trunk/org.gvsig.projection.jcrs/org.gvsig.projection.jcrs.lib/src/main/java/org/gvsig/crs/Proj4.java
Proj4.java | ||
---|---|---|
62 | 62 |
|
63 | 63 |
/** |
64 | 64 |
* Clase para manejar la libreria proj4 |
65 |
*
|
|
65 |
* |
|
66 | 66 |
* @author David Hern?ndez L?pez (david.hernandez@uclm.es) |
67 | 67 |
* @author Jos? Luis G?mez Mart?nez (JoseLuis.Gomez@uclm.es) |
68 | 68 |
* |
69 | 69 |
*/ |
70 | 70 |
|
71 |
public class Proj4 {
|
|
71 |
public class Proj4 { |
|
72 | 72 |
public static final Logger logger = LoggerFactory.getLogger(Proj4.class); |
73 | 73 |
|
74 | 74 |
private ArrayList projectionNameList= new ArrayList(); |
... | ... | |
81 | 81 |
private ArrayList projectionParameterUnitList= new ArrayList(); |
82 | 82 |
private ArrayList projectionAcronymList= new ArrayList(); |
83 | 83 |
private ArrayList projectionParameterAcronymList= new ArrayList(); |
84 |
|
|
84 |
|
|
85 | 85 |
int divider=10000; |
86 | 86 |
private static double angularTolerance=1.0/3600.0; |
87 |
|
|
87 |
|
|
88 | 88 |
/** |
89 | 89 |
* Small tolerance factor for rounding errors. |
90 | 90 |
*/ |
91 | 91 |
private static final double EPS = 1E-8; |
92 |
|
|
92 |
|
|
93 | 93 |
/** |
94 | 94 |
* EPSG codes of the Swiss Oblique Mercator CRSs |
95 | 95 |
*/ |
96 | 96 |
private static final Integer[] somerc_codes = { 2056, 21780, 21781, 21782, 23700 }; |
97 |
|
|
97 |
|
|
98 | 98 |
public Proj4() throws CrsException |
99 | 99 |
{ |
100 | 100 |
//defineProjectionNames(); |
... | ... | |
104 | 104 |
defineProjectionParameterList(); |
105 | 105 |
defineProjections(); |
106 | 106 |
} |
107 |
|
|
107 |
|
|
108 | 108 |
private void defineUnitNameList() throws CrsException |
109 | 109 |
{ |
110 | 110 |
int count=0; |
111 |
|
|
111 |
|
|
112 | 112 |
{ |
113 | 113 |
String[] unitName={"Angular"}; |
114 | 114 |
unitNameList.add(count,unitName); |
115 | 115 |
} |
116 |
|
|
116 |
|
|
117 | 117 |
count++; |
118 | 118 |
{ |
119 | 119 |
String[] unitName={"Linear"}; |
120 | 120 |
unitNameList.add(count,unitName); |
121 | 121 |
} |
122 |
|
|
122 |
|
|
123 | 123 |
count++; |
124 | 124 |
{ |
125 | 125 |
String[] unitName={"Unitless"}; |
126 | 126 |
unitNameList.add(count,unitName); |
127 | 127 |
addUnitName(count,"Adimensional"); |
128 | 128 |
} |
129 |
|
|
129 |
|
|
130 | 130 |
} |
131 |
|
|
131 |
|
|
132 | 132 |
private void defineProjectionParameterList() throws CrsException |
133 | 133 |
{ |
134 | 134 |
int count=0; |
... | ... | |
136 | 136 |
{ // azimuth |
137 | 137 |
String[] parameterName={"azimuth"}; |
138 | 138 |
projectionParameterNameList.add(count,parameterName); |
139 |
addProjectionParameterName(count,"Azimuth of initial line");
|
|
140 |
addProjectionParameterName(count,"AzimuthAngle");
|
|
139 |
addProjectionParameterName(count,"Azimuth of initial line"); |
|
140 |
addProjectionParameterName(count,"AzimuthAngle"); |
|
141 | 141 |
|
142 | 142 |
String[] parameterUnit={"Angular"}; |
143 | 143 |
projectionParameterUnitList.add(count,parameterUnit); |
... | ... | |
147 | 147 |
{ // central_meridian |
148 | 148 |
String[] parameterName={"central_meridian"}; |
149 | 149 |
projectionParameterNameList.add(count,parameterName); |
150 |
addProjectionParameterName(count,"Longitude of natural origin");
|
|
151 |
addProjectionParameterName(count,"NatOriginLong");
|
|
150 |
addProjectionParameterName(count,"Longitude of natural origin"); |
|
151 |
addProjectionParameterName(count,"NatOriginLong"); |
|
152 | 152 |
addProjectionParameterName(count,"Longitude of projection center"); |
153 | 153 |
addProjectionParameterName(count,"Longitude_of_center"); |
154 | 154 |
addProjectionParameterName(count,"ProjCenterLong"); |
155 |
addProjectionParameterName(count,"Longitude of false origin");
|
|
156 |
addProjectionParameterName(count,"FalseOriginLong");
|
|
157 |
addProjectionParameterName(count,"StraightVertPoleLong");
|
|
158 |
|
|
155 |
addProjectionParameterName(count,"Longitude of false origin"); |
|
156 |
addProjectionParameterName(count,"FalseOriginLong"); |
|
157 |
addProjectionParameterName(count,"StraightVertPoleLong"); |
|
158 |
|
|
159 | 159 |
String[] parameterUnit={"Angular"}; |
160 | 160 |
projectionParameterUnitList.add(count,parameterUnit); |
161 | 161 |
} |
162 |
|
|
162 |
|
|
163 | 163 |
count++; |
164 | 164 |
{ // false_easting |
165 | 165 |
String[] parameterName={"false_easting"}; |
166 | 166 |
projectionParameterNameList.add(count,parameterName); |
167 |
addProjectionParameterName(count,"Easting at projection centre");
|
|
168 |
addProjectionParameterName(count,"Easting of false origin");
|
|
169 |
addProjectionParameterName(count,"FalseEasting");
|
|
170 |
addProjectionParameterName(count,"False_Easting");
|
|
171 |
addProjectionParameterName(count,"FalseOriginEasting");
|
|
167 |
addProjectionParameterName(count,"Easting at projection centre"); |
|
168 |
addProjectionParameterName(count,"Easting of false origin"); |
|
169 |
addProjectionParameterName(count,"FalseEasting"); |
|
170 |
addProjectionParameterName(count,"False_Easting"); |
|
171 |
addProjectionParameterName(count,"FalseOriginEasting"); |
|
172 | 172 |
|
173 | 173 |
String[] parameterUnit={"Linear"}; |
174 | 174 |
projectionParameterUnitList.add(count,parameterUnit); |
175 | 175 |
} |
176 |
|
|
176 |
|
|
177 | 177 |
count++; |
178 | 178 |
{ // false_northing |
179 | 179 |
String[] parameterName={"false_northing"}; |
180 | 180 |
projectionParameterNameList.add(count,parameterName); |
181 |
addProjectionParameterName(count,"Northing at projection centre");
|
|
182 |
addProjectionParameterName(count,"Northing of false origin");
|
|
183 |
addProjectionParameterName(count,"FalseNorthing");
|
|
184 |
addProjectionParameterName(count,"False_Northing");
|
|
185 |
addProjectionParameterName(count,"FalseOriginNorthing");
|
|
181 |
addProjectionParameterName(count,"Northing at projection centre"); |
|
182 |
addProjectionParameterName(count,"Northing of false origin"); |
|
183 |
addProjectionParameterName(count,"FalseNorthing"); |
|
184 |
addProjectionParameterName(count,"False_Northing"); |
|
185 |
addProjectionParameterName(count,"FalseOriginNorthing"); |
|
186 | 186 |
|
187 | 187 |
String[] parameterUnit={"Linear"}; |
188 | 188 |
projectionParameterUnitList.add(count,parameterUnit); |
... | ... | |
192 | 192 |
{ // latitude_of_center |
193 | 193 |
String[] parameterName={"latitude_of_center"}; |
194 | 194 |
projectionParameterNameList.add(count,parameterName); |
195 |
addProjectionParameterName(count,"CenterLat");
|
|
195 |
addProjectionParameterName(count,"CenterLat"); |
|
196 | 196 |
addProjectionParameterName(count,"FalseOriginLat"); |
197 |
addProjectionParameterName(count,"Latitude of false origin");
|
|
198 |
addProjectionParameterName(count,"Latitude_of_origin");
|
|
197 |
addProjectionParameterName(count,"Latitude of false origin"); |
|
198 |
addProjectionParameterName(count,"Latitude_of_origin"); |
|
199 | 199 |
addProjectionParameterName(count,"Latitude of natural origin"); |
200 | 200 |
addProjectionParameterName(count,"Latitude of projection center"); |
201 | 201 |
addProjectionParameterName(count,"Latitude of projection centre"); |
202 |
addProjectionParameterName(count,"NatOriginLat");
|
|
202 |
addProjectionParameterName(count,"NatOriginLat"); |
|
203 | 203 |
addProjectionParameterName(count,"ProjCenterLat"); |
204 | 204 |
addProjectionParameterName(count,"Spherical_latitude_of_origin"); |
205 | 205 |
addProjectionParameterName(count,"Central_Parallel"); |
... | ... | |
212 | 212 |
{ // Latitude_Of_1st_Point |
213 | 213 |
String[] parameterName={"Latitude_Of_1st_Point"}; |
214 | 214 |
projectionParameterNameList.add(count,parameterName); |
215 |
//addProjectionParameterName(count,"CenterLat");
|
|
216 |
|
|
215 |
//addProjectionParameterName(count,"CenterLat"); |
|
216 |
|
|
217 | 217 |
String[] parameterUnit={"Angular"}; |
218 | 218 |
projectionParameterUnitList.add(count,parameterUnit); |
219 | 219 |
} |
... | ... | |
222 | 222 |
{ // Latitude_Of_2nd_Point |
223 | 223 |
String[] parameterName={"Latitude_Of_2nd_Point"}; |
224 | 224 |
projectionParameterNameList.add(count,parameterName); |
225 |
//addProjectionParameterName(count,"CenterLat");
|
|
226 |
|
|
225 |
//addProjectionParameterName(count,"CenterLat"); |
|
226 |
|
|
227 | 227 |
String[] parameterUnit={"Angular"}; |
228 | 228 |
projectionParameterUnitList.add(count,parameterUnit); |
229 | 229 |
} |
... | ... | |
232 | 232 |
{ // latitude_of_origin |
233 | 233 |
String[] parameterName={"latitude_of_origin"}; |
234 | 234 |
projectionParameterNameList.add(count,parameterName); |
235 |
addProjectionParameterName(count,"CenterLat");
|
|
235 |
addProjectionParameterName(count,"CenterLat"); |
|
236 | 236 |
addProjectionParameterName(count,"FalseOriginLat"); |
237 |
addProjectionParameterName(count,"Latitude of center");
|
|
238 |
addProjectionParameterName(count,"Latitude of false origin");
|
|
237 |
addProjectionParameterName(count,"Latitude of center"); |
|
238 |
addProjectionParameterName(count,"Latitude of false origin"); |
|
239 | 239 |
addProjectionParameterName(count,"Latitude of natural origin"); |
240 | 240 |
addProjectionParameterName(count,"Latitude of projection center"); |
241 | 241 |
addProjectionParameterName(count,"Latitude of projection centre"); |
242 |
addProjectionParameterName(count,"NatOriginLat");
|
|
242 |
addProjectionParameterName(count,"NatOriginLat"); |
|
243 | 243 |
addProjectionParameterName(count,"ProjCenterLat"); |
244 |
|
|
244 |
|
|
245 | 245 |
String[] parameterUnit={"Angular"}; |
246 | 246 |
projectionParameterUnitList.add(count,parameterUnit); |
247 | 247 |
} |
... | ... | |
250 | 250 |
{ // latitude_of_origin |
251 | 251 |
String[] parameterName={"latitude_of_standard_parallel"}; |
252 | 252 |
projectionParameterNameList.add(count,parameterName); |
253 |
addProjectionParameterName(count,"CenterLat");
|
|
253 |
addProjectionParameterName(count,"CenterLat"); |
|
254 | 254 |
addProjectionParameterName(count,"FalseOriginLat"); |
255 |
addProjectionParameterName(count,"Latitude of center");
|
|
256 |
addProjectionParameterName(count,"Latitude of false origin");
|
|
255 |
addProjectionParameterName(count,"Latitude of center"); |
|
256 |
addProjectionParameterName(count,"Latitude of false origin"); |
|
257 | 257 |
addProjectionParameterName(count,"Latitude of natural origin"); |
258 | 258 |
addProjectionParameterName(count,"Latitude of projection center"); |
259 | 259 |
addProjectionParameterName(count,"Latitude of projection centre"); |
260 |
addProjectionParameterName(count,"Latitude_of_standard_parallel");
|
|
261 |
addProjectionParameterName(count,"NatOriginLat");
|
|
260 |
addProjectionParameterName(count,"Latitude_of_standard_parallel"); |
|
261 |
addProjectionParameterName(count,"NatOriginLat"); |
|
262 | 262 |
addProjectionParameterName(count,"ProjCenterLat"); |
263 |
|
|
263 |
|
|
264 | 264 |
String[] parameterUnit={"Angular"}; |
265 | 265 |
projectionParameterUnitList.add(count,parameterUnit); |
266 | 266 |
} |
... | ... | |
269 | 269 |
{ // longitude_of_center |
270 | 270 |
String[] parameterName={"longitude_of_center"}; |
271 | 271 |
projectionParameterNameList.add(count,parameterName); |
272 |
addProjectionParameterName(count,"Longitude of origin");
|
|
273 |
addProjectionParameterName(count,"Longitude of false origin");
|
|
274 |
addProjectionParameterName(count,"NatOriginLong");
|
|
275 |
addProjectionParameterName(count,"central_meridian");
|
|
276 |
addProjectionParameterName(count,"CenterLong");
|
|
272 |
addProjectionParameterName(count,"Longitude of origin"); |
|
273 |
addProjectionParameterName(count,"Longitude of false origin"); |
|
274 |
addProjectionParameterName(count,"NatOriginLong"); |
|
275 |
addProjectionParameterName(count,"central_meridian"); |
|
276 |
addProjectionParameterName(count,"CenterLong"); |
|
277 | 277 |
addProjectionParameterName(count,"Spherical_latitude_of_origin"); |
278 | 278 |
|
279 | 279 |
String[] parameterUnit={"Angular"}; |
... | ... | |
284 | 284 |
{ // Longitude_Of_1st_Point |
285 | 285 |
String[] parameterName={"Longitude_Of_1st_Point"}; |
286 | 286 |
projectionParameterNameList.add(count,parameterName); |
287 |
//addProjectionParameterName(count,"CenterLat");
|
|
288 |
|
|
287 |
//addProjectionParameterName(count,"CenterLat"); |
|
288 |
|
|
289 | 289 |
String[] parameterUnit={"Angular"}; |
290 | 290 |
projectionParameterUnitList.add(count,parameterUnit); |
291 | 291 |
} |
... | ... | |
294 | 294 |
{ // Longitude_Of_2nd_Point |
295 | 295 |
String[] parameterName={"Longitude_Of_2nd_Point"}; |
296 | 296 |
projectionParameterNameList.add(count,parameterName); |
297 |
//addProjectionParameterName(count,"CenterLat");
|
|
298 |
|
|
297 |
//addProjectionParameterName(count,"CenterLat"); |
|
298 |
|
|
299 | 299 |
String[] parameterUnit={"Angular"}; |
300 | 300 |
projectionParameterUnitList.add(count,parameterUnit); |
301 | 301 |
} |
... | ... | |
304 | 304 |
{ // pseudo_standard_parallel_1 |
305 | 305 |
String[] parameterName={"pseudo_standard_parallel_1"}; |
306 | 306 |
projectionParameterNameList.add(count,parameterName); |
307 |
addProjectionParameterName(count,"Latitude of Pseudo Standard Parallel");
|
|
307 |
addProjectionParameterName(count,"Latitude of Pseudo Standard Parallel"); |
|
308 | 308 |
|
309 | 309 |
String[] parameterUnit={"Angular"}; |
310 | 310 |
projectionParameterUnitList.add(count,parameterUnit); |
311 | 311 |
} |
312 |
|
|
312 |
|
|
313 | 313 |
count++; |
314 | 314 |
{ // satellite_height |
315 | 315 |
String[] parameterName={"rectified_grid_angle"}; |
316 | 316 |
projectionParameterNameList.add(count,parameterName); |
317 |
addProjectionParameterName(count,"Angle from Rectified to Skew Grid");
|
|
318 |
addProjectionParameterName(count,"XY_Plane_Rotation");
|
|
319 |
addProjectionParameterName(count,"RectifiedGridAngle");
|
|
317 |
addProjectionParameterName(count,"Angle from Rectified to Skew Grid"); |
|
318 |
addProjectionParameterName(count,"XY_Plane_Rotation"); |
|
319 |
addProjectionParameterName(count,"RectifiedGridAngle"); |
|
320 | 320 |
|
321 | 321 |
String[] parameterUnit={"Linear"}; |
322 | 322 |
projectionParameterUnitList.add(count,parameterUnit); |
323 | 323 |
} |
324 |
|
|
324 |
|
|
325 | 325 |
count++; |
326 | 326 |
{ // satellite_height |
327 | 327 |
String[] parameterName={"satellite_height"}; |
328 | 328 |
projectionParameterNameList.add(count,parameterName); |
329 |
addProjectionParameterName(count,"Satellite Height");
|
|
329 |
addProjectionParameterName(count,"Satellite Height"); |
|
330 | 330 |
|
331 | 331 |
String[] parameterUnit={"Linear"}; |
332 | 332 |
projectionParameterUnitList.add(count,parameterUnit); |
333 | 333 |
} |
334 |
|
|
334 |
|
|
335 | 335 |
count++; |
336 | 336 |
{ // scale_factor |
337 | 337 |
String[] parameterName={"scale_factor"}; |
338 | 338 |
projectionParameterNameList.add(count,parameterName); |
339 |
addProjectionParameterName(count,"Scale factor at natural origin");
|
|
340 |
addProjectionParameterName(count,"ScaleAtNatOrigin");
|
|
341 |
addProjectionParameterName(count,"ScaleAtCenter");
|
|
339 |
addProjectionParameterName(count,"Scale factor at natural origin"); |
|
340 |
addProjectionParameterName(count,"ScaleAtNatOrigin"); |
|
341 |
addProjectionParameterName(count,"ScaleAtCenter"); |
|
342 | 342 |
|
343 | 343 |
String[] parameterUnit={"Unitless"}; |
344 | 344 |
projectionParameterUnitList.add(count,parameterUnit); |
... | ... | |
348 | 348 |
{ // standard_parallel_1 |
349 | 349 |
String[] parameterName={"standard_parallel_1"}; |
350 | 350 |
projectionParameterNameList.add(count,parameterName); |
351 |
addProjectionParameterName(count,"Latitude of first standard parallel");
|
|
352 |
addProjectionParameterName(count,"Latitude of origin");
|
|
353 |
addProjectionParameterName(count,"StdParallel1");
|
|
351 |
addProjectionParameterName(count,"Latitude of first standard parallel"); |
|
352 |
addProjectionParameterName(count,"Latitude of origin"); |
|
353 |
addProjectionParameterName(count,"StdParallel1"); |
|
354 | 354 |
|
355 | 355 |
String[] parameterUnit={"Angular"}; |
356 | 356 |
projectionParameterUnitList.add(count,parameterUnit); |
... | ... | |
360 | 360 |
{ // standard_parallel_2 |
361 | 361 |
String[] parameterName={"standard_parallel_2"}; |
362 | 362 |
projectionParameterNameList.add(count,parameterName); |
363 |
addProjectionParameterName(count,"Latitude of second standard parallel");
|
|
364 |
addProjectionParameterName(count,"StdParallel2");
|
|
363 |
addProjectionParameterName(count,"Latitude of second standard parallel"); |
|
364 |
addProjectionParameterName(count,"StdParallel2"); |
|
365 | 365 |
|
366 | 366 |
String[] parameterUnit={"Angular"}; |
367 | 367 |
projectionParameterUnitList.add(count,parameterUnit); |
... | ... | |
371 | 371 |
{ // semi_major |
372 | 372 |
String[] parameterName={"semi_major"}; |
373 | 373 |
projectionParameterNameList.add(count,parameterName); |
374 |
addProjectionParameterName(count,"semi_major_axis");
|
|
374 |
addProjectionParameterName(count,"semi_major_axis"); |
|
375 | 375 |
|
376 | 376 |
String[] parameterUnit={"Linear"}; |
377 | 377 |
projectionParameterUnitList.add(count,parameterUnit); |
... | ... | |
381 | 381 |
{ // semi_minor |
382 | 382 |
String[] parameterName={"semi_minor"}; |
383 | 383 |
projectionParameterNameList.add(count,parameterName); |
384 |
addProjectionParameterName(count,"semi_minor_axis");
|
|
384 |
addProjectionParameterName(count,"semi_minor_axis"); |
|
385 | 385 |
|
386 | 386 |
String[] parameterUnit={"Linear"}; |
387 | 387 |
projectionParameterUnitList.add(count,parameterUnit); |
... | ... | |
391 | 391 |
{ // height |
392 | 392 |
String[] parameterName={"Height"}; |
393 | 393 |
projectionParameterNameList.add(count,parameterName); |
394 |
addProjectionParameterName(count,"altitude");
|
|
394 |
addProjectionParameterName(count,"altitude"); |
|
395 | 395 |
|
396 | 396 |
String[] parameterUnit={"Linear"}; |
397 | 397 |
projectionParameterUnitList.add(count,parameterUnit); |
398 | 398 |
} |
399 | 399 |
|
400 | 400 |
} |
401 |
|
|
401 |
|
|
402 | 402 |
private void defineProjections() throws CrsException |
403 | 403 |
{ |
404 | 404 |
int count=0; |
405 |
|
|
405 |
|
|
406 | 406 |
{// Aitoff |
407 | 407 |
String[] projectionName={"Aitoff"}; |
408 | 408 |
projectionNameList.add(count,projectionName); |
... | ... | |
435 | 435 |
String[] projectionAcronym={"aitoff"}; |
436 | 436 |
projectionAcronymList.add(count,projectionAcronym); |
437 | 437 |
} |
438 |
|
|
438 |
|
|
439 | 439 |
count++; |
440 | 440 |
{// Albers Equal-Area Conic |
441 | 441 |
String[] projectionName={"Albers_Conic_Equal_Area"}; |
... | ... | |
443 | 443 |
addProjectionName(count,"Albers Equal-Area Conic"); |
444 | 444 |
addProjectionName(count,"Albers Equal Area"); |
445 | 445 |
addProjectionName(count,"9822"); |
446 |
|
|
446 |
|
|
447 | 447 |
String[] parameterName={"standard_parallel_1"}; |
448 | 448 |
projectionParameterList.add(count,parameterName); |
449 | 449 |
addProjectionParameter(count,"standard_parallel_2"); |
... | ... | |
487 | 487 |
String[] projectionAcronym={"aea"}; |
488 | 488 |
projectionAcronymList.add(count,projectionAcronym); |
489 | 489 |
} |
490 |
|
|
490 |
|
|
491 | 491 |
count++; |
492 | 492 |
{// Azimuthal_Equidistantt |
493 | 493 |
String[] projectionName={"Azimuthal_Equidistant"}; |
... | ... | |
498 | 498 |
addProjectionName(count,"Zenithal Equidistant"); |
499 | 499 |
addProjectionName(count,"Zenithal-Equidistant"); |
500 | 500 |
addProjectionName(count,"Zenithal_Equidistant"); |
501 |
|
|
501 |
|
|
502 | 502 |
String[] parameterName={"latitude_of_center"}; |
503 | 503 |
projectionParameterList.add(count,parameterName); |
504 | 504 |
addProjectionParameter(count,"longitude_of_center"); |
... | ... | |
614 | 614 |
String[] projectionAcronym={"cass"}; |
615 | 615 |
projectionAcronymList.add(count,projectionAcronym); |
616 | 616 |
} |
617 |
|
|
617 |
|
|
618 | 618 |
count++; |
619 | 619 |
{// Craster Parabolic |
620 | 620 |
String[] projectionName={"Craster_Parabolic"}; |
... | ... | |
911 | 911 |
String[] projectionAcronym={"eck6"}; |
912 | 912 |
projectionAcronymList.add(count,projectionAcronym); |
913 | 913 |
} |
914 |
|
|
914 |
|
|
915 | 915 |
count++; |
916 | 916 |
{// Equidistant_Conic |
917 | 917 |
String[] projectionName={"Equidistant_Conic"}; |
918 | 918 |
projectionNameList.add(count,projectionName); |
919 | 919 |
addProjectionName(count,"Equidistant Conic"); |
920 |
|
|
920 |
|
|
921 | 921 |
String[] parameterName={"latitude_of_center"}; |
922 | 922 |
projectionParameterList.add(count,parameterName); |
923 | 923 |
addProjectionParameter(count,"longitude_of_center"); |
... | ... | |
1007 | 1007 |
String[] projectionAcronym={"eqc"}; |
1008 | 1008 |
projectionAcronymList.add(count,projectionAcronym); |
1009 | 1009 |
} |
1010 |
|
|
1010 |
|
|
1011 | 1011 |
count++; |
1012 | 1012 |
{// McBryde-Thomas Flat-Polar Quartic |
1013 | 1013 |
String[] projectionName={"McBryde_Thomas_Flat_Polar_Quartic"}; |
... | ... | |
1198 | 1198 |
String[] projectionAcronym={"goode"}; |
1199 | 1199 |
projectionAcronymList.add(count,projectionAcronym); |
1200 | 1200 |
} |
1201 |
|
|
1201 |
|
|
1202 | 1202 |
count++; |
1203 | 1203 |
{// Hammer-Aitoff |
1204 | 1204 |
String[] projectionName={"Hammer_Aitoff"}; |
... | ... | |
1235 | 1235 |
String[] projectionAcronym={"hammer"}; |
1236 | 1236 |
projectionAcronymList.add(count,projectionAcronym); |
1237 | 1237 |
} |
1238 |
|
|
1238 |
|
|
1239 | 1239 |
count++; |
1240 | 1240 |
{// Krovak |
1241 | 1241 |
String[] projectionName={"Krovak"}; |
... | ... | |
1286 | 1286 |
String[] projectionAcronym={"krovak"}; |
1287 | 1287 |
projectionAcronymList.add(count,projectionAcronym); |
1288 | 1288 |
} |
1289 |
|
|
1290 |
|
|
1289 |
|
|
1290 |
|
|
1291 | 1291 |
count++; |
1292 | 1292 |
{// Laborde Madagascar |
1293 | 1293 |
String[] projectionName={"Laborde_Madagascar"}; |
... | ... | |
1314 | 1314 |
|
1315 | 1315 |
String[] projectionAcronym={"labrd"}; |
1316 | 1316 |
projectionAcronymList.add(count,projectionAcronym); |
1317 |
|
|
1317 |
|
|
1318 | 1318 |
/*String[] parameterName={"azimuth"}; |
1319 | 1319 |
projectionParameterList.add(count,parameterName); |
1320 | 1320 |
|
... | ... | |
1432 | 1432 |
String[] projectionAcronym={"lcca"}; |
1433 | 1433 |
projectionAcronymList.add(count,projectionAcronym); |
1434 | 1434 |
} |
1435 |
|
|
1435 |
|
|
1436 | 1436 |
count++; |
1437 | 1437 |
{// Lambert_Conformal_Conic_1SP |
1438 | 1438 |
String[] projectionName={"Lambert_Conformal_Conic_1SP"}; |
... | ... | |
1478 | 1478 |
String[] projectionAcronym={"lcc"}; |
1479 | 1479 |
projectionAcronymList.add(count,projectionAcronym); |
1480 | 1480 |
} |
1481 |
|
|
1481 |
|
|
1482 | 1482 |
count++; |
1483 | 1483 |
{// Lambert_Conformal_Conic_2SP |
1484 | 1484 |
String[] projectionName={"Lambert_Conformal_Conic_2SP"}; |
... | ... | |
1529 | 1529 |
String[] projectionAcronym={"lcc"}; |
1530 | 1530 |
projectionAcronymList.add(count,projectionAcronym); |
1531 | 1531 |
} |
1532 |
|
|
1532 |
|
|
1533 | 1533 |
count++; |
1534 | 1534 |
{// Lambert_Conformal_Conic |
1535 | 1535 |
String[] projectionName={"Lambert_Conformal_Conic"}; |
... | ... | |
1585 | 1585 |
String[] projectionAcronym={"lcc"}; |
1586 | 1586 |
projectionAcronymList.add(count,projectionAcronym); |
1587 | 1587 |
} |
1588 |
|
|
1588 |
|
|
1589 | 1589 |
count++; |
1590 | 1590 |
{// Lambert_Conformal_Conic_2SP_Belgium |
1591 | 1591 |
String[] projectionName={"Lambert_Conformal_Conic_2SP_Belgium"}; |
... | ... | |
1677 | 1677 |
String[] projectionAcronym={"loxim"}; |
1678 | 1678 |
projectionAcronymList.add(count,projectionAcronym); |
1679 | 1679 |
} |
1680 |
|
|
1680 |
|
|
1681 | 1681 |
count++; |
1682 | 1682 |
{// Mercator_1SP |
1683 | 1683 |
String[] projectionName={"Mercator_1SP"}; |
... | ... | |
1727 | 1727 |
String[] projectionAcronym={"merc"}; |
1728 | 1728 |
projectionAcronymList.add(count,projectionAcronym); |
1729 | 1729 |
} |
1730 |
|
|
1730 |
|
|
1731 | 1731 |
count++; |
1732 | 1732 |
{// Mercator_2SP |
1733 | 1733 |
String[] projectionName={"Mercator_2SP"}; |
... | ... | |
1810 | 1810 |
String[] projectionAcronym={"mill"}; |
1811 | 1811 |
projectionAcronymList.add(count,projectionAcronym); |
1812 | 1812 |
} |
1813 |
|
|
1813 |
|
|
1814 | 1814 |
count++; |
1815 | 1815 |
{// Mollweide |
1816 | 1816 |
String[] projectionName={"Mollweide"}; |
... | ... | |
1848 | 1848 |
String[] projectionAcronym={"moll"}; |
1849 | 1849 |
projectionAcronymList.add(count,projectionAcronym); |
1850 | 1850 |
} |
1851 |
|
|
1851 |
|
|
1852 | 1852 |
count++; |
1853 | 1853 |
{// Near-Sided Perspective |
1854 | 1854 |
String[] projectionName={"Near_Sided_Perspective"}; |
... | ... | |
1860 | 1860 |
addProjectionName(count,"Vertical Near Side Perspective"); |
1861 | 1861 |
addProjectionName(count,"Vertical-Near-Side-Perspective"); |
1862 | 1862 |
addProjectionName(count,"Vertical_Near_Side_Perspective"); |
1863 |
|
|
1863 |
|
|
1864 | 1864 |
String[] parameterName={"latitude_of_center"}; |
1865 | 1865 |
projectionParameterList.add(count,parameterName); |
1866 | 1866 |
addProjectionParameter(count,"longitude_of_center"); |
... | ... | |
2798 | 2798 |
String[] projectionAcronym={"wintri"}; |
2799 | 2799 |
projectionAcronymList.add(count,projectionAcronym); |
2800 | 2800 |
} |
2801 |
|
|
2801 |
|
|
2802 | 2802 |
count++; |
2803 | 2803 |
{// Popular_Visualisation_Pseudo_Mercator (based on Mercator_1SP) |
2804 | 2804 |
String[] projectionName={"Popular_Visualisation_Pseudo_Mercator"}; |
... | ... | |
2853 | 2853 |
projectionAcronymList.add(count,projectionAcronym); |
2854 | 2854 |
} |
2855 | 2855 |
|
2856 |
|
|
2856 |
|
|
2857 | 2857 |
} |
2858 |
|
|
2858 |
|
|
2859 | 2859 |
public void addProjectionName(int pos,String projectionName) throws CrsException |
2860 | 2860 |
{ |
2861 | 2861 |
if(pos<0||pos>(projectionNameList.size()-1)) |
... | ... | |
2872 | 2872 |
projectionNameList.remove(pos); |
2873 | 2873 |
projectionNameList.add(pos,newProjectionNames); |
2874 | 2874 |
} |
2875 |
|
|
2875 |
|
|
2876 | 2876 |
public void addUnitName(int pos,String unitName) throws CrsException |
2877 | 2877 |
{ |
2878 | 2878 |
if(pos<0||pos>(unitNameList.size()-1)) |
... | ... | |
2889 | 2889 |
unitNameList.remove(pos); |
2890 | 2890 |
unitNameList.add(pos,newUnitNames); |
2891 | 2891 |
} |
2892 |
|
|
2892 |
|
|
2893 | 2893 |
public void addProjectionParameterName(int pos,String projectionParameterName) throws CrsException |
2894 | 2894 |
{ |
2895 | 2895 |
if(pos<0||pos>(projectionParameterNameList.size()-1)) |
... | ... | |
2906 | 2906 |
projectionParameterNameList.remove(pos); |
2907 | 2907 |
projectionParameterNameList.add(pos,newProjectionParameterNames); |
2908 | 2908 |
} |
2909 |
|
|
2909 |
|
|
2910 | 2910 |
public void addProjectionParameter(int pos,String projectionParameter) throws CrsException |
2911 | 2911 |
{ |
2912 | 2912 |
if(pos<0||pos>(projectionParameterList.size()-1)) |
... | ... | |
2923 | 2923 |
projectionParameterList.remove(pos); |
2924 | 2924 |
projectionParameterList.add(pos,newProjectionParameters); |
2925 | 2925 |
} |
2926 |
|
|
2926 |
|
|
2927 | 2927 |
public void addProjectionParameterDefaultValue(int pos,String projectionParameterDefaultValue) throws CrsException |
2928 | 2928 |
{ |
2929 | 2929 |
if(pos<0||pos>(projectionParameterDefaultValueList.size()-1)) |
... | ... | |
2940 | 2940 |
projectionParameterDefaultValueList.remove(pos); |
2941 | 2941 |
projectionParameterDefaultValueList.add(pos,newProjectionParameterDefaultValues); |
2942 | 2942 |
} |
2943 |
|
|
2943 |
|
|
2944 | 2944 |
public void addProjectionParameterMaxValue(int pos,String projectionParameterMaxValue) throws CrsException |
2945 | 2945 |
{ |
2946 | 2946 |
if(pos<0||pos>(projectionParameterMaxValueList.size()-1)) |
... | ... | |
2957 | 2957 |
projectionParameterMaxValueList.remove(pos); |
2958 | 2958 |
projectionParameterMaxValueList.add(pos,newProjectionParameterMaxValues); |
2959 | 2959 |
} |
2960 |
|
|
2960 |
|
|
2961 | 2961 |
public void addProjectionParameterMinValue(int pos,String projectionParameterMinValue) throws CrsException |
2962 | 2962 |
{ |
2963 | 2963 |
if(pos<0||pos>(projectionParameterMinValueList.size()-1)) |
... | ... | |
2974 | 2974 |
projectionParameterMinValueList.remove(pos); |
2975 | 2975 |
projectionParameterMinValueList.add(pos,newProjectionParameterMinValues); |
2976 | 2976 |
} |
2977 |
|
|
2977 |
|
|
2978 | 2978 |
public void addProjectionParameterAcronymList(int pos,String projectionParameterAcronym) throws CrsException |
2979 | 2979 |
{ |
2980 | 2980 |
if(pos<0||pos>(projectionParameterAcronymList.size()-1)) |
... | ... | |
2991 | 2991 |
projectionParameterAcronymList.remove(pos); |
2992 | 2992 |
projectionParameterAcronymList.add(pos,newProjectionParameterAcronyms); |
2993 | 2993 |
} |
2994 |
|
|
2994 |
|
|
2995 | 2995 |
public int findProjection(String projectionName) |
2996 | 2996 |
{ |
2997 | 2997 |
for(int i=0;i<projectionNameList.size();i++) |
... | ... | |
3003 | 3003 |
return i; |
3004 | 3004 |
} |
3005 | 3005 |
} |
3006 |
|
|
3006 |
|
|
3007 | 3007 |
return -1; |
3008 | 3008 |
} |
3009 |
|
|
3009 |
|
|
3010 | 3010 |
public int findProjectionParameter(String parameterName) |
3011 | 3011 |
{ |
3012 | 3012 |
for(int i=0;i<projectionParameterNameList.size();i++) |
... | ... | |
3018 | 3018 |
return i; |
3019 | 3019 |
} |
3020 | 3020 |
} |
3021 |
|
|
3021 |
|
|
3022 | 3022 |
return -1; |
3023 | 3023 |
} |
3024 |
|
|
3024 |
|
|
3025 | 3025 |
public int findProjectionParameters(String parameterName1, String parameterName2) |
3026 | 3026 |
{ |
3027 | 3027 |
for(int i=0;i<projectionParameterNameList.size();i++) |
3028 | 3028 |
{ |
3029 | 3029 |
boolean existsParameter1=false; |
3030 | 3030 |
boolean existsParameter2=false; |
3031 |
|
|
3032 |
|
|
3031 |
|
|
3032 |
|
|
3033 | 3033 |
String[] parameterNames=(String[]) projectionParameterNameList.get(i); |
3034 | 3034 |
if(parameterNames[0].toLowerCase().replaceAll(" ","").equals(parameterName2.toLowerCase().replaceAll(" ",""))) |
3035 | 3035 |
{ |
... | ... | |
3046 | 3046 |
if(existsParameter1&&existsParameter2) |
3047 | 3047 |
return i; |
3048 | 3048 |
} |
3049 |
|
|
3049 |
|
|
3050 | 3050 |
return -1; |
3051 | 3051 |
} |
3052 |
|
|
3052 |
|
|
3053 | 3053 |
public int findUnit(String unitName) |
3054 | 3054 |
{ |
3055 | 3055 |
for(int i=0;i<unitNameList.size();i++) |
... | ... | |
3061 | 3061 |
return i; |
3062 | 3062 |
} |
3063 | 3063 |
} |
3064 |
|
|
3064 |
|
|
3065 | 3065 |
return -1; |
3066 | 3066 |
} |
3067 |
|
|
3068 |
public String getProj4UnitName(int pos) throws CrsException
|
|
3067 |
|
|
3068 |
public String getProj4UnitName(int pos) throws CrsException |
|
3069 | 3069 |
{ |
3070 | 3070 |
if(pos<0||pos>(unitNameList.size()-1)) |
3071 | 3071 |
{ |
... | ... | |
3073 | 3073 |
} |
3074 | 3074 |
return ((String[]) unitNameList.get(pos))[0]; |
3075 | 3075 |
} |
3076 |
|
|
3077 |
public String getProj4ProjectionName(int pos) throws CrsException
|
|
3076 |
|
|
3077 |
public String getProj4ProjectionName(int pos) throws CrsException |
|
3078 | 3078 |
{ |
3079 | 3079 |
if(pos<0||pos>(projectionNameList.size()-1)) |
3080 | 3080 |
{ |
... | ... | |
3082 | 3082 |
} |
3083 | 3083 |
return ((String[]) projectionNameList.get(pos))[0]; |
3084 | 3084 |
} |
3085 |
|
|
3086 |
public String getProj4ProjectionParameterName(int pos) throws CrsException
|
|
3085 |
|
|
3086 |
public String getProj4ProjectionParameterName(int pos) throws CrsException |
|
3087 | 3087 |
{ |
3088 | 3088 |
// Ojo decir a Jose Luis que quite los parametros del elipsoide |
3089 | 3089 |
if(pos<0||pos>(projectionParameterNameList.size()-1)) |
... | ... | |
3092 | 3092 |
} |
3093 | 3093 |
return ((String[]) projectionParameterNameList.get(pos))[0]; |
3094 | 3094 |
} |
3095 |
|
|
3096 |
public ArrayList getProj4ProjectionParameters(int pos) throws CrsException
|
|
3095 |
|
|
3096 |
public ArrayList getProj4ProjectionParameters(int pos) throws CrsException |
|
3097 | 3097 |
{ |
3098 |
|
|
3098 |
|
|
3099 | 3099 |
if(pos<0||pos>(projectionParameterList.size()-1)) |
3100 | 3100 |
throw new CrsException(new Exception()); |
3101 | 3101 |
String[] parameterList=(String[])projectionParameterList.get(pos); |
... | ... | |
3114 | 3114 |
} |
3115 | 3115 |
return parameters; |
3116 | 3116 |
} |
3117 |
|
|
3118 |
public ArrayList getProj4ProjectionParameterDefaultValues(int pos) throws CrsException
|
|
3117 |
|
|
3118 |
public ArrayList getProj4ProjectionParameterDefaultValues(int pos) throws CrsException |
|
3119 | 3119 |
{ |
3120 |
|
|
3120 |
|
|
3121 | 3121 |
if(pos<0||pos>(projectionParameterDefaultValueList.size()-1)) |
3122 | 3122 |
{ |
3123 | 3123 |
throw new CrsException(new Exception("Error retrieving default value to projection parameter. Position out of valid limits.")); |
... | ... | |
3131 | 3131 |
} |
3132 | 3132 |
return parameterDefaultValues; |
3133 | 3133 |
} |
3134 |
|
|
3135 |
public ArrayList getProj4ProjectionParameterMaxValues(int pos) throws CrsException
|
|
3134 |
|
|
3135 |
public ArrayList getProj4ProjectionParameterMaxValues(int pos) throws CrsException |
|
3136 | 3136 |
{ |
3137 |
|
|
3137 |
|
|
3138 | 3138 |
if(pos<0||pos>(projectionParameterMaxValueList.size()-1)) |
3139 | 3139 |
{ |
3140 | 3140 |
throw new CrsException(new Exception("Error retrieving max value value to projection parameter. Position out of valid limits.")); |
... | ... | |
3148 | 3148 |
} |
3149 | 3149 |
return parameterMaxValues; |
3150 | 3150 |
} |
3151 |
|
|
3152 |
public ArrayList getProj4ProjectionParameterMinValues(int pos) throws CrsException
|
|
3151 |
|
|
3152 |
public ArrayList getProj4ProjectionParameterMinValues(int pos) throws CrsException |
|
3153 | 3153 |
{ |
3154 |
|
|
3154 |
|
|
3155 | 3155 |
if(pos<0||pos>(projectionParameterMinValueList.size()-1)) |
3156 | 3156 |
{ |
3157 | 3157 |
throw new CrsException(new Exception("Error retrieving min value value to projection parameter. Position out of valid limits.")); |
... | ... | |
3165 | 3165 |
} |
3166 | 3166 |
return parameterMinValues; |
3167 | 3167 |
} |
3168 |
|
|
3169 |
public ArrayList getProj4ProjectionParameterAcronyms(int pos) throws CrsException
|
|
3168 |
|
|
3169 |
public ArrayList getProj4ProjectionParameterAcronyms(int pos) throws CrsException |
|
3170 | 3170 |
{ |
3171 |
|
|
3171 |
|
|
3172 | 3172 |
if(pos<0||pos>(projectionParameterAcronymList.size()-1)) |
3173 | 3173 |
{ |
3174 | 3174 |
throw new CrsException(new Exception("Error retrieving projection acronym. Position out of valid limits.")); |
... | ... | |
3182 | 3182 |
} |
3183 | 3183 |
return parameterAcronyms; |
3184 | 3184 |
} |
3185 |
|
|
3185 |
|
|
3186 | 3186 |
public String getProjectionParameterUnitList(int pos) throws CrsException { |
3187 | 3187 |
if(pos<0||pos>(projectionParameterUnitList.size()-1)) |
3188 | 3188 |
{ |
... | ... | |
3212 | 3212 |
strDatumName=crs.getCrsWkt().getDatumName(); |
3213 | 3213 |
int intCodDatum=0;//Integer.parseInt(codDatum); |
3214 | 3214 |
strProj4Datum=datumToProj4(strDatumName,intCodDatum); |
3215 |
|
|
3216 | 3215 |
|
3217 | 3216 |
|
3217 |
|
|
3218 | 3218 |
String strProj=crs.getCrsWkt().getProjcs(); |
3219 | 3219 |
if(strProj.equals("")) |
3220 | 3220 |
{ |
... | ... | |
3230 | 3230 |
else |
3231 | 3231 |
strProj4ToMeter="+units=m "; |
3232 | 3232 |
*/ |
3233 |
|
|
3234 |
|
|
3233 |
|
|
3234 |
|
|
3235 | 3235 |
//System.out.println("Projection = "+strProj); |
3236 | 3236 |
String strProjName=crs.getCrsWkt().getProjection(); |
3237 | 3237 |
//System.out.println("Projection Name = "+strProjName); |
... | ... | |
3357 | 3357 |
throw new CrsException(new Exception("In proj4 the 'Oblique_Mercator' projection doesn't allow different azimut and spin axis")); |
3358 | 3358 |
} |
3359 | 3359 |
} |
3360 |
|
|
3360 |
|
|
3361 | 3361 |
// Necesito buscar un caso de ejemplo |
3362 | 3362 |
} |
3363 | 3363 |
if(projectionName.equals("Hotine_Oblique_Mercator_Two_Point_Center")) |
... | ... | |
3549 | 3549 |
{ |
3550 | 3550 |
isLaborde=true; |
3551 | 3551 |
} |
3552 |
|
|
3552 |
|
|
3553 | 3553 |
strProj4=strProj4+strProjectionAcronym+" "; |
3554 | 3554 |
|
3555 | 3555 |
for(int i=0;i<parameterNames.size();i++) |
... | ... | |
3588 | 3588 |
} |
3589 | 3589 |
} |
3590 | 3590 |
} |
3591 |
|
|
3591 |
|
|
3592 | 3592 |
if(gtParameterAcronymn.equalsIgnoreCase("lat_ts")) |
3593 | 3593 |
{ |
3594 | 3594 |
if(exists_sf) |
... | ... | |
3608 | 3608 |
if(parameterAcronym.equals("lonc")) |
3609 | 3609 |
parameterAcronym="lon_0"; |
3610 | 3610 |
if(parameterAcronym.equals("k")) |
3611 |
parameterAcronym="k_0";
|
|
3611 |
parameterAcronym="k_0"; |
|
3612 | 3612 |
} |
3613 | 3613 |
if(isOmerc) |
3614 | 3614 |
{ |
... | ... | |
3646 | 3646 |
strProj4+=strExtraProj4; |
3647 | 3647 |
//getProj4ProjectionName(); |
3648 | 3648 |
} |
3649 |
|
|
3649 |
|
|
3650 | 3650 |
// Que pasa si no hay elipsoide? -> OGR por defecto pone WGS84 |
3651 | 3651 |
double a=0; |
3652 | 3652 |
double inv_f=0; |
... | ... | |
3657 | 3657 |
inv_f = Double.POSITIVE_INFINITY; |
3658 | 3658 |
} |
3659 | 3659 |
String strEllipseAcronym=ellipseToProj4(a,inv_f); |
3660 |
String strEllipse="";
|
|
3660 |
String strEllipse=""; |
|
3661 | 3661 |
if(strEllipseAcronym.equals("")) |
3662 | 3662 |
{ |
3663 | 3663 |
if (!Double.isInfinite(inv_f)) |
... | ... | |
3686 | 3686 |
String strWkt=crs.getWKT(); |
3687 | 3687 |
if(!strProj4ToMeter.equals("")) |
3688 | 3688 |
strProj4+=strProj4ToMeter; |
3689 |
|
|
3689 |
|
|
3690 | 3690 |
strProj4 = strProj4.replace(".0 ", " "); |
3691 | 3691 |
//System.out.println("- Cadena proj4: "+strProj4); |
3692 |
return strProj4;
|
|
3692 |
return strProj4; |
|
3693 | 3693 |
} |
3694 |
|
|
3694 |
|
|
3695 | 3695 |
public String exportToProj4(CoordinateReferenceSystem crs) throws CrsException |
3696 | 3696 |
{ |
3697 | 3697 |
String strProj4="+proj="; |
... | ... | |
3766 | 3766 |
strDatumName=val[1]; |
3767 | 3767 |
for (Iterator iter =((DefaultProjectedCRS)crs).getDatum().getIdentifiers().iterator();iter.hasNext();) { |
3768 | 3768 |
Identifier element = (Identifier) iter.next(); |
3769 |
codDatum = element.getCode();
|
|
3769 |
codDatum = element.getCode(); |
|
3770 | 3770 |
} |
3771 | 3771 |
int intCodDatum=Integer.parseInt(codDatum); |
3772 | 3772 |
strProj4Datum=datumToProj4(strDatumName,intCodDatum); |
... | ... | |
3842 | 3842 |
strDatumName=val[1]; |
3843 | 3843 |
for (Iterator iter =((DefaultGeographicCRS)crs).getDatum().getIdentifiers().iterator();iter.hasNext();) { |
3844 | 3844 |
Identifier element = (Identifier) iter.next(); |
3845 |
codDatum = element.getCode();
|
|
3845 |
codDatum = element.getCode(); |
|
3846 | 3846 |
} |
3847 | 3847 |
int intCodDatum=Integer.parseInt(codDatum); |
3848 | 3848 |
strProj4Datum=datumToProj4(strDatumName,intCodDatum); |
... | ... | |
3850 | 3850 |
else { |
3851 | 3851 |
throw(new CrsException(new Exception("the crs is not a geographic nor projected CRS"))); |
3852 | 3852 |
} |
3853 |
|
|
3853 |
|
|
3854 | 3854 |
String primeMeridianName=primeMeridian[0]; |
3855 | 3855 |
double primeMeridianValue = -1; |
3856 | 3856 |
if (primeMeridian[1] == null) { |
3857 | 3857 |
throw(new CrsException(new Exception("Null value not allowed for prime meridiam parameters"))); |
3858 | 3858 |
} else { |
3859 | 3859 |
primeMeridianValue=Double.parseDouble(primeMeridian[1]); // -> hacer el cambio de unidades |
3860 |
}
|
|
3860 |
} |
|
3861 | 3861 |
String[] strPrimeMeridianProj4=primeMeridianToProj4(primeMeridianName,primeMeridianValue); |
3862 | 3862 |
primeMeridianValue=Double.parseDouble(strPrimeMeridianProj4[1]); |
3863 | 3863 |
primeMeridianName=strPrimeMeridianProj4[0]; |
... | ... | |
3924 | 3924 |
if(existsParameter) |
3925 | 3925 |
{ |
3926 | 3926 |
parameterValues.set(i,parameterValue); |
3927 |
}
|
|
3927 |
} |
|
3928 | 3928 |
} |
3929 | 3929 |
boolean isSomerc=false; |
3930 | 3930 |
boolean isOmerc=false; |
... | ... | |
3998 | 3998 |
throw new CrsException(new Exception("The proj4 projection 'Oblique Mercator' not allow diferent azimut and spin axis.")); |
3999 | 3999 |
} |
4000 | 4000 |
} |
4001 |
|
|
4001 |
|
|
4002 | 4002 |
// Necesito buscar un caso de ejemplo |
4003 | 4003 |
} |
4004 | 4004 |
if(projectionName.equals("Hotine_Oblique_Mercator_Two_Point_Center")) |
... | ... | |
4278 | 4278 |
strProj4+=strExtraProj4; |
4279 | 4279 |
//getProj4ProjectionName(); |
4280 | 4280 |
} |
4281 |
|
|
4281 |
|
|
4282 | 4282 |
// Que pasa si no hay elipsoide? -> OGR por defecto pone WGS84 |
4283 | 4283 |
String strEllipseAcronym=ellipseToProj4(a,inv_f); |
4284 | 4284 |
String strEllipse=""; |
... | ... | |
4308 | 4308 |
if(!strProj4ToMeter.equals("")) |
4309 | 4309 |
strProj4+=strProj4ToMeter; |
4310 | 4310 |
String strWkt=crs.toWKT(); |
4311 |
|
|
4311 |
|
|
4312 | 4312 |
strProj4 = strProj4.replace(".0 ", " "); |
4313 | 4313 |
//System.out.println("- Cadena proj4: "+strProj4); |
4314 |
return strProj4;
|
|
4314 |
return strProj4; |
|
4315 | 4315 |
} |
4316 | 4316 |
|
4317 | 4317 |
private String[] primeMeridianToProj4(String pmName,double pmValue) throws CrsException |
... | ... | |
4337 | 4337 |
pmValue=dfFromGreenwich; |
4338 | 4338 |
acronym="+pm="+pszPM+" "; |
4339 | 4339 |
} |
4340 |
|
|
4341 |
dfFromGreenwich=(2+20/60.0+14.025/3600.0);
|
|
4340 |
|
|
4341 |
dfFromGreenwich=(2+20/60.0+14.025/3600.0); |
|
4342 | 4342 |
if(pmName.equalsIgnoreCase("paris")||(Math.abs(dfFromGreenwich-pmValue)<tolerance)) |
4343 | 4343 |
{ |
4344 | 4344 |
pszPM="paris"; |
... | ... | |
4352 | 4352 |
pmValue=dfFromGreenwich; |
4353 | 4353 |
acronym="+pm="+pszPM+" "; |
4354 | 4354 |
} |
4355 |
|
|
4355 |
|
|
4356 | 4356 |
dfFromGreenwich=-(74+4/60.0+51.3/3600.0); |
4357 | 4357 |
if(pmName.equalsIgnoreCase("bogota")||(Math.abs(dfFromGreenwich-pmValue)<tolerance)) |
4358 | 4358 |
{ |
... | ... | |
4367 | 4367 |
pmValue=dfFromGreenwich; |
4368 | 4368 |
acronym="+pm="+pszPM+" "; |
4369 | 4369 |
} |
4370 |
|
|
4370 |
|
|
4371 | 4371 |
dfFromGreenwich=-(3+41/60.0+16.58/3600.0); // mal en ogr los segundos pone 16.48 |
4372 | 4372 |
if(pmName.equalsIgnoreCase("madrid")||(Math.abs(dfFromGreenwich-pmValue)<tolerance)) |
4373 | 4373 |
{ |
... | ... | |
4382 | 4382 |
pmValue=dfFromGreenwich; |
4383 | 4383 |
acronym="+pm="+pszPM+" "; |
4384 | 4384 |
} |
4385 |
|
|
4385 |
|
|
4386 | 4386 |
dfFromGreenwich=(12+27/60.0+8.4/3600.0); |
4387 | 4387 |
if(pmName.equalsIgnoreCase("rome")||(Math.abs(dfFromGreenwich-pmValue)<tolerance)) |
4388 | 4388 |
{ |
... | ... | |
4397 | 4397 |
pmValue=dfFromGreenwich; |
4398 | 4398 |
acronym="+pm="+pszPM+" "; |
4399 | 4399 |
} |
4400 |
|
|
4400 |
|
|
4401 | 4401 |
dfFromGreenwich=(7+26/60.0+22.5/3600.0); |
4402 | 4402 |
if(pmName.equalsIgnoreCase("bern")||(Math.abs(dfFromGreenwich-pmValue)<tolerance)) |
4403 | 4403 |
{ |
... | ... | |
4412 | 4412 |
pmValue=dfFromGreenwich; |
4413 | 4413 |
acronym="+pm="+pszPM+" "; |
4414 | 4414 |
} |
4415 |
|
|
4415 |
|
|
4416 | 4416 |
dfFromGreenwich=(106+48/60.0+27.79/3600.0); |
4417 | 4417 |
if(pmName.equalsIgnoreCase("jakarta")||(Math.abs(dfFromGreenwich-pmValue)<tolerance)) |
4418 | 4418 |
{ |
... | ... | |
4427 | 4427 |
pmValue=dfFromGreenwich; |
4428 | 4428 |
acronym="+pm="+pszPM+" "; |
4429 | 4429 |
} |
4430 |
|
|
4430 |
|
|
4431 | 4431 |
dfFromGreenwich=-(17+40/60.0+0.0/3600.0); |
4432 | 4432 |
if(pmName.equalsIgnoreCase("ferro")||(Math.abs(dfFromGreenwich-pmValue)<tolerance)) |
4433 | 4433 |
{ |
... | ... | |
4442 | 4442 |
pmValue=dfFromGreenwich; |
4443 | 4443 |
acronym="+pm="+pszPM+" "; |
4444 | 4444 |
} |
4445 |
|
|
4445 |
|
|
4446 | 4446 |
dfFromGreenwich=(4+22/60.0+4.71/3600.0); |
4447 | 4447 |
if(pmName.equalsIgnoreCase("brussels")||(Math.abs(dfFromGreenwich-pmValue)<tolerance)) |
4448 | 4448 |
{ |
... | ... | |
4457 | 4457 |
pmValue=dfFromGreenwich; |
4458 | 4458 |
acronym="+pm="+pszPM+" "; |
4459 | 4459 |
} |
4460 |
|
|
4460 |
|
|
4461 | 4461 |
dfFromGreenwich=(18+3/60.0+29.8/3600.0); |
4462 | 4462 |
if(pmName.equalsIgnoreCase("stockholm")||(Math.abs(dfFromGreenwich-pmValue)<tolerance)) |
4463 | 4463 |
{ |
... | ... | |
4472 | 4472 |
pmValue=dfFromGreenwich; |
4473 | 4473 |
acronym="+pm="+pszPM+" "; |
4474 | 4474 |
} |
4475 |
|
|
4475 |
|
|
4476 | 4476 |
dfFromGreenwich=(23+42/60.0+58.815/3600.0); |
4477 | 4477 |
if(pmName.equalsIgnoreCase("athens")||(Math.abs(dfFromGreenwich-pmValue)<tolerance)) |
4478 | 4478 |
{ |
... | ... | |
4487 | 4487 |
pmValue=dfFromGreenwich; |
4488 | 4488 |
acronym="+pm="+pszPM+" "; |
4489 | 4489 |
} |
4490 |
|
|
4490 |
|
|
4491 | 4491 |
dfFromGreenwich=(10+43/60.0+22.5/3600.0); |
4492 | 4492 |
if(pmName.equalsIgnoreCase("oslo")||(Math.abs(dfFromGreenwich-pmValue)<tolerance)) |
4493 | 4493 |
{ |
... | ... | |
4502 | 4502 |
pmValue=dfFromGreenwich; |
4503 | 4503 |
acronym="+pm="+pszPM+" "; |
4504 | 4504 |
} |
4505 |
|
|
4505 |
|
|
4506 | 4506 |
dfFromGreenwich=(0.0); |
4507 | 4507 |
if(pmName.equalsIgnoreCase("Greenwich")||(Math.abs(dfFromGreenwich-pmValue)<tolerance)) |
4508 | 4508 |
{ |
... | ... | |
4599 | 4599 |
else if( Math.abs(dfSemiMajor-6378165.0) < 0.01 |
4600 | 4600 |
&& Math.abs(dfInvFlattening-298.3) < 0.0001 ) |
4601 | 4601 |
{ |
4602 |
pszPROJ4Ellipse = "WGS60";
|
|
4602 |
pszPROJ4Ellipse = "WGS60"; |
|
4603 | 4603 |
} |
4604 | 4604 |
else if( Math.abs(dfSemiMajor-6378145.0) < 0.01 |
4605 | 4605 |
&& Math.abs(dfInvFlattening-298.25) < 0.0001 ) |
4606 | 4606 |
{ |
4607 |
pszPROJ4Ellipse = "WGS66";
|
|
4607 |
pszPROJ4Ellipse = "WGS66"; |
|
4608 | 4608 |
} |
4609 | 4609 |
else if( Math.abs(dfSemiMajor-6378135.0) < 0.01 |
4610 | 4610 |
&& Math.abs(dfInvFlattening-298.26) < 0.0001 ) |
4611 | 4611 |
{ |
4612 |
pszPROJ4Ellipse = "WGS72";
|
|
4612 |
pszPROJ4Ellipse = "WGS72"; |
|
4613 | 4613 |
} |
4614 | 4614 |
else if( Math.abs(dfSemiMajor-6378137.0) < 0.01 |
4615 | 4615 |
&& Math.abs(dfInvFlattening-298.257223563) < 0.000001 ) |
... | ... | |
4624 | 4624 |
/* |
4625 | 4625 |
else if( EQUAL(pszDatum,"North_American_Datum_1927") ) |
4626 | 4626 |
{ |
4627 |
// pszPROJ4Ellipse = "clrk66:+datum=nad27"; // NAD 27
|
|
4627 |
// pszPROJ4Ellipse = "clrk66:+datum=nad27"; // NAD 27 |
|
4628 | 4628 |
pszPROJ4Ellipse = "clrk66"; |
4629 | 4629 |
} |
4630 | 4630 |
else if( EQUAL(pszDatum,"North_American_Datum_1983") ) |
4631 | 4631 |
{ |
4632 |
// pszPROJ4Ellipse = "GRS80:+datum=nad83"; // NAD 83
|
|
4632 |
// pszPROJ4Ellipse = "GRS80:+datum=nad83"; // NAD 83 |
|
4633 | 4633 |
pszPROJ4Ellipse = "GRS80"; |
4634 | 4634 |
} |
4635 | 4635 |
*/ |
... | ... | |
4639 | 4639 |
private String datumToProj4(String datumName,int epsgCode) |
4640 | 4640 |
{ |
4641 | 4641 |
String datumProj4=""; |
4642 |
String SRS_DN_NAD27="North_American_Datum_1927"; |
|
4643 |
String SRS_DN_NAD83="North_American_Datum_1983"; |
|
4644 |
String SRS_DN_WGS72="WGS_1972"; |
|
4645 |
String SRS_DN_WGS84="WGS_1984"; |
|
4642 |
final String SRS_DN_NAD27="North_American_Datum_1927"; |
|
4643 |
final String SRS_DN_NAD83="North_American_Datum_1983"; |
|
4644 |
final String SRS_DN_WGS72="WGS_1972"; |
|
4645 |
final String SRS_DN_WGS84="WGS_1984"; |
|
4646 |
final String SRS_DN2_WGS84="WorldGeodeticSystem1984"; |
|
4646 | 4647 |
if(datumName.equals("")) |
4647 | 4648 |
datumProj4=""; |
4648 | 4649 |
else if(datumName.equalsIgnoreCase(SRS_DN_NAD27) || epsgCode == 6267 ) |
... | ... | |
4651 | 4652 |
else if(datumName.equalsIgnoreCase(SRS_DN_NAD83) || epsgCode == 6269 ) |
4652 | 4653 |
datumProj4 = "+datum=NAD83 "; |
4653 | 4654 |
|
4654 |
else if(datumName.equalsIgnoreCase(SRS_DN_WGS84) || epsgCode == 6326 ) |
|
4655 |
else if(datumName.equalsIgnoreCase(SRS_DN_WGS84) || epsgCode == 6326 || datumName.equalsIgnoreCase(SRS_DN2_WGS84))
|
|
4655 | 4656 |
datumProj4 = "+datum=WGS84 "; |
4656 | 4657 |
|
4657 | 4658 |
else if( epsgCode == 6314 ) |
... | ... | |
4671 | 4672 |
// - Transverse Mercator |
4672 | 4673 |
// - Cuando el meridiano origen no es 0 se pone pm=madrid y lon_0= |
4673 | 4674 |
// +datum |
4674 |
|
|
4675 |
|
|
4675 | 4676 |
// Funciones privadas necesarias para el proceso |
4676 |
|
|
4677 |
|
|
4677 | 4678 |
private String getName(Identifier name) { |
4678 | 4679 |
String[] correctName = name.toString().split(":"); |
4679 |
if (correctName.length<2)
|
|
4680 |
if (correctName.length<2) |
|
4680 | 4681 |
return correctName[0]; |
4681 |
|
|
4682 |
|
|
4682 | 4683 |
else |
4683 | 4684 |
return correctName[1]; |
4684 | 4685 |
} |
4685 |
|
|
4686 |
|
|
4686 | 4687 |
private String[] Spheroid (Ellipsoid ellips) { |
4687 | 4688 |
String[] spheroid = new String[3]; |
4688 | 4689 |
Unit u = ellips.getAxisUnit(); |
... | ... | |
4698 | 4699 |
spheroid[2] = String.valueOf(inv_f); |
4699 | 4700 |
return spheroid; |
4700 | 4701 |
} |
4701 |
|
|
4702 |
|
|
4702 | 4703 |
private String[] Primem (PrimeMeridian prim) { |
4703 | 4704 |
String[] primem = new String[2]; |
4704 | 4705 |
DefaultPrimeMeridian pm = (DefaultPrimeMeridian) prim; |
... | ... | |
4712 | 4713 |
primem[1] = String.valueOf(value); |
4713 | 4714 |
return primem; |
4714 | 4715 |
} |
4715 |
|
|
4716 |
|
|
4716 | 4717 |
public double convert(double value, String measure) throws ConversionException { |
4717 |
if (measure.equals("D.MS")) {
|
|
4718 |
if (measure.equals("D.MS")) { |
|
4718 | 4719 |
value *= this.divider; |
4719 | 4720 |
int deg,min; |
4720 | 4721 |
deg = (int) (value/10000); value -= 10000*deg; |
... | ... | |
4738 | 4739 |
value = ((value/60) + min)/60 + deg; |
4739 | 4740 |
return value; |
4740 | 4741 |
} |
4741 |
if (measure.equals("grad") || measure.equals("grade")) |
|
4742 |
return ((value * 180.0) / 200.0); |
|
4743 |
if (measure.equals(""+(char)176)) |
|
4744 |
return value; |
|
4745 |
if (measure.equals("DMS") ) |
|
4746 |
return value; |
|
4747 |
if (measure.equals("m") || measure.startsWith("[m")) |
|
4748 |
return value; |
|
4749 |
if (measure.equals("")) |
|
4742 |
if (measure.equals("grad") || measure.equals("grade")) |
|
4743 |
return ((value * 180.0) / 200.0); |
|
4744 |
if (measure.equals(""+(char)176)) |
|
4750 | 4745 |
return value; |
4751 |
if (measure.equalsIgnoreCase("ft")||measure.equalsIgnoreCase("foot")||measure.equalsIgnoreCase("feet")) |
|
4746 |
if (measure.equals("DMS") ) |
|
4747 |
return value; |
|
4748 |
if (measure.equals("m") || measure.startsWith("[m")) |
|
4749 |
return value; |
|
4750 |
if (measure.equals("")) |
|
4751 |
return value; |
|
4752 |
if (measure.equalsIgnoreCase("ft")||measure.equalsIgnoreCase("foot")||measure.equalsIgnoreCase("feet")) |
|
4752 | 4753 |
return (value*0.3048/1.0); |
4753 |
|
|
4754 |
|
|
4754 | 4755 |
throw new ConversionException("Conversion no contemplada: "+measure); |
4755 | 4756 |
} |
4756 |
|
|
4757 |
|
|
4757 | 4758 |
public ArrayList getProjectionNameList(){ |
4758 | 4759 |
return projectionNameList; |
4759 | 4760 |
} |
Also available in: Unified diff