Statistics
| Revision:

root / branches / F2 / libraries / libJCRS / src / org / gvsig / crs / Proj4.java @ 12150

History | View | Annotate | Download (121 KB)

1
package org.gvsig.crs;
2

    
3
import java.util.ArrayList;
4
import java.util.Iterator;
5

    
6
import javax.units.ConversionException;
7
import javax.units.Unit;
8

    
9
import org.geotools.referencing.crs.DefaultGeographicCRS;
10
import org.geotools.referencing.crs.DefaultProjectedCRS;
11
import org.geotools.referencing.datum.DefaultGeodeticDatum;
12
import org.geotools.referencing.datum.DefaultPrimeMeridian;
13
import org.opengis.metadata.Identifier;
14
import org.opengis.referencing.crs.CoordinateReferenceSystem;
15
import org.opengis.referencing.datum.Ellipsoid;
16
import org.opengis.referencing.datum.PrimeMeridian;
17

    
18
public class Proj4 {        
19

    
20
        private static ArrayList projectionNameList= new ArrayList();
21
        private static ArrayList unitNameList= new ArrayList();
22
        private static ArrayList projectionParameterNameList= new ArrayList();
23
        private static ArrayList projectionParameterList= new ArrayList();
24
        private static ArrayList projectionParameterDefaultValueList= new ArrayList();
25
        private static ArrayList projectionParameterMaxValueList= new ArrayList();
26
        private static ArrayList projectionParameterMinValueList= new ArrayList();
27
        private static ArrayList projectionParameterUnitList= new ArrayList();
28
        private static ArrayList projectionAcronymList= new ArrayList();
29
        private static ArrayList projectionParameterAcronymList= new ArrayList();
30
        
31
        int divider=10000;
32
        
33
        /**
34
     * Small tolerance factor for rounding errors.
35
     */
36
    private static final double EPS = 1E-8;
37
        
38
        public Proj4() throws CrsException
39
        {
40
                //defineProjectionNames();
41
                //defineProjectionParameterNameList();
42
                //defineProjectionParameterUnitList();
43
                defineUnitNameList();
44
                defineProjectionParameterList();
45
                defineProjections();
46
        }
47
        
48
        private void defineUnitNameList() throws CrsException
49
        {
50
                int count=0;
51
                
52
                {
53
                        String[] unitName={"Angular"};
54
                        unitNameList.add(count,unitName);
55
                }
56
                
57
                count++;
58
                {
59
                        String[] unitName={"Linear"};
60
                        unitNameList.add(count,unitName);
61
                }
62
                
63
                count++;
64
                {
65
                        String[] unitName={"Unitless"};
66
                        unitNameList.add(count,unitName);
67
                        addUnitName(count,"Adimensional");
68
                }
69
                
70
        }
71
        
72
        private void defineProjectionParameterList() throws CrsException
73
        {
74
                int count=0;
75

    
76
                { // azimuth
77
                        String[] parameterName={"azimuth"};
78
                        projectionParameterNameList.add(count,parameterName);
79
                        addProjectionParameterName(count,"Azimuth of initial line");                
80
                        addProjectionParameterName(count,"AzimuthAngle");                
81

    
82
                        String[] parameterUnit={"Angular"};
83
                        projectionParameterUnitList.add(count,parameterUnit);
84
                }
85

    
86
                count++;
87
                { // central_meridian
88
                        String[] parameterName={"central_meridian"};
89
                        projectionParameterNameList.add(count,parameterName);
90
                        addProjectionParameterName(count,"Longitude of natural origin");                
91
                        addProjectionParameterName(count,"NatOriginLong");                
92
                        addProjectionParameterName(count,"Longitude of projection center");
93
                        addProjectionParameterName(count,"Longitude_of_center");
94
                        addProjectionParameterName(count,"ProjCenterLong");
95
                        addProjectionParameterName(count,"Longitude of false origin");                
96
                        addProjectionParameterName(count,"FalseOriginLong");                
97
                        addProjectionParameterName(count,"StraightVertPoleLong");                
98
                        
99
                        String[] parameterUnit={"Angular"};
100
                        projectionParameterUnitList.add(count,parameterUnit);
101
                }
102
                
103
                count++;
104
                { // false_easting
105
                        String[] parameterName={"false_easting"};
106
                        projectionParameterNameList.add(count,parameterName);
107
                        addProjectionParameterName(count,"Easting at projection centre");                
108
                        addProjectionParameterName(count,"Easting of false origin");                
109
                        addProjectionParameterName(count,"FalseEasting");                
110
                        addProjectionParameterName(count,"FalseOriginEasting");                
111

    
112
                        String[] parameterUnit={"Linear"};
113
                        projectionParameterUnitList.add(count,parameterUnit);
114
                }
115
                
116
                count++;
117
                { // false_northing
118
                        String[] parameterName={"false_northing"};
119
                        projectionParameterNameList.add(count,parameterName);
120
                        addProjectionParameterName(count,"Northing at projection centre");                
121
                        addProjectionParameterName(count,"Northing of false origin");                
122
                        addProjectionParameterName(count,"FalseNorthing");                
123
                        addProjectionParameterName(count,"FalseOriginNorthing");                
124

    
125
                        String[] parameterUnit={"Linear"};
126
                        projectionParameterUnitList.add(count,parameterUnit);
127
                }
128

    
129
                count++;
130
                { // latitude_of_center
131
                        String[] parameterName={"latitude_of_center"};
132
                        projectionParameterNameList.add(count,parameterName);
133
                        addProjectionParameterName(count,"CenterLat");                
134
                        addProjectionParameterName(count,"FalseOriginLat");
135
                        addProjectionParameterName(count,"Latitude of false origin");                
136
                        addProjectionParameterName(count,"Latitude_of_origin");                
137
                        addProjectionParameterName(count,"Latitude of natural origin");
138
                        addProjectionParameterName(count,"Latitude of projection center");
139
                        addProjectionParameterName(count,"Latitude of projection centre");
140
                        addProjectionParameterName(count,"NatOriginLat");                
141
                        addProjectionParameterName(count,"ProjCenterLat");
142

    
143
                        String[] parameterUnit={"Angular"};
144
                        projectionParameterUnitList.add(count,parameterUnit);
145
                }
146

    
147
                count++;
148
                { // Latitude_Of_1st_Point
149
                        String[] parameterName={"Latitude_Of_1st_Point"};
150
                        projectionParameterNameList.add(count,parameterName);
151
                        //addProjectionParameterName(count,"CenterLat");                
152
                        
153
                        String[] parameterUnit={"Angular"};
154
                        projectionParameterUnitList.add(count,parameterUnit);
155
                }
156

    
157
                count++;
158
                { // Latitude_Of_2nd_Point
159
                        String[] parameterName={"Latitude_Of_2nd_Point"};
160
                        projectionParameterNameList.add(count,parameterName);
161
                        //addProjectionParameterName(count,"CenterLat");                
162
                        
163
                        String[] parameterUnit={"Angular"};
164
                        projectionParameterUnitList.add(count,parameterUnit);
165
                }
166

    
167
                count++;
168
                { // latitude_of_origin
169
                        String[] parameterName={"latitude_of_origin"};
170
                        projectionParameterNameList.add(count,parameterName);
171
                        addProjectionParameterName(count,"CenterLat");                
172
                        addProjectionParameterName(count,"FalseOriginLat");
173
                        addProjectionParameterName(count,"Latitude of center");                
174
                        addProjectionParameterName(count,"Latitude of false origin");                
175
                        addProjectionParameterName(count,"Latitude of natural origin");
176
                        addProjectionParameterName(count,"Latitude of projection center");
177
                        addProjectionParameterName(count,"Latitude of projection centre");
178
                        addProjectionParameterName(count,"NatOriginLat");                
179
                        addProjectionParameterName(count,"ProjCenterLat");
180
                        
181
                        String[] parameterUnit={"Angular"};
182
                        projectionParameterUnitList.add(count,parameterUnit);
183
                }
184

    
185
                count++;
186
                { // longitude_of_center
187
                        String[] parameterName={"longitude_of_center"};
188
                        projectionParameterNameList.add(count,parameterName);
189
                        addProjectionParameterName(count,"Longitude of origin");                
190
                        addProjectionParameterName(count,"Longitude of false origin");                
191
                        addProjectionParameterName(count,"NatOriginLong");                
192
                        addProjectionParameterName(count,"central_meridian");                
193
                        addProjectionParameterName(count,"CenterLong");                
194

    
195
                        String[] parameterUnit={"Angular"};
196
                        projectionParameterUnitList.add(count,parameterUnit);
197
                }
198

    
199
                count++;
200
                { // Longitude_Of_1st_Point
201
                        String[] parameterName={"Longitude_Of_1st_Point"};
202
                        projectionParameterNameList.add(count,parameterName);
203
                        //addProjectionParameterName(count,"CenterLat");                
204
                        
205
                        String[] parameterUnit={"Angular"};
206
                        projectionParameterUnitList.add(count,parameterUnit);
207
                }
208

    
209
                count++;
210
                { // Longitude_Of_2nd_Point
211
                        String[] parameterName={"Longitude_Of_2nd_Point"};
212
                        projectionParameterNameList.add(count,parameterName);
213
                        //addProjectionParameterName(count,"CenterLat");                
214
                        
215
                        String[] parameterUnit={"Angular"};
216
                        projectionParameterUnitList.add(count,parameterUnit);
217
                }
218

    
219
                count++;
220
                { // pseudo_standard_parallel_1
221
                        String[] parameterName={"pseudo_standard_parallel_1"};
222
                        projectionParameterNameList.add(count,parameterName);
223
                        addProjectionParameterName(count,"Latitude of Pseudo Standard Parallel");                
224

    
225
                        String[] parameterUnit={"Angular"};
226
                        projectionParameterUnitList.add(count,parameterUnit);
227
                }
228
                
229
                count++;
230
                { // satellite_height
231
                        String[] parameterName={"rectified_grid_angle"};
232
                        projectionParameterNameList.add(count,parameterName);
233
                        addProjectionParameterName(count,"Angle from Rectified to Skew Grid");                
234
                        addProjectionParameterName(count,"XY_Plane_Rotation");                
235
                        addProjectionParameterName(count,"RectifiedGridAngle");                
236

    
237
                        String[] parameterUnit={"Linear"};
238
                        projectionParameterUnitList.add(count,parameterUnit);
239
                }
240
                
241
                count++;
242
                { // satellite_height
243
                        String[] parameterName={"satellite_height"};
244
                        projectionParameterNameList.add(count,parameterName);
245
                        addProjectionParameterName(count,"Satellite Height");                
246

    
247
                        String[] parameterUnit={"Linear"};
248
                        projectionParameterUnitList.add(count,parameterUnit);
249
                }
250
                
251
                count++;
252
                { // scale_factor
253
                        String[] parameterName={"scale_factor"};
254
                        projectionParameterNameList.add(count,parameterName);
255
                        addProjectionParameterName(count,"Scale factor at natural origin");                
256
                        addProjectionParameterName(count,"ScaleAtNatOrigin");                
257
                        addProjectionParameterName(count,"ScaleAtCenter");                
258

    
259
                        String[] parameterUnit={"Unitless"};
260
                        projectionParameterUnitList.add(count,parameterUnit);
261
                }
262

    
263
                count++;
264
                { // standard_parallel_1
265
                        String[] parameterName={"standard_parallel_1"};
266
                        projectionParameterNameList.add(count,parameterName);
267
                        addProjectionParameterName(count,"Latitude of first standard parallel");                
268
                        addProjectionParameterName(count,"StdParallel1");                
269

    
270
                        String[] parameterUnit={"Angular"};
271
                        projectionParameterUnitList.add(count,parameterUnit);
272
                }
273

    
274
                count++;
275
                { // standard_parallel_2
276
                        String[] parameterName={"standard_parallel_2"};
277
                        projectionParameterNameList.add(count,parameterName);
278
                        addProjectionParameterName(count,"Latitude of second standard parallel");                
279
                        addProjectionParameterName(count,"StdParallel2");                
280

    
281
                        String[] parameterUnit={"Angular"};
282
                        projectionParameterUnitList.add(count,parameterUnit);
283
                }
284

    
285
                count++;
286
                { // semi_major
287
                        String[] parameterName={"semi_major"};
288
                        projectionParameterNameList.add(count,parameterName);
289
                        addProjectionParameterName(count,"semi_major_axis");                
290

    
291
                        String[] parameterUnit={"Linear"};
292
                        projectionParameterUnitList.add(count,parameterUnit);
293
                }
294

    
295
                count++;
296
                { // semi_minor
297
                        String[] parameterName={"semi_minor"};
298
                        projectionParameterNameList.add(count,parameterName);
299
                        addProjectionParameterName(count,"semi_minor_axis");                
300

    
301
                        String[] parameterUnit={"Linear"};
302
                        projectionParameterUnitList.add(count,parameterUnit);
303
                }
304

    
305
        }
306
        
307
        private void defineProjections() throws CrsException
308
        {
309
                int count=0;
310
                
311
                {// Albers Equal-Area Conic
312
                        String[] projectionName={"Albers_Conic_Equal_Area"};
313
                        projectionNameList.add(count,projectionName);
314
                        addProjectionName(count,"Albers Equal-Area Conic");
315
                        addProjectionName(count,"Albers Equal Area");
316
                        addProjectionName(count,"9822");
317
                        
318
                        String[] parameterName={"standard_parallel_1"};
319
                        projectionParameterList.add(count,parameterName);
320
                        addProjectionParameter(count,"standard_parallel_2");
321
                        addProjectionParameter(count,"latitude_of_center");
322
                        addProjectionParameter(count,"longitude_of_center");
323
                        addProjectionParameter(count,"false_easting");
324
                        addProjectionParameter(count,"false_northing");
325

    
326
                        String[] parameterAcronym={"lat_1"};
327
                        projectionParameterAcronymList.add(count,parameterAcronym);
328
                        addProjectionParameterAcronymList(count,"lat_2");
329
                        addProjectionParameterAcronymList(count,"lat_0");
330
                        addProjectionParameterAcronymList(count,"lon_0");
331
                        addProjectionParameterAcronymList(count,"x_0");
332
                        addProjectionParameterAcronymList(count,"y_0");
333

    
334
                        String[] parameterDefaultValue={"0.0"};
335
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
336
                        addProjectionParameterDefaultValue(count,"0.0");
337
                        addProjectionParameterDefaultValue(count,"0.0");
338
                        addProjectionParameterDefaultValue(count,"0.0");
339
                        addProjectionParameterDefaultValue(count,"0.0");
340
                        addProjectionParameterDefaultValue(count,"0.0");
341

    
342
                        String[] parameterMaxValue={"90.0"};
343
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
344
                        addProjectionParameterMaxValue(count,"90.0");
345
                        addProjectionParameterMaxValue(count,"90.0");
346
                        addProjectionParameterMaxValue(count,"360.0");
347
                        addProjectionParameterMaxValue(count,"100000000.0");
348
                        addProjectionParameterMaxValue(count,"100000000.0");
349

    
350
                        String[] parameterMinValue={"-90.0"};
351
                        projectionParameterMinValueList.add(count,parameterMinValue);
352
                        addProjectionParameterMinValue(count,"-90.0");
353
                        addProjectionParameterMinValue(count,"-90.0");
354
                        addProjectionParameterMinValue(count,"-360.0");
355
                        addProjectionParameterMinValue(count,"-100000000.0");
356
                        addProjectionParameterMinValue(count,"-100000000.0");
357

    
358
                        String[] projectionAcronym={"aea"};
359
                        projectionAcronymList.add(count,projectionAcronym);
360
                }
361
                
362
                count++;
363
                {// Azimuthal_Equidistantt
364
                        String[] projectionName={"Azimuthal_Equidistant"};
365
                        projectionNameList.add(count,projectionName);
366
                        addProjectionName(count,"Azimuthal Equidistant");
367
                        
368
                        String[] parameterName={"latitude_of_center"};
369
                        projectionParameterList.add(count,parameterName);
370
                        addProjectionParameter(count,"longitude_of_center");
371
                        addProjectionParameter(count,"false_easting");
372
                        addProjectionParameter(count,"false_northing");
373

    
374
                        String[] parameterAcronym={"lat_0"};
375
                        projectionParameterAcronymList.add(count,parameterAcronym);
376
                        addProjectionParameterAcronymList(count,"lon_0");
377
                        addProjectionParameterAcronymList(count,"x_0");
378
                        addProjectionParameterAcronymList(count,"y_0");
379

    
380
                        String[] parameterDefaultValue={"0.0"};
381
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
382
                        addProjectionParameterDefaultValue(count,"0.0");
383
                        addProjectionParameterDefaultValue(count,"0.0");
384
                        addProjectionParameterDefaultValue(count,"0.0");
385

    
386
                        String[] parameterMaxValue={"90.0"};
387
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
388
                        addProjectionParameterMaxValue(count,"360.0");
389
                        addProjectionParameterMaxValue(count,"100000000.0");
390
                        addProjectionParameterMaxValue(count,"100000000.0");
391

    
392
                        String[] parameterMinValue={"-90.0"};
393
                        projectionParameterMinValueList.add(count,parameterMinValue);
394
                        addProjectionParameterMinValue(count,"-360.0");
395
                        addProjectionParameterMinValue(count,"-100000000.0");
396
                        addProjectionParameterMinValue(count,"-100000000.0");
397

    
398
                        String[] projectionAcronym={"aeqd"};
399
                        projectionAcronymList.add(count,projectionAcronym);
400
                }
401

    
402
                count++;
403
                {// Bonne
404
                        String[] projectionName={"Bonne"};
405
                        projectionNameList.add(count,projectionName);
406
                        addProjectionName(count,"Bonne");
407

    
408
                        String[] parameterName={"central_meridian"};
409
                        projectionParameterList.add(count,parameterName);
410
                        addProjectionParameter(count,"standard_parallel_1");
411
                        addProjectionParameter(count,"false_easting");
412
                        addProjectionParameter(count,"false_northing");
413

    
414
                        String[] parameterAcronym={"lon_0"};
415
                        projectionParameterAcronymList.add(count,parameterAcronym);
416
                        addProjectionParameterAcronymList(count,"lat_1");
417
                        addProjectionParameterAcronymList(count,"x_0");
418
                        addProjectionParameterAcronymList(count,"y_0");
419

    
420
                        String[] parameterDefaultValue={"0.0"};
421
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
422
                        addProjectionParameterDefaultValue(count,"0.0");
423
                        addProjectionParameterDefaultValue(count,"0.0");
424
                        addProjectionParameterDefaultValue(count,"0.0");
425

    
426
                        String[] parameterMaxValue={"360.0"};
427
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
428
                        addProjectionParameterMaxValue(count,"90.0");
429
                        addProjectionParameterMaxValue(count,"100000000.0");
430
                        addProjectionParameterMaxValue(count,"100000000.0");
431

    
432
                        String[] parameterMinValue={"-360.0"};
433
                        projectionParameterMinValueList.add(count,parameterMinValue);
434
                        addProjectionParameterMinValue(count,"-90.0");
435
                        addProjectionParameterMinValue(count,"-100000000.0");
436
                        addProjectionParameterMinValue(count,"-100000000.0");
437

    
438
                        String[] projectionAcronym={"bonne"};
439
                        projectionAcronymList.add(count,projectionAcronym);
440
                }
441
                
442
                count++;
443
                {// Cassini_Soldner
444
                        String[] projectionName={"Cassini_Soldner"};
445
                        projectionNameList.add(count,projectionName);
446
                        addProjectionName(count,"Cassini-Soldner");
447
                        addProjectionName(count,"9806");
448

    
449
                        String[] parameterName={"latitude_of_origin"};
450
                        projectionParameterList.add(count,parameterName);
451
                        addProjectionParameter(count,"central_meridian");
452
                        addProjectionParameter(count,"false_easting");
453
                        addProjectionParameter(count,"false_northing");
454

    
455
                        String[] parameterAcronym={"lat_0"};
456
                        projectionParameterAcronymList.add(count,parameterAcronym);
457
                        addProjectionParameterAcronymList(count,"lon_0");
458
                        addProjectionParameterAcronymList(count,"x_0");
459
                        addProjectionParameterAcronymList(count,"y_0");
460

    
461
                        String[] parameterDefaultValue={"0.0"};
462
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
463
                        addProjectionParameterDefaultValue(count,"0.0");
464
                        addProjectionParameterDefaultValue(count,"0.0");
465
                        addProjectionParameterDefaultValue(count,"0.0");
466

    
467
                        String[] parameterMaxValue={"90.0"};
468
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
469
                        addProjectionParameterMaxValue(count,"360.0");
470
                        addProjectionParameterMaxValue(count,"100000000.0");
471
                        addProjectionParameterMaxValue(count,"100000000.0");
472

    
473
                        String[] parameterMinValue={"-90.0"};
474
                        projectionParameterMinValueList.add(count,parameterMinValue);
475
                        addProjectionParameterMinValue(count,"-360.0");
476
                        addProjectionParameterMinValue(count,"-100000000.0");
477
                        addProjectionParameterMinValue(count,"-100000000.0");
478

    
479
                        String[] projectionAcronym={"cass"};
480
                        projectionAcronymList.add(count,projectionAcronym);
481
                }
482

    
483
                count++;
484
                {// Cylindrical_Equal_Area
485
                        String[] projectionName={"Cylindrical_Equal_Area"};
486
                        projectionNameList.add(count,projectionName);
487
                        addProjectionName(count,"Cylindrical Equal Area");
488
                        addProjectionName(count,"Normal Authalic Cylindrical (FME)");
489
                        addProjectionName(count,"Lambert Cylindrical Equal Area");
490
                        addProjectionName(count,"Behrmann (standard parallel = 30)");
491
                        addProjectionName(count,"Gall Orthographic (standard parallel = 45)");
492
                        addProjectionName(count,"Peters (approximated by Gall Orthographic)");
493

    
494
                        String[] parameterName={"central_meridian"};
495
                        projectionParameterList.add(count,parameterName);
496
                        addProjectionParameter(count,"standard_parallel_1");
497
                        addProjectionParameter(count,"false_easting");
498
                        addProjectionParameter(count,"false_northing");
499

    
500
                        String[] parameterAcronym={"lon_0"};
501
                        projectionParameterAcronymList.add(count,parameterAcronym);
502
                        addProjectionParameterAcronymList(count,"lat_ts");
503
                        addProjectionParameterAcronymList(count,"x_0");
504
                        addProjectionParameterAcronymList(count,"y_0");
505

    
506
                        String[] parameterDefaultValue={"0.0"};
507
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
508
                        addProjectionParameterDefaultValue(count,"0.0");
509
                        addProjectionParameterDefaultValue(count,"0.0");
510
                        addProjectionParameterDefaultValue(count,"0.0");
511

    
512
                        String[] parameterMaxValue={"360.0"};
513
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
514
                        addProjectionParameterMaxValue(count,"90.0");
515
                        addProjectionParameterMaxValue(count,"100000000.0");
516
                        addProjectionParameterMaxValue(count,"100000000.0");
517

    
518
                        String[] parameterMinValue={"-360.0"};
519
                        projectionParameterMinValueList.add(count,parameterMinValue);
520
                        addProjectionParameterMinValue(count,"-90.0");
521
                        addProjectionParameterMinValue(count,"-100000000.0");
522
                        addProjectionParameterMinValue(count,"-100000000.0");
523

    
524
                        String[] projectionAcronym={"cea"};
525
                        projectionAcronymList.add(count,projectionAcronym);
526
                }
527

    
528
                count++;
529
                {// Eckert_IV
530
                        String[] projectionName={"Eckert_IV"};
531
                        projectionNameList.add(count,projectionName);
532
                        addProjectionName(count,"Eckert IV");
533

    
534
                        String[] parameterName={"central_meridian"};
535
                        projectionParameterList.add(count,parameterName);
536
                        addProjectionParameter(count,"false_easting");
537
                        addProjectionParameter(count,"false_northing");
538

    
539
                        String[] parameterAcronym={"lon_0"};
540
                        projectionParameterAcronymList.add(count,parameterAcronym);
541
                        addProjectionParameterAcronymList(count,"x_0");
542
                        addProjectionParameterAcronymList(count,"y_0");
543

    
544
                        String[] parameterDefaultValue={"0.0"};
545
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
546
                        addProjectionParameterDefaultValue(count,"0.0");
547
                        addProjectionParameterDefaultValue(count,"0.0");
548

    
549
                        String[] parameterMaxValue={"360.0"};
550
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
551
                        addProjectionParameterMaxValue(count,"100000000.0");
552
                        addProjectionParameterMaxValue(count,"100000000.0");
553

    
554
                        String[] parameterMinValue={"-360.0"};
555
                        projectionParameterMinValueList.add(count,parameterMinValue);
556
                        addProjectionParameterMinValue(count,"-100000000.0");
557
                        addProjectionParameterMinValue(count,"-100000000.0");
558

    
559
                        String[] projectionAcronym={"eck4"};
560
                        projectionAcronymList.add(count,projectionAcronym);
561
                }
562

    
563
                count++;
564
                {// Eckert_VI
565
                        String[] projectionName={"Eckert_VI"};
566
                        projectionNameList.add(count,projectionName);
567
                        addProjectionName(count,"Eckert VI");
568

    
569
                        String[] parameterName={"central_meridian"};
570
                        projectionParameterList.add(count,parameterName);
571
                        addProjectionParameter(count,"false_easting");
572
                        addProjectionParameter(count,"false_northing");
573

    
574
                        String[] parameterAcronym={"lon_0"};
575
                        projectionParameterAcronymList.add(count,parameterAcronym);
576
                        addProjectionParameterAcronymList(count,"x_0");
577
                        addProjectionParameterAcronymList(count,"y_0");
578

    
579
                        String[] parameterDefaultValue={"0.0"};
580
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
581
                        addProjectionParameterDefaultValue(count,"0.0");
582
                        addProjectionParameterDefaultValue(count,"0.0");
583

    
584
                        String[] parameterMaxValue={"360.0"};
585
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
586
                        addProjectionParameterMaxValue(count,"100000000.0");
587
                        addProjectionParameterMaxValue(count,"100000000.0");
588

    
589
                        String[] parameterMinValue={"-360.0"};
590
                        projectionParameterMinValueList.add(count,parameterMinValue);
591
                        addProjectionParameterMinValue(count,"-100000000.0");
592
                        addProjectionParameterMinValue(count,"-100000000.0");
593

    
594
                        String[] projectionAcronym={"eck6"};
595
                        projectionAcronymList.add(count,projectionAcronym);
596
                }
597
                
598
                count++;
599
                {// Equidistant_Conic
600
                        String[] projectionName={"Equidistant_Conic"};
601
                        projectionNameList.add(count,projectionName);
602
                        addProjectionName(count,"Equidistant Conic");
603
                        
604
                        String[] parameterName={"latitude_of_center"};
605
                        projectionParameterList.add(count,parameterName);
606
                        addProjectionParameter(count,"longitude_of_center");
607
                        addProjectionParameter(count,"standard_parallel_1");
608
                        addProjectionParameter(count,"standard_parallel_2");
609
                        addProjectionParameter(count,"false_easting");
610
                        addProjectionParameter(count,"false_northing");
611

    
612
                        String[] parameterAcronym={"lat_0"};
613
                        projectionParameterAcronymList.add(count,parameterAcronym);
614
                        addProjectionParameterAcronymList(count,"lon_0");
615
                        addProjectionParameterAcronymList(count,"lat_1");
616
                        addProjectionParameterAcronymList(count,"lat_2");
617
                        addProjectionParameterAcronymList(count,"x_0");
618
                        addProjectionParameterAcronymList(count,"y_0");
619

    
620
                        String[] parameterDefaultValue={"0.0"};
621
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
622
                        addProjectionParameterDefaultValue(count,"0.0");
623
                        addProjectionParameterDefaultValue(count,"0.0");
624
                        addProjectionParameterDefaultValue(count,"0.0");
625
                        addProjectionParameterDefaultValue(count,"0.0");
626
                        addProjectionParameterDefaultValue(count,"0.0");
627

    
628
                        String[] parameterMaxValue={"90.0"};
629
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
630
                        addProjectionParameterMaxValue(count,"360.0");
631
                        addProjectionParameterMaxValue(count,"90.0");
632
                        addProjectionParameterMaxValue(count,"90.0");
633
                        addProjectionParameterMaxValue(count,"100000000.0");
634
                        addProjectionParameterMaxValue(count,"100000000.0");
635

    
636
                        String[] parameterMinValue={"-90.0"};
637
                        projectionParameterMinValueList.add(count,parameterMinValue);
638
                        addProjectionParameterMinValue(count,"-360.0");
639
                        addProjectionParameterMinValue(count,"-90.0");
640
                        addProjectionParameterMinValue(count,"-90.0");
641
                        addProjectionParameterMinValue(count,"-100000000.0");
642
                        addProjectionParameterMinValue(count,"-100000000.0");
643

    
644
                        String[] projectionAcronym={"eqdc"};
645
                        projectionAcronymList.add(count,projectionAcronym);
646
                }
647

    
648
                count++;
649
                {// Equirectangular
650
                        String[] projectionName={"Equirectangular"};
651
                        projectionNameList.add(count,projectionName);
652
                        addProjectionName(count,"Plate Caree");
653
                        addProjectionName(count,"Equidistant Cylindrical");
654
                        addProjectionName(count,"9823");
655

    
656
                        String[] parameterName={"latitude_of_origin"};
657
                        projectionParameterList.add(count,parameterName);
658
                        addProjectionParameter(count,"central_meridian");
659
                        addProjectionParameter(count,"false_easting");
660
                        addProjectionParameter(count,"false_northing");
661

    
662
                        String[] parameterAcronym={"lat_ts"};
663
                        projectionParameterAcronymList.add(count,parameterAcronym);
664
                        addProjectionParameterAcronymList(count,"lon_0");
665
                        addProjectionParameterAcronymList(count,"x_0");
666
                        addProjectionParameterAcronymList(count,"y_0");
667

    
668
                        String[] parameterDefaultValue={"0.0"};
669
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
670
                        addProjectionParameterDefaultValue(count,"0.0");
671
                        addProjectionParameterDefaultValue(count,"0.0");
672
                        addProjectionParameterDefaultValue(count,"0.0");
673

    
674
                        String[] parameterMaxValue={"90.0"};
675
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
676
                        addProjectionParameterMaxValue(count,"360.0");
677
                        addProjectionParameterMaxValue(count,"100000000.0");
678
                        addProjectionParameterMaxValue(count,"100000000.0");
679

    
680
                        String[] parameterMinValue={"-90.0"};
681
                        projectionParameterMinValueList.add(count,parameterMinValue);
682
                        addProjectionParameterMinValue(count,"-360.0");
683
                        addProjectionParameterMinValue(count,"-100000000.0");
684
                        addProjectionParameterMinValue(count,"-100000000.0");
685

    
686
                        String[] projectionAcronym={"eqc"};
687
                        projectionAcronymList.add(count,projectionAcronym);
688
                }
689

    
690
                count++;
691
                {// Gall_Stereographic
692
                        String[] projectionName={"Gall_Stereographic"};
693
                        projectionNameList.add(count,projectionName);
694
                        addProjectionName(count,"Gall Stereograpic");
695
                        addProjectionName(count,"Gall");
696

    
697
                        String[] parameterName={"central_meridian"};
698
                        projectionParameterList.add(count,parameterName);
699
                        addProjectionParameter(count,"false_easting");
700
                        addProjectionParameter(count,"false_northing");
701

    
702
                        String[] parameterAcronym={"lon_0"};
703
                        projectionParameterAcronymList.add(count,parameterAcronym);
704
                        addProjectionParameterAcronymList(count,"x_0");
705
                        addProjectionParameterAcronymList(count,"y_0");
706

    
707
                        String[] parameterDefaultValue={"0.0"};
708
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
709
                        addProjectionParameterDefaultValue(count,"0.0");
710
                        addProjectionParameterDefaultValue(count,"0.0");
711

    
712
                        String[] parameterMaxValue={"360.0"};
713
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
714
                        addProjectionParameterMaxValue(count,"100000000.0");
715
                        addProjectionParameterMaxValue(count,"100000000.0");
716

    
717
                        String[] parameterMinValue={"-360.0"};
718
                        projectionParameterMinValueList.add(count,parameterMinValue);
719
                        addProjectionParameterMinValue(count,"-100000000.0");
720
                        addProjectionParameterMinValue(count,"-100000000.0");
721

    
722
                        String[] projectionAcronym={"gall"};
723
                        projectionAcronymList.add(count,projectionAcronym);
724
                }
725

    
726
                count++;
727
                {// GEOS
728
                        String[] projectionName={"GEOS"};
729
                        projectionNameList.add(count,projectionName);
730
                        addProjectionName(count,"Geostationary Satellite View");
731
                        addProjectionName(count,"Normalized Geostationary Projection");
732

    
733
                        String[] parameterName={"central_meridian"};
734
                        projectionParameterList.add(count,parameterName);
735
                        addProjectionParameter(count,"satellite_height");
736
                        addProjectionParameter(count,"false_easting");
737
                        addProjectionParameter(count,"false_northing");
738

    
739
                        String[] parameterAcronym={"lon_0"};
740
                        projectionParameterAcronymList.add(count,parameterAcronym);
741
                        addProjectionParameterAcronymList(count,"h");
742
                        addProjectionParameterAcronymList(count,"y_0");
743

    
744
                        String[] parameterDefaultValue={"0.0"};
745
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
746
                        addProjectionParameterDefaultValue(count,"35785831.0");
747
                        addProjectionParameterDefaultValue(count,"0.0");
748
                        addProjectionParameterDefaultValue(count,"0.0");
749

    
750
                        String[] parameterMaxValue={"360.0"};
751
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
752
                        addProjectionParameterMaxValue(count,"100000000.0");
753
                        addProjectionParameterMaxValue(count,"100000000.0");
754
                        addProjectionParameterMaxValue(count,"100000000.0");
755

    
756
                        String[] parameterMinValue={"-360.0"};
757
                        projectionParameterMinValueList.add(count,parameterMinValue);
758
                        addProjectionParameterMinValue(count,"-100000000.0");
759
                        addProjectionParameterMinValue(count,"-100000000.0");
760
                        addProjectionParameterMinValue(count,"-100000000.0");
761

    
762
                        String[] projectionAcronym={"geos"};
763
                        projectionAcronymList.add(count,projectionAcronym);
764
                }
765

    
766
                count++;
767
                {// Gnomonic
768
                        String[] projectionName={"Gnomonic"};
769
                        projectionNameList.add(count,projectionName);
770
                        addProjectionName(count,"Gnomonic");
771

    
772
                        String[] parameterName={"latitude_of_origin"};
773
                        projectionParameterList.add(count,parameterName);
774
                        addProjectionParameter(count,"central_meridian");
775
                        addProjectionParameter(count,"false_easting");
776
                        addProjectionParameter(count,"false_northing");
777

    
778
                        String[] parameterAcronym={"lat_0"};
779
                        projectionParameterAcronymList.add(count,parameterAcronym);
780
                        addProjectionParameterAcronymList(count,"lon_0");
781
                        addProjectionParameterAcronymList(count,"x_0");
782
                        addProjectionParameterAcronymList(count,"y_0");
783

    
784
                        String[] parameterDefaultValue={"0.0"};
785
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
786
                        addProjectionParameterDefaultValue(count,"0.0");
787
                        addProjectionParameterDefaultValue(count,"0.0");
788
                        addProjectionParameterDefaultValue(count,"0.0");
789

    
790
                        String[] parameterMaxValue={"90.0"};
791
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
792
                        addProjectionParameterMaxValue(count,"360.0");
793
                        addProjectionParameterMaxValue(count,"100000000.0");
794
                        addProjectionParameterMaxValue(count,"100000000.0");
795

    
796
                        String[] parameterMinValue={"-90.0"};
797
                        projectionParameterMinValueList.add(count,parameterMinValue);
798
                        addProjectionParameterMinValue(count,"-360.0");
799
                        addProjectionParameterMinValue(count,"-100000000.0");
800
                        addProjectionParameterMinValue(count,"-100000000.0");
801

    
802
                        String[] projectionAcronym={"gnom"};
803
                        projectionAcronymList.add(count,projectionAcronym);
804
                }
805

    
806
                count++;
807
                {// Goode
808
                        String[] projectionName={"Goode"};
809
                        projectionNameList.add(count,projectionName);
810

    
811
                        String[] parameterName={"central_meridian"};
812
                        projectionParameterList.add(count,parameterName);
813
                        addProjectionParameter(count,"false_easting");
814
                        addProjectionParameter(count,"false_northing");
815

    
816
                        String[] parameterAcronym={"lon_0"};
817
                        projectionParameterAcronymList.add(count,parameterAcronym);
818
                        addProjectionParameterAcronymList(count,"x_0");
819
                        addProjectionParameterAcronymList(count,"y_0");
820

    
821
                        String[] parameterDefaultValue={"0.0"};
822
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
823
                        addProjectionParameterDefaultValue(count,"0.0");
824
                        addProjectionParameterDefaultValue(count,"0.0");
825

    
826
                        String[] parameterMaxValue={"360.0"};
827
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
828
                        addProjectionParameterMaxValue(count,"100000000.0");
829
                        addProjectionParameterMaxValue(count,"100000000.0");
830

    
831
                        String[] parameterMinValue={"-360.0"};
832
                        projectionParameterMinValueList.add(count,parameterMinValue);
833
                        addProjectionParameterMinValue(count,"-100000000.0");
834
                        addProjectionParameterMinValue(count,"-100000000.0");
835

    
836
                        String[] projectionAcronym={"goode"};
837
                        projectionAcronymList.add(count,projectionAcronym);
838
                }
839
                
840
                count++;
841
                {// Krovak
842
                        String[] projectionName={"Krovak"};
843
                        projectionNameList.add(count,projectionName);
844
                        addProjectionName(count,"Krovak Oblique Conic Conformal");
845
                        addProjectionName(count,"9819");
846

    
847
                        String[] parameterName={"latitude_of_center"};
848
                        projectionParameterList.add(count,parameterName);
849
                        addProjectionParameter(count,"longitude_of_center");
850
                        addProjectionParameter(count,"azimuth");
851
                        addProjectionParameter(count,"scale_factor");
852
                        addProjectionParameter(count,"false_easting");
853
                        addProjectionParameter(count,"false_northing");
854

    
855
                        String[] parameterAcronym={"lat_0"};
856
                        projectionParameterAcronymList.add(count,parameterAcronym);
857
                        addProjectionParameterAcronymList(count,"lon_0");
858
                        addProjectionParameterAcronymList(count,"alpha");
859
                        addProjectionParameterAcronymList(count,"k");
860
                        addProjectionParameterAcronymList(count,"x_0");
861
                        addProjectionParameterAcronymList(count,"y_0");
862

    
863
                        String[] parameterDefaultValue={"0.0"};
864
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
865
                        addProjectionParameterDefaultValue(count,"0.0");
866
                        addProjectionParameterDefaultValue(count,"0.0");
867
                        addProjectionParameterDefaultValue(count,"1.0");
868
                        addProjectionParameterDefaultValue(count,"0.0");
869
                        addProjectionParameterDefaultValue(count,"0.0");
870

    
871
                        String[] parameterMaxValue={"90.0"};
872
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
873
                        addProjectionParameterMaxValue(count,"360.0");
874
                        addProjectionParameterMaxValue(count,"360.0");
875
                        addProjectionParameterMaxValue(count,"10.0");
876
                        addProjectionParameterMaxValue(count,"100000000.0");
877
                        addProjectionParameterMaxValue(count,"100000000.0");
878

    
879
                        String[] parameterMinValue={"-90.0"};
880
                        projectionParameterMinValueList.add(count,parameterMinValue);
881
                        addProjectionParameterMinValue(count,"-360.0");
882
                        addProjectionParameterMinValue(count,"-360.0");
883
                        addProjectionParameterMinValue(count,"0.0");
884
                        addProjectionParameterMinValue(count,"-100000000.0");
885
                        addProjectionParameterMinValue(count,"-100000000.0");
886

    
887
                        String[] projectionAcronym={"krovak"};
888
                        projectionAcronymList.add(count,projectionAcronym);
889
                }
890
                
891
                // Laborde_Oblique_Mercator - Similar a hotine_oblique_mercator
892

    
893
                count++;
894
                {// Lambert_Azimuthal_Equal_Area
895
                        String[] projectionName={"Lambert_Azimuthal_Equal_Area"};
896
                        projectionNameList.add(count,projectionName);
897
                        addProjectionName(count,"Lambert Azimuthal Equal Area");
898
                        addProjectionName(count,"Lambert Azimuthal Equal Area (Spherical)");
899
                        addProjectionName(count,"9820");
900

    
901
                        String[] parameterName={"latitude_of_center"};
902
                        projectionParameterList.add(count,parameterName);
903
                        addProjectionParameter(count,"longitude_of_center");
904
                        addProjectionParameter(count,"false_easting");
905
                        addProjectionParameter(count,"false_northing");
906

    
907
                        String[] parameterAcronym={"lat_0"};
908
                        projectionParameterAcronymList.add(count,parameterAcronym);
909
                        addProjectionParameterAcronymList(count,"lon_0");
910
                        addProjectionParameterAcronymList(count,"x_0");
911
                        addProjectionParameterAcronymList(count,"y_0");
912

    
913
                        String[] parameterDefaultValue={"0.0"};
914
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
915
                        addProjectionParameterDefaultValue(count,"0.0");
916
                        addProjectionParameterDefaultValue(count,"0.0");
917
                        addProjectionParameterDefaultValue(count,"0.0");
918

    
919
                        String[] parameterMaxValue={"90.0"};
920
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
921
                        addProjectionParameterMaxValue(count,"360.0");
922
                        addProjectionParameterMaxValue(count,"100000000.0");
923
                        addProjectionParameterMaxValue(count,"100000000.0");
924

    
925
                        String[] parameterMinValue={"-90.0"};
926
                        projectionParameterMinValueList.add(count,parameterMinValue);
927
                        addProjectionParameterMinValue(count,"-360.0");
928
                        addProjectionParameterMinValue(count,"-100000000.0");
929
                        addProjectionParameterMinValue(count,"-100000000.0");
930

    
931
                        String[] projectionAcronym={"laea"};
932
                        projectionAcronymList.add(count,projectionAcronym);
933
                }
934
                
935
                count++;
936
                {// Lambert_Conformal_Conic_1SP
937
                        String[] projectionName={"Lambert_Conformal_Conic_1SP"};
938
                        projectionNameList.add(count,projectionName);
939
                        addProjectionName(count,"Lambert Conic Conformal (1SP)");
940
                        addProjectionName(count,"9801");
941

    
942
                        String[] parameterName={"latitude_of_origin"};
943
                        projectionParameterList.add(count,parameterName);
944
                        addProjectionParameter(count,"central_meridian");
945
                        addProjectionParameter(count,"scale_factor");
946
                        addProjectionParameter(count,"false_easting");
947
                        addProjectionParameter(count,"false_northing");
948

    
949
                        String[] parameterAcronym={"lat_1"};
950
                        projectionParameterAcronymList.add(count,parameterAcronym);
951
                        addProjectionParameterAcronymList(count,"lat_0");
952
                        addProjectionParameterAcronymList(count,"lon_0");
953
                        addProjectionParameterAcronymList(count,"k_0");
954
                        addProjectionParameterAcronymList(count,"x_0");
955
                        addProjectionParameterAcronymList(count,"y_0");
956

    
957
                        String[] parameterDefaultValue={"0.0"};
958
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
959
                        addProjectionParameterDefaultValue(count,"0.0");
960
                        addProjectionParameterDefaultValue(count,"0.0");
961
                        addProjectionParameterDefaultValue(count,"1.0");
962
                        addProjectionParameterDefaultValue(count,"0.0");
963
                        addProjectionParameterDefaultValue(count,"0.0");
964

    
965
                        String[] parameterMaxValue={"90.0"};
966
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
967
                        addProjectionParameterMaxValue(count,"90.0");
968
                        addProjectionParameterMaxValue(count,"360.0");
969
                        addProjectionParameterMaxValue(count,"10.0");
970
                        addProjectionParameterMaxValue(count,"100000000.0");
971
                        addProjectionParameterMaxValue(count,"100000000.0");
972

    
973
                        String[] parameterMinValue={"-90.0"};
974
                        projectionParameterMinValueList.add(count,parameterMinValue);
975
                        addProjectionParameterMinValue(count,"-90.0");
976
                        addProjectionParameterMinValue(count,"-360.0");
977
                        addProjectionParameterMinValue(count,"0.0");
978
                        addProjectionParameterMinValue(count,"-100000000.0");
979
                        addProjectionParameterMinValue(count,"-100000000.0");
980

    
981
                        String[] projectionAcronym={"lcc"};
982
                        projectionAcronymList.add(count,projectionAcronym);
983
                }
984
                
985
                count++;
986
                {// Lambert_Conformal_Conic_2SP
987
                        String[] projectionName={"Lambert_Conformal_Conic_2SP"};
988
                        projectionNameList.add(count,projectionName);
989
                        addProjectionName(count,"Lambert Conic Conformal (2SP)");
990
                        addProjectionName(count,"9802");
991

    
992
                        String[] parameterName={"standard_parallel_1"};
993
                        projectionParameterList.add(count,parameterName);
994
                        addProjectionParameter(count,"standard_parallel_2");
995
                        addProjectionParameter(count,"latitude_of_origin");
996
                        addProjectionParameter(count,"central_meridian");
997
                        addProjectionParameter(count,"false_easting");
998
                        addProjectionParameter(count,"false_northing");
999

    
1000
                        String[] parameterAcronym={"lat_1"};
1001
                        projectionParameterAcronymList.add(count,parameterAcronym);
1002
                        addProjectionParameterAcronymList(count,"lat_2");
1003
                        addProjectionParameterAcronymList(count,"lat_0");
1004
                        addProjectionParameterAcronymList(count,"lon_0");
1005
                        addProjectionParameterAcronymList(count,"x_0");
1006
                        addProjectionParameterAcronymList(count,"y_0");
1007

    
1008
                        String[] parameterDefaultValue={"0.0"};
1009
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1010
                        addProjectionParameterDefaultValue(count,"0.0");
1011
                        addProjectionParameterDefaultValue(count,"0.0");
1012
                        addProjectionParameterDefaultValue(count,"0.0");
1013
                        addProjectionParameterDefaultValue(count,"0.0");
1014
                        addProjectionParameterDefaultValue(count,"0.0");
1015

    
1016
                        String[] parameterMaxValue={"90.0"};
1017
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1018
                        addProjectionParameterMaxValue(count,"90.0");
1019
                        addProjectionParameterMaxValue(count,"90.0");
1020
                        addProjectionParameterMaxValue(count,"360.0");
1021
                        addProjectionParameterMaxValue(count,"100000000.0");
1022
                        addProjectionParameterMaxValue(count,"100000000.0");
1023

    
1024
                        String[] parameterMinValue={"-90.0"};
1025
                        projectionParameterMinValueList.add(count,parameterMinValue);
1026
                        addProjectionParameterMinValue(count,"-90.0");
1027
                        addProjectionParameterMinValue(count,"-90.0");
1028
                        addProjectionParameterMinValue(count,"-360.0");
1029
                        addProjectionParameterMinValue(count,"-100000000.0");
1030
                        addProjectionParameterMinValue(count,"-100000000.0");
1031

    
1032
                        String[] projectionAcronym={"lcc"};
1033
                        projectionAcronymList.add(count,projectionAcronym);
1034
                }
1035
                
1036
                count++;
1037
                {// Lambert_Conformal_Conic_2SP_Belgium
1038
                        String[] projectionName={"Lambert_Conformal_Conic_2SP_Belgium"};
1039
                        projectionNameList.add(count,projectionName);
1040
                        addProjectionName(count,"Lambert Conic Conformal (2SP Belgium)");
1041
                        addProjectionName(count,"9803");
1042

    
1043
                        String[] parameterName={"standard_parallel_1"};
1044
                        projectionParameterList.add(count,parameterName);
1045
                        addProjectionParameter(count,"standard_parallel_2");
1046
                        addProjectionParameter(count,"latitude_of_origin");
1047
                        addProjectionParameter(count,"central_meridian");
1048
                        addProjectionParameter(count,"false_easting");
1049
                        addProjectionParameter(count,"false_northing");
1050

    
1051
                        String[] parameterAcronym={"lat_1"};
1052
                        projectionParameterAcronymList.add(count,parameterAcronym);
1053
                        addProjectionParameterAcronymList(count,"lat_2");
1054
                        addProjectionParameterAcronymList(count,"lat_0");
1055
                        addProjectionParameterAcronymList(count,"lon_0");
1056
                        addProjectionParameterAcronymList(count,"x_0");
1057
                        addProjectionParameterAcronymList(count,"y_0");
1058

    
1059
                        String[] parameterDefaultValue={"0.0"};
1060
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1061
                        addProjectionParameterDefaultValue(count,"0.0");
1062
                        addProjectionParameterDefaultValue(count,"0.0");
1063
                        addProjectionParameterDefaultValue(count,"0.0");
1064
                        addProjectionParameterDefaultValue(count,"0.0");
1065
                        addProjectionParameterDefaultValue(count,"0.0");
1066

    
1067
                        String[] parameterMaxValue={"90.0"};
1068
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1069
                        addProjectionParameterMaxValue(count,"90.0");
1070
                        addProjectionParameterMaxValue(count,"90.0");
1071
                        addProjectionParameterMaxValue(count,"360.0");
1072
                        addProjectionParameterMaxValue(count,"100000000.0");
1073
                        addProjectionParameterMaxValue(count,"100000000.0");
1074

    
1075
                        String[] parameterMinValue={"-90.0"};
1076
                        projectionParameterMinValueList.add(count,parameterMinValue);
1077
                        addProjectionParameterMinValue(count,"-90.0");
1078
                        addProjectionParameterMinValue(count,"-90.0");
1079
                        addProjectionParameterMinValue(count,"-360.0");
1080
                        addProjectionParameterMinValue(count,"-100000000.0");
1081
                        addProjectionParameterMinValue(count,"-100000000.0");
1082

    
1083
                        String[] projectionAcronym={"lcc"};
1084
                        projectionAcronymList.add(count,projectionAcronym);
1085
                }
1086
                
1087
                count++;
1088
                {// Mercator_1SP
1089
                        String[] projectionName={"Mercator_1SP"};
1090
                        projectionNameList.add(count,projectionName);
1091
                        addProjectionName(count,"Mercator");
1092
                        addProjectionName(count,"9804");
1093
                        addProjectionName(count, "Mercator (1SP)");
1094

    
1095
                        String[] parameterName={"central_meridian"};
1096
                        projectionParameterList.add(count,parameterName);
1097
                        addProjectionParameter(count,"scale_factor");  // o latitude_origin
1098
                        addProjectionParameter(count,"false_easting");
1099
                        addProjectionParameter(count,"false_northing");
1100

    
1101
                        String[] parameterAcronym={"lon_0"};
1102
                        projectionParameterAcronymList.add(count,parameterAcronym);
1103
                        addProjectionParameterAcronymList(count,"k"); // o lat_ts
1104
                        addProjectionParameterAcronymList(count,"x_0");
1105
                        addProjectionParameterAcronymList(count,"y_0");
1106

    
1107
                        String[] parameterDefaultValue={"0.0"};
1108
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1109
                        addProjectionParameterDefaultValue(count,"1.0"); // o 0.0
1110
                        addProjectionParameterDefaultValue(count,"0.0");
1111
                        addProjectionParameterDefaultValue(count,"0.0");
1112

    
1113
                        String[] parameterMaxValue={"360.0"};
1114
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1115
                        addProjectionParameterMaxValue(count,"10.0");
1116
                        addProjectionParameterMaxValue(count,"100000000.0");
1117
                        addProjectionParameterMaxValue(count,"100000000.0");
1118

    
1119
                        String[] parameterMinValue={"-360.0"};
1120
                        projectionParameterMinValueList.add(count,parameterMinValue);
1121
                        addProjectionParameterMinValue(count,"0.0");
1122
                        addProjectionParameterMinValue(count,"-100000000.0");
1123
                        addProjectionParameterMinValue(count,"-100000000.0");
1124

    
1125
                        String[] projectionAcronym={"merc"};
1126
                        projectionAcronymList.add(count,projectionAcronym);
1127
                }
1128
                
1129
                count++;
1130
                {// Mercator_2SP
1131
                        String[] projectionName={"Mercator_2SP"};
1132
                        projectionNameList.add(count,projectionName);
1133
                        addProjectionName(count,"Mercator");
1134
                        addProjectionName(count,"9805");
1135
                        addProjectionName(count, "Mercator (2SP)");
1136

    
1137
                        String[] parameterName={"central_meridian"};
1138
                        projectionParameterList.add(count,parameterName);
1139
                        addProjectionParameter(count,"standard_parallel_1");
1140
                        addProjectionParameter(count,"false_easting");
1141
                        addProjectionParameter(count,"false_northing");
1142

    
1143
                        String[] parameterAcronym={"lon_0"};
1144
                        projectionParameterAcronymList.add(count,parameterAcronym);
1145
                        addProjectionParameterAcronymList(count,"lat_ts");
1146
                        addProjectionParameterAcronymList(count,"x_0");
1147
                        addProjectionParameterAcronymList(count,"y_0");
1148

    
1149
                        String[] parameterDefaultValue={"0.0"};
1150
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1151
                        addProjectionParameterDefaultValue(count,"0.0"); // o 0.0
1152
                        addProjectionParameterDefaultValue(count,"0.0");
1153
                        addProjectionParameterDefaultValue(count,"0.0");
1154

    
1155
                        String[] parameterMaxValue={"360.0"};
1156
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1157
                        addProjectionParameterMaxValue(count,"90.0");
1158
                        addProjectionParameterMaxValue(count,"100000000.0");
1159
                        addProjectionParameterMaxValue(count,"100000000.0");
1160

    
1161
                        String[] parameterMinValue={"-360.0"};
1162
                        projectionParameterMinValueList.add(count,parameterMinValue);
1163
                        addProjectionParameterMinValue(count,"-90.0");
1164
                        addProjectionParameterMinValue(count,"-100000000.0");
1165
                        addProjectionParameterMinValue(count,"-100000000.0");
1166

    
1167
                        String[] projectionAcronym={"merc"};
1168
                        projectionAcronymList.add(count,projectionAcronym);
1169
                }
1170

    
1171
                count++;
1172
                {// Miller_Cylindrical
1173
                        String[] projectionName={"Miller_Cylindrical"};
1174
                        projectionNameList.add(count,projectionName);
1175
                        addProjectionName(count,"Miller Cylindrical");
1176

    
1177
                        String[] parameterName={"latitude_of_center"};
1178
                        projectionParameterList.add(count,parameterName);
1179
                        addProjectionParameter(count,"longitude_of_center");
1180
                        addProjectionParameter(count,"false_easting");
1181
                        addProjectionParameter(count,"false_northing");
1182

    
1183
                        String[] parameterAcronym={"lat_0"};
1184
                        projectionParameterAcronymList.add(count,parameterAcronym);
1185
                        addProjectionParameterAcronymList(count,"lon_0");
1186
                        addProjectionParameterAcronymList(count,"x_0");
1187
                        addProjectionParameterAcronymList(count,"y_0");
1188

    
1189
                        String[] parameterDefaultValue={"0.0"};
1190
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1191
                        addProjectionParameterDefaultValue(count,"0.0");
1192
                        addProjectionParameterDefaultValue(count,"0.0");
1193
                        addProjectionParameterDefaultValue(count,"0.0");
1194

    
1195
                        String[] parameterMaxValue={"90.0"};
1196
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1197
                        addProjectionParameterMaxValue(count,"360.0");
1198
                        addProjectionParameterMaxValue(count,"100000000.0");
1199
                        addProjectionParameterMaxValue(count,"100000000.0");
1200

    
1201
                        String[] parameterMinValue={"-90.0"};
1202
                        projectionParameterMinValueList.add(count,parameterMinValue);
1203
                        addProjectionParameterMinValue(count,"-360.0");
1204
                        addProjectionParameterMinValue(count,"-100000000.0");
1205
                        addProjectionParameterMinValue(count,"-100000000.0");
1206

    
1207
                        String[] projectionAcronym={"mill"};
1208
                        projectionAcronymList.add(count,projectionAcronym);
1209
                }
1210
                
1211
                count++;
1212
                {// Mollweide
1213
                        String[] projectionName={"Mollweide"};
1214
                        projectionNameList.add(count,projectionName);
1215
                        addProjectionName(count,"Hornolographic");
1216
                        addProjectionName(count,"Babinet");
1217
                        addProjectionName(count,"Elliptical");
1218

    
1219
                        String[] parameterName={"central_meridian"};
1220
                        projectionParameterList.add(count,parameterName);
1221
                        addProjectionParameter(count,"false_easting");
1222
                        addProjectionParameter(count,"false_northing");
1223

    
1224
                        String[] parameterAcronym={"lon_0"};
1225
                        projectionParameterAcronymList.add(count,parameterAcronym);
1226
                        addProjectionParameterAcronymList(count,"x_0");
1227
                        addProjectionParameterAcronymList(count,"y_0");
1228

    
1229
                        String[] parameterDefaultValue={"0.0"};
1230
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1231
                        addProjectionParameterDefaultValue(count,"0.0");
1232
                        addProjectionParameterDefaultValue(count,"0.0");
1233

    
1234
                        String[] parameterMaxValue={"360.0"};
1235
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1236
                        addProjectionParameterMaxValue(count,"100000000.0");
1237
                        addProjectionParameterMaxValue(count,"100000000.0");
1238

    
1239
                        String[] parameterMinValue={"-360.0"};
1240
                        projectionParameterMinValueList.add(count,parameterMinValue);
1241
                        addProjectionParameterMinValue(count,"-100000000.0");
1242
                        addProjectionParameterMinValue(count,"-100000000.0");
1243

    
1244
                        String[] projectionAcronym={"moll"};
1245
                        projectionAcronymList.add(count,projectionAcronym);
1246
                }
1247

    
1248
                count++;
1249
                {// New_Zealand_Map_Grid
1250
                        String[] projectionName={"New_Zealand_Map_Grid"};
1251
                        projectionNameList.add(count,projectionName);
1252
                        addProjectionName(count,"New Zealand Map Grid");
1253
                        addProjectionName(count,"9811");
1254

    
1255
                        String[] parameterName={"latitude_of_origin"};
1256
                        projectionParameterList.add(count,parameterName);
1257
                        addProjectionParameter(count,"central_meridian");
1258
                        addProjectionParameter(count,"false_easting");
1259
                        addProjectionParameter(count,"false_northing");
1260

    
1261
                        String[] parameterAcronym={"lat_0"};
1262
                        projectionParameterAcronymList.add(count,parameterAcronym);
1263
                        addProjectionParameterAcronymList(count,"lon_0");
1264
                        addProjectionParameterAcronymList(count,"x_0");
1265
                        addProjectionParameterAcronymList(count,"y_0");
1266

    
1267
                        String[] parameterDefaultValue={"0.0"};
1268
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1269
                        addProjectionParameterDefaultValue(count,"0.0");
1270
                        addProjectionParameterDefaultValue(count,"0.0");
1271
                        addProjectionParameterDefaultValue(count,"0.0");
1272

    
1273
                        String[] parameterMaxValue={"90.0"};
1274
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1275
                        addProjectionParameterMaxValue(count,"360.0");
1276
                        addProjectionParameterMaxValue(count,"100000000.0");
1277
                        addProjectionParameterMaxValue(count,"100000000.0");
1278

    
1279
                        String[] parameterMinValue={"-90.0"};
1280
                        projectionParameterMinValueList.add(count,parameterMinValue);
1281
                        addProjectionParameterMinValue(count,"-360.0");
1282
                        addProjectionParameterMinValue(count,"-100000000.0");
1283
                        addProjectionParameterMinValue(count,"-100000000.0");
1284

    
1285
                        String[] projectionAcronym={"nzmg"};
1286
                        projectionAcronymList.add(count,projectionAcronym);
1287
                }
1288

    
1289
                count++;
1290
                {// Oblique_Mercator
1291
                        String[] projectionName={"Oblique_Mercator"};
1292
                        projectionNameList.add(count,projectionName);
1293
                        addProjectionName(count,"Oblique Mercator");
1294
                        addProjectionName(count,"9815");
1295
                        addProjectionName(count,"CT_ObliqueMercator");
1296
                        addProjectionName(count,"Hotine_Oblique_Mercator_Azimuth_Center");
1297
                        addProjectionName(count,"Rectified_Skew_Orthomorphic_Center");
1298
                        addProjectionName(count,"Hotine Oblique Mercator");
1299

    
1300
                        String[] parameterName={"latitude_of_center"};
1301
                        projectionParameterList.add(count,parameterName);
1302
                        addProjectionParameter(count,"longitude_of_center");
1303
                        addProjectionParameter(count,"azimuth");
1304
                        addProjectionParameter(count,"rectified_grid_angle");
1305
                        addProjectionParameter(count,"scale_factor");
1306
                        addProjectionParameter(count,"false_easting");
1307
                        addProjectionParameter(count,"false_northing");
1308

    
1309
                        String[] parameterAcronym={"lat_0"};
1310
                        projectionParameterAcronymList.add(count,parameterAcronym);
1311
                        addProjectionParameterAcronymList(count,"lonc");
1312
                        addProjectionParameterAcronymList(count,"alpha");
1313
                        addProjectionParameterAcronymList(count,"alpha");
1314
                        addProjectionParameterAcronymList(count,"k");
1315
                        addProjectionParameterAcronymList(count,"x_0");
1316
                        addProjectionParameterAcronymList(count,"y_0");
1317

    
1318
                        String[] parameterDefaultValue={"0.0"};
1319
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1320
                        addProjectionParameterDefaultValue(count,"0.0");
1321
                        addProjectionParameterDefaultValue(count,"0.0");
1322
                        addProjectionParameterDefaultValue(count,"0.0");
1323
                        addProjectionParameterDefaultValue(count,"1.0");
1324
                        addProjectionParameterDefaultValue(count,"0.0");
1325
                        addProjectionParameterDefaultValue(count,"0.0");
1326

    
1327
                        String[] parameterMaxValue={"90.0"};
1328
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1329
                        addProjectionParameterMaxValue(count,"360.0");
1330
                        addProjectionParameterMaxValue(count,"360.0");
1331
                        addProjectionParameterMaxValue(count,"360.0");
1332
                        addProjectionParameterMaxValue(count,"10.0");
1333
                        addProjectionParameterMaxValue(count,"100000000.0");
1334
                        addProjectionParameterMaxValue(count,"100000000.0");
1335

    
1336
                        String[] parameterMinValue={"-90.0"};
1337
                        projectionParameterMinValueList.add(count,parameterMinValue);
1338
                        addProjectionParameterMinValue(count,"-360.0");
1339
                        addProjectionParameterMinValue(count,"-360.0");
1340
                        addProjectionParameterMinValue(count,"-360.0");
1341
                        addProjectionParameterMinValue(count,"0.0");
1342
                        addProjectionParameterMinValue(count,"-100000000.0");
1343
                        addProjectionParameterMinValue(count,"-100000000.0");
1344

    
1345
                        String[] projectionAcronym={"omerc"};
1346
                        projectionAcronymList.add(count,projectionAcronym);
1347
                }
1348

    
1349
                count++;
1350
                {// Oblique_Mercator
1351
                        String[] projectionName={"Hotine_Oblique_Mercator_Two_Point_Center"};
1352
                        projectionNameList.add(count,projectionName);
1353
                        addProjectionName(count,"Hotine_Oblique_Mercator_Two_Point_Natural_Origin");
1354

    
1355
            /*SEMI_MAJOR,          SEMI_MINOR,
1356
            LAT_OF_1ST_POINT,    LONG_OF_1ST_POINT,
1357
            LAT_OF_2ND_POINT,    LONG_OF_2ND_POINT,
1358
                    LAT_OF_CENTRE,       SCALE_FACTOR_LOCAL,
1359
            FALSE_EASTING_LOCAL,       FALSE_NORTHING_LOCAL*/
1360

    
1361
            String[] parameterName={"Latitude_Of_2nd_Point"};
1362
                        projectionParameterList.add(count,parameterName);
1363
                        addProjectionParameter(count,"Longitude_Of_1st_Point");
1364
                        addProjectionParameter(count,"Latitude_Of_2nd_Point");
1365
                        addProjectionParameter(count,"Longitude_Of_2nd_Point");
1366
                        addProjectionParameter(count,"scale_factor");
1367
                        addProjectionParameter(count,"false_easting");
1368
                        addProjectionParameter(count,"false_northing");
1369

    
1370
                        String[] parameterAcronym={"lat_1"};
1371
                        projectionParameterAcronymList.add(count,parameterAcronym);
1372
                        addProjectionParameterAcronymList(count,"lon_1");
1373
                        addProjectionParameterAcronymList(count,"lat_2");
1374
                        addProjectionParameterAcronymList(count,"lon_2");
1375
                        addProjectionParameterAcronymList(count,"k");
1376
                        addProjectionParameterAcronymList(count,"x_0");
1377
                        addProjectionParameterAcronymList(count,"y_0");
1378

    
1379
                        String[] parameterDefaultValue={"0.0"};
1380
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1381
                        addProjectionParameterDefaultValue(count,"0.0");
1382
                        addProjectionParameterDefaultValue(count,"0.0");
1383
                        addProjectionParameterDefaultValue(count,"0.0");
1384
                        addProjectionParameterDefaultValue(count,"1.0");
1385
                        addProjectionParameterDefaultValue(count,"0.0");
1386
                        addProjectionParameterDefaultValue(count,"0.0");
1387

    
1388
                        String[] parameterMaxValue={"90.0"};
1389
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1390
                        addProjectionParameterMaxValue(count,"360.0");
1391
                        addProjectionParameterMaxValue(count,"90.0");
1392
                        addProjectionParameterMaxValue(count,"360.0");
1393
                        addProjectionParameterMaxValue(count,"10.0");
1394
                        addProjectionParameterMaxValue(count,"100000000.0");
1395
                        addProjectionParameterMaxValue(count,"100000000.0");
1396

    
1397
                        String[] parameterMinValue={"-90.0"};
1398
                        projectionParameterMinValueList.add(count,parameterMinValue);
1399
                        addProjectionParameterMinValue(count,"-360.0");
1400
                        addProjectionParameterMinValue(count,"-90.0");
1401
                        addProjectionParameterMinValue(count,"-360.0");
1402
                        addProjectionParameterMinValue(count,"0.0");
1403
                        addProjectionParameterMinValue(count,"-100000000.0");
1404
                        addProjectionParameterMinValue(count,"-100000000.0");
1405

    
1406
                        String[] projectionAcronym={"omerc"};
1407
                        projectionAcronymList.add(count,projectionAcronym);
1408
                }
1409

    
1410
                count++;
1411
                {// Oblique_Stereographic
1412
                        String[] projectionName={"Oblique_Stereographic"};
1413
                        projectionNameList.add(count,projectionName);
1414
                        addProjectionName(count,"Oblique Stereographic");
1415
                        addProjectionName(count,"9809");
1416

    
1417
                        String[] parameterName={"latitude_of_origin"};
1418
                        projectionParameterList.add(count,parameterName);
1419
                        addProjectionParameter(count,"central_meridian");
1420
                        addProjectionParameter(count,"scale_factor");
1421
                        addProjectionParameter(count,"false_easting");
1422
                        addProjectionParameter(count,"false_northing");
1423

    
1424
                        String[] parameterAcronym={"lat_0"};
1425
                        projectionParameterAcronymList.add(count,parameterAcronym);
1426
                        addProjectionParameterAcronymList(count,"lon_0");
1427
                        addProjectionParameterAcronymList(count,"k");
1428
                        addProjectionParameterAcronymList(count,"x_0");
1429
                        addProjectionParameterAcronymList(count,"y_0");
1430

    
1431
                        String[] parameterDefaultValue={"0.0"};
1432
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1433
                        addProjectionParameterDefaultValue(count,"0.0");
1434
                        addProjectionParameterDefaultValue(count,"1.0");
1435
                        addProjectionParameterDefaultValue(count,"0.0");
1436
                        addProjectionParameterDefaultValue(count,"0.0");
1437

    
1438
                        String[] parameterMaxValue={"90.0"};
1439
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1440
                        addProjectionParameterMaxValue(count,"360.0");
1441
                        addProjectionParameterMaxValue(count,"10.0");
1442
                        addProjectionParameterMaxValue(count,"100000000.0");
1443
                        addProjectionParameterMaxValue(count,"100000000.0");
1444

    
1445
                        String[] parameterMinValue={"-90.0"};
1446
                        projectionParameterMinValueList.add(count,parameterMinValue);
1447
                        addProjectionParameterMinValue(count,"-360.0");
1448
                        addProjectionParameterMinValue(count,"0.0");
1449
                        addProjectionParameterMinValue(count,"-100000000.0");
1450
                        addProjectionParameterMinValue(count,"-100000000.0");
1451

    
1452
                        String[] projectionAcronym={"sterea"};
1453
                        projectionAcronymList.add(count,projectionAcronym);
1454
                }
1455

    
1456
                count++;
1457
                {// Orthographic
1458
                        String[] projectionName={"Orthographic"};
1459
                        projectionNameList.add(count,projectionName);
1460

    
1461
                        String[] parameterName={"latitude_of_origin"};
1462
                        projectionParameterList.add(count,parameterName);
1463
                        addProjectionParameter(count,"central_meridian");
1464
                        addProjectionParameter(count,"false_easting");
1465
                        addProjectionParameter(count,"false_northing");
1466

    
1467
                        String[] parameterAcronym={"lat_0"};
1468
                        projectionParameterAcronymList.add(count,parameterAcronym);
1469
                        addProjectionParameterAcronymList(count,"lon_0");
1470
                        addProjectionParameterAcronymList(count,"x_0");
1471
                        addProjectionParameterAcronymList(count,"y_0");
1472

    
1473
                        String[] parameterDefaultValue={"0.0"};
1474
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1475
                        addProjectionParameterDefaultValue(count,"0.0");
1476
                        addProjectionParameterDefaultValue(count,"0.0");
1477
                        addProjectionParameterDefaultValue(count,"0.0");
1478

    
1479
                        String[] parameterMaxValue={"90.0"};
1480
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1481
                        addProjectionParameterMaxValue(count,"360.0");
1482
                        addProjectionParameterMaxValue(count,"100000000.0");
1483
                        addProjectionParameterMaxValue(count,"100000000.0");
1484

    
1485
                        String[] parameterMinValue={"-90.0"};
1486
                        projectionParameterMinValueList.add(count,parameterMinValue);
1487
                        addProjectionParameterMinValue(count,"-360.0");
1488
                        addProjectionParameterMinValue(count,"-100000000.0");
1489
                        addProjectionParameterMinValue(count,"-100000000.0");
1490

    
1491
                        String[] projectionAcronym={"ortho"};
1492
                        projectionAcronymList.add(count,projectionAcronym);
1493
                }
1494

    
1495
                count++;
1496
                {// Polar_Stereographic
1497
                        String[] projectionName={"Polar_Stereographic"};
1498
                        projectionNameList.add(count,projectionName);
1499
                        addProjectionName(count,"Polar Stereographic");
1500
                        addProjectionName(count,"9810");
1501

    
1502
                        String[] parameterName={"latitude_of_origin"};
1503
                        projectionParameterList.add(count,parameterName);
1504
                        addProjectionParameter(count,"latitude_of_origin");
1505
                        addProjectionParameter(count,"central_meridian");
1506
                        addProjectionParameter(count,"scale_factor");
1507
                        addProjectionParameter(count,"false_easting");
1508
                        addProjectionParameter(count,"false_northing");
1509

    
1510
                        String[] parameterAcronym={"lat_0"};
1511
                        //lat_0=90 o lat_0=-90
1512
                        projectionParameterAcronymList.add(count,parameterAcronym);
1513
                        addProjectionParameterAcronymList(count,"lat_ts");
1514
                        addProjectionParameterAcronymList(count,"lon_0");
1515
                        addProjectionParameterAcronymList(count,"k");
1516
                        addProjectionParameterAcronymList(count,"x_0");
1517
                        addProjectionParameterAcronymList(count,"y_0");
1518

    
1519
                        String[] parameterDefaultValue={"90.0"};
1520
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1521
                        addProjectionParameterDefaultValue(count,"90.0");
1522
                        addProjectionParameterDefaultValue(count,"0.0");
1523
                        addProjectionParameterDefaultValue(count,"1.0");
1524
                        addProjectionParameterDefaultValue(count,"0.0");
1525
                        addProjectionParameterDefaultValue(count,"0.0");
1526

    
1527
                        String[] parameterMaxValue={"90.0"};
1528
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1529
                        addProjectionParameterMaxValue(count,"90.0");
1530
                        addProjectionParameterMaxValue(count,"360.0");
1531
                        addProjectionParameterMaxValue(count,"10.0");
1532
                        addProjectionParameterMaxValue(count,"100000000.0");
1533
                        addProjectionParameterMaxValue(count,"100000000.0");
1534

    
1535
                        String[] parameterMinValue={"-90.0"};
1536
                        projectionParameterMinValueList.add(count,parameterMinValue);
1537
                        addProjectionParameterMinValue(count,"-90.0");
1538
                        addProjectionParameterMinValue(count,"-360.0");
1539
                        addProjectionParameterMinValue(count,"0.0");
1540
                        addProjectionParameterMinValue(count,"-100000000.0");
1541
                        addProjectionParameterMinValue(count,"-100000000.0");
1542

    
1543
                        String[] projectionAcronym={"stere"};
1544
                        projectionAcronymList.add(count,projectionAcronym);
1545
                }
1546

    
1547
                count++;
1548
                {// Polyconic
1549
                        String[] projectionName={"Polyconic"};
1550
                        projectionNameList.add(count,projectionName);
1551

    
1552
                        String[] parameterName={"latitude_of_origin"};
1553
                        projectionParameterList.add(count,parameterName);
1554
                        addProjectionParameter(count,"central_meridian");
1555
                        addProjectionParameter(count,"false_easting");
1556
                        addProjectionParameter(count,"false_northing");
1557

    
1558
                        String[] parameterAcronym={"lat_0"};
1559
                        projectionParameterAcronymList.add(count,parameterAcronym);
1560
                        addProjectionParameterAcronymList(count,"lon_0");
1561
                        addProjectionParameterAcronymList(count,"x_0");
1562
                        addProjectionParameterAcronymList(count,"y_0");
1563

    
1564
                        String[] parameterDefaultValue={"0.0"};
1565
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1566
                        addProjectionParameterDefaultValue(count,"0.0");
1567
                        addProjectionParameterDefaultValue(count,"0.0");
1568
                        addProjectionParameterDefaultValue(count,"0.0");
1569

    
1570
                        String[] parameterMaxValue={"90.0"};
1571
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1572
                        addProjectionParameterMaxValue(count,"360.0");
1573
                        addProjectionParameterMaxValue(count,"100000000.0");
1574
                        addProjectionParameterMaxValue(count,"100000000.0");
1575

    
1576
                        String[] parameterMinValue={"-90.0"};
1577
                        projectionParameterMinValueList.add(count,parameterMinValue);
1578
                        addProjectionParameterMinValue(count,"-360.0");
1579
                        addProjectionParameterMinValue(count,"-100000000.0");
1580
                        addProjectionParameterMinValue(count,"-100000000.0");
1581

    
1582
                        String[] projectionAcronym={"poly"};
1583
                        projectionAcronymList.add(count,projectionAcronym);
1584
                }
1585

    
1586
                count++;
1587
                {// Robinson
1588
                        String[] projectionName={"Robinson"};
1589
                        projectionNameList.add(count,projectionName);
1590

    
1591
                        String[] parameterName={"longitude_of_center"};
1592
                        projectionParameterList.add(count,parameterName);
1593
                        addProjectionParameter(count,"false_easting");
1594
                        addProjectionParameter(count,"false_northing");
1595

    
1596
                        String[] parameterAcronym={"lon_0"};
1597
                        projectionParameterAcronymList.add(count,parameterAcronym);
1598
                        addProjectionParameterAcronymList(count,"x_0");
1599
                        addProjectionParameterAcronymList(count,"y_0");
1600

    
1601
                        String[] parameterDefaultValue={"0.0"};
1602
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1603
                        addProjectionParameterDefaultValue(count,"0.0");
1604
                        addProjectionParameterDefaultValue(count,"0.0");
1605

    
1606
                        String[] parameterMaxValue={"360.0"};
1607
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1608
                        addProjectionParameterMaxValue(count,"100000000.0");
1609
                        addProjectionParameterMaxValue(count,"100000000.0");
1610

    
1611
                        String[] parameterMinValue={"-360.0"};
1612
                        projectionParameterMinValueList.add(count,parameterMinValue);
1613
                        addProjectionParameterMinValue(count,"-100000000.0");
1614
                        addProjectionParameterMinValue(count,"-100000000.0");
1615

    
1616
                        String[] projectionAcronym={"robin"};
1617
                        projectionAcronymList.add(count,projectionAcronym);
1618
                }
1619

    
1620
                //         Rosenmund Oblique Mercator - No en EPSG
1621

    
1622
                count++;
1623
                {// Sinusoidal
1624
                        String[] projectionName={"Sinusoidal"};
1625
                        projectionNameList.add(count,projectionName);
1626

    
1627
                        String[] parameterName={"longitude_of_center"};
1628
                        projectionParameterList.add(count,parameterName);
1629
                        addProjectionParameter(count,"false_easting");
1630
                        addProjectionParameter(count,"false_northing");
1631

    
1632
                        String[] parameterAcronym={"lon_0"};
1633
                        projectionParameterAcronymList.add(count,parameterAcronym);
1634
                        addProjectionParameterAcronymList(count,"x_0");
1635
                        addProjectionParameterAcronymList(count,"y_0");
1636

    
1637
                        String[] parameterDefaultValue={"0.0"};
1638
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1639
                        addProjectionParameterDefaultValue(count,"0.0");
1640
                        addProjectionParameterDefaultValue(count,"0.0");
1641

    
1642
                        String[] parameterMaxValue={"360.0"};
1643
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1644
                        addProjectionParameterMaxValue(count,"100000000.0");
1645
                        addProjectionParameterMaxValue(count,"100000000.0");
1646

    
1647
                        String[] parameterMinValue={"-360.0"};
1648
                        projectionParameterMinValueList.add(count,parameterMinValue);
1649
                        addProjectionParameterMinValue(count,"-100000000.0");
1650
                        addProjectionParameterMinValue(count,"-100000000.0");
1651

    
1652
                        String[] projectionAcronym={"sinu"};
1653
                        projectionAcronymList.add(count,projectionAcronym);
1654
                }
1655

    
1656
                count++;
1657
                {// Swiss_Oblique_Cylindrical
1658
                        String[] projectionName={"Swiss_Oblique_Cylindrical"};
1659
                        projectionNameList.add(count,projectionName);
1660
                        addProjectionName(count,"Swiss Oblique Cylindrical");
1661
                        addProjectionName(count,"Swiss Oblique Mercator");
1662
                        addProjectionName(count,"9814");
1663

    
1664
                        String[] parameterName={"latitude_of_origin"};
1665
                        projectionParameterList.add(count,parameterName);
1666
                        addProjectionParameter(count,"central_meridian");
1667
                        addProjectionParameter(count,"false_easting");
1668
                        addProjectionParameter(count,"false_northing");
1669

    
1670
                        String[] parameterAcronym={"lat_0"};
1671
                        projectionParameterAcronymList.add(count,parameterAcronym);
1672
                        addProjectionParameterAcronymList(count,"lon_0");
1673
                        addProjectionParameterAcronymList(count,"x_0");
1674
                        addProjectionParameterAcronymList(count,"y_0");
1675

    
1676
                        String[] parameterDefaultValue={"0.0"};
1677
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1678
                        addProjectionParameterDefaultValue(count,"0.0");
1679
                        addProjectionParameterDefaultValue(count,"0.0");
1680
                        addProjectionParameterDefaultValue(count,"0.0");
1681

    
1682
                        String[] parameterMaxValue={"90.0"};
1683
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1684
                        addProjectionParameterMaxValue(count,"360.0");
1685
                        addProjectionParameterMaxValue(count,"100000000.0");
1686
                        addProjectionParameterMaxValue(count,"100000000.0");
1687

    
1688
                        String[] parameterMinValue={"-90.0"};
1689
                        projectionParameterMinValueList.add(count,parameterMinValue);
1690
                        addProjectionParameterMinValue(count,"-360.0");
1691
                        addProjectionParameterMinValue(count,"-100000000.0");
1692
                        addProjectionParameterMinValue(count,"-100000000.0");
1693

    
1694
                        String[] projectionAcronym={"somerc"};
1695
                        projectionAcronymList.add(count,projectionAcronym);
1696
                }
1697

    
1698
                count++;
1699
                {// Stereographic
1700
                        String[] projectionName={"Stereographic"};
1701
                        projectionNameList.add(count,projectionName);
1702

    
1703
                        String[] parameterName={"latitude_of_origin"};
1704
                        projectionParameterList.add(count,parameterName);
1705
                        addProjectionParameter(count,"central_meridian");
1706
                        addProjectionParameter(count,"scale_factor");
1707
                        addProjectionParameter(count,"false_easting");
1708
                        addProjectionParameter(count,"false_northing");
1709

    
1710
                        String[] parameterAcronym={"lat_0"};
1711
                        projectionParameterAcronymList.add(count,parameterAcronym);
1712
                        addProjectionParameterAcronymList(count,"lon_0");
1713
                        addProjectionParameterAcronymList(count,"k");
1714
                        addProjectionParameterAcronymList(count,"x_0");
1715
                        addProjectionParameterAcronymList(count,"y_0");
1716

    
1717
                        String[] parameterDefaultValue={"0.0"};
1718
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1719
                        addProjectionParameterDefaultValue(count,"0.0");
1720
                        addProjectionParameterDefaultValue(count,"1.0");
1721
                        addProjectionParameterDefaultValue(count,"0.0");
1722
                        addProjectionParameterDefaultValue(count,"0.0");
1723

    
1724
                        String[] parameterMaxValue={"90.0"};
1725
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1726
                        addProjectionParameterMaxValue(count,"360.0");
1727
                        addProjectionParameterMaxValue(count,"10.0");
1728
                        addProjectionParameterMaxValue(count,"100000000.0");
1729
                        addProjectionParameterMaxValue(count,"100000000.0");
1730

    
1731
                        String[] parameterMinValue={"-90.0"};
1732
                        projectionParameterMinValueList.add(count,parameterMinValue);
1733
                        addProjectionParameterMinValue(count,"-360.0");
1734
                        addProjectionParameterMinValue(count,"0.0");
1735
                        addProjectionParameterMinValue(count,"-100000000.0");
1736
                        addProjectionParameterMinValue(count,"-100000000.0");
1737

    
1738
                        String[] projectionAcronym={"stere"};
1739
                        projectionAcronymList.add(count,projectionAcronym);
1740
                }
1741

    
1742
                count++;
1743
                {// Transverse_Mercator
1744
                        String[] projectionName={"Transverse_Mercator"};
1745
                        projectionNameList.add(count,projectionName);
1746
                        addProjectionName(count,"Transverse Mercator");
1747
                        addProjectionName(count,"Gauss-Kruger");
1748
                        addProjectionName(count,"9807");
1749

    
1750
                        String[] parameterName={"latitude_of_origin"};
1751
                        projectionParameterList.add(count,parameterName);
1752
                        addProjectionParameter(count,"central_meridian");
1753
                        addProjectionParameter(count,"scale_factor");
1754
                        addProjectionParameter(count,"false_easting");
1755
                        addProjectionParameter(count,"false_northing");
1756

    
1757
                        String[] parameterAcronym={"lat_0"};
1758
                        projectionParameterAcronymList.add(count,parameterAcronym);
1759
                        addProjectionParameterAcronymList(count,"lon_0");
1760
                        addProjectionParameterAcronymList(count,"k");
1761
                        addProjectionParameterAcronymList(count,"x_0");
1762
                        addProjectionParameterAcronymList(count,"y_0");
1763

    
1764
                        String[] parameterDefaultValue={"0.0"};
1765
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1766
                        addProjectionParameterDefaultValue(count,"0.0");
1767
                        addProjectionParameterDefaultValue(count,"1.0");
1768
                        addProjectionParameterDefaultValue(count,"0.0");
1769
                        addProjectionParameterDefaultValue(count,"0.0");
1770

    
1771
                        String[] parameterMaxValue={"90.0"};
1772
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1773
                        addProjectionParameterMaxValue(count,"360.0");
1774
                        addProjectionParameterMaxValue(count,"10.0");
1775
                        addProjectionParameterMaxValue(count,"100000000.0");
1776
                        addProjectionParameterMaxValue(count,"100000000.0");
1777

    
1778
                        String[] parameterMinValue={"-90.0"};
1779
                        projectionParameterMinValueList.add(count,parameterMinValue);
1780
                        addProjectionParameterMinValue(count,"-360.0");
1781
                        addProjectionParameterMinValue(count,"0.0");
1782
                        addProjectionParameterMinValue(count,"-100000000.0");
1783
                        addProjectionParameterMinValue(count,"-100000000.0");
1784

    
1785
                        String[] projectionAcronym={"tmerc"};
1786
                        projectionAcronymList.add(count,projectionAcronym);
1787
                }
1788

    
1789
                //         Transverse Mercator (Modified Alaska) - No en EPSG
1790

    
1791
                count++;
1792
                {// Transverse_Mercator_South_Orientated
1793
                        String[] projectionName={"Transverse_Mercator_South_Orientated"};
1794
                        projectionNameList.add(count,projectionName);
1795
                        addProjectionName(count,"Transverse Mercator (South Oriented)");
1796
                        addProjectionName(count,"Transverse Mercator (South Orientated)");                        
1797
                        addProjectionName(count,"9808");
1798

    
1799
                        String[] parameterName={"latitude_of_origin"};
1800
                        projectionParameterList.add(count,parameterName);
1801
                        addProjectionParameter(count,"central_meridian");
1802
                        addProjectionParameter(count,"scale_factor");
1803
                        addProjectionParameter(count,"false_easting");
1804
                        addProjectionParameter(count,"false_northing");
1805

    
1806
                        String[] parameterAcronym={"lat_0"};
1807
                        projectionParameterAcronymList.add(count,parameterAcronym);
1808
                        addProjectionParameterAcronymList(count,"lon_0");
1809
                        addProjectionParameterAcronymList(count,"k");
1810
                        addProjectionParameterAcronymList(count,"x_0");
1811
                        addProjectionParameterAcronymList(count,"y_0");
1812

    
1813
                        String[] parameterDefaultValue={"0.0"};
1814
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1815
                        addProjectionParameterDefaultValue(count,"0.0");
1816
                        addProjectionParameterDefaultValue(count,"1.0");
1817
                        addProjectionParameterDefaultValue(count,"0.0");
1818
                        addProjectionParameterDefaultValue(count,"0.0");
1819

    
1820
                        String[] parameterMaxValue={"90.0"};
1821
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1822
                        addProjectionParameterMaxValue(count,"360.0");
1823
                        addProjectionParameterMaxValue(count,"10.0");
1824
                        addProjectionParameterMaxValue(count,"100000000.0");
1825
                        addProjectionParameterMaxValue(count,"100000000.0");
1826

    
1827
                        String[] parameterMinValue={"-90.0"};
1828
                        projectionParameterMinValueList.add(count,parameterMinValue);
1829
                        addProjectionParameterMinValue(count,"-360.0");
1830
                        addProjectionParameterMinValue(count,"0.0");
1831
                        addProjectionParameterMinValue(count,"-100000000.0");
1832
                        addProjectionParameterMinValue(count,"-100000000.0");
1833

    
1834
                        String[] projectionAcronym={"tmerc"};
1835
                        projectionAcronymList.add(count,projectionAcronym);
1836
                }
1837

    
1838
                /*
1839
                count++;
1840
                {// Tunisia_Mining_Grid
1841
                        String[] projectionName={"Tunisia_Mining_Grid"};
1842
                        projectionNameList.add(count,projectionName);
1843
                        addProjectionName(count,"Tunisia Mining Grid");
1844
                        addProjectionName(count,"9816");
1845

1846
                        String[] parameterName={"latitude_of_origin"};
1847
                        projectionParameterList.add(count,parameterName);
1848
                        addProjectionParameter(count,"central_meridian");
1849
                        addProjectionParameter(count,"false_easting");
1850
                        addProjectionParameter(count,"false_northing");
1851
                }
1852
                */
1853

    
1854
                count++;
1855
                {// VanDerGrinten
1856
                        String[] projectionName={"VanDerGrinten"};
1857
                        projectionNameList.add(count,projectionName);
1858
                        addProjectionName(count,"VanDerGrinten I");
1859

    
1860
                        String[] parameterName={"central_meridian"};
1861
                        projectionParameterList.add(count,parameterName);
1862
                        addProjectionParameter(count,"false_easting");
1863
                        addProjectionParameter(count,"false_northing");
1864

    
1865
                        String[] parameterAcronym={"lon_0"};
1866
                        projectionParameterAcronymList.add(count,parameterAcronym);
1867
                        addProjectionParameterAcronymList(count,"x_0");
1868
                        addProjectionParameterAcronymList(count,"y_0");
1869

    
1870
                        String[] parameterDefaultValue={"0.0"};
1871
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1872
                        addProjectionParameterDefaultValue(count,"0.0");
1873
                        addProjectionParameterDefaultValue(count,"0.0");
1874

    
1875
                        String[] parameterMaxValue={"360.0"};
1876
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1877
                        addProjectionParameterMaxValue(count,"100000000.0");
1878
                        addProjectionParameterMaxValue(count,"100000000.0");
1879

    
1880
                        String[] parameterMinValue={"-360.0"};
1881
                        projectionParameterMinValueList.add(count,parameterMinValue);
1882
                        addProjectionParameterMinValue(count,"-100000000.0");
1883
                        addProjectionParameterMinValue(count,"-100000000.0");
1884

    
1885
                        String[] projectionAcronym={"sinu"};
1886
                        projectionAcronymList.add(count,projectionAcronym);
1887
                }
1888
        }
1889
        
1890
        public void addProjectionName(int pos,String projectionName) throws CrsException
1891
        {
1892
                if(pos<0||pos>(projectionNameList.size()-1))
1893
                        throw new CrsException(new Exception());
1894
                String[] projectionNames=(String[]) projectionNameList.get(pos);
1895
                String[] newProjectionNames=new String[projectionNames.length+1];
1896
                for(int i=0;i<projectionNames.length;i++)
1897
                {
1898
                        newProjectionNames[i]=projectionNames[i];
1899
                }
1900
                newProjectionNames[projectionNames.length]=projectionName;
1901
                projectionNameList.remove(pos);
1902
                projectionNameList.add(pos,newProjectionNames);
1903
        }
1904
        
1905
        public void addUnitName(int pos,String unitName) throws CrsException
1906
        {
1907
                if(pos<0||pos>(unitNameList.size()-1))
1908
                        throw new CrsException(new Exception());
1909
                String[] unitNames=(String[]) unitNameList.get(pos);
1910
                String[] newUnitNames=new String[unitNames.length+1];
1911
                for(int i=0;i<unitNames.length;i++)
1912
                {
1913
                        newUnitNames[i]=unitNames[i];
1914
                }
1915
                newUnitNames[unitNames.length]=unitName;
1916
                unitNameList.remove(pos);
1917
                unitNameList.add(pos,newUnitNames);
1918
        }
1919
        
1920
        public void addProjectionParameterName(int pos,String projectionParameterName) throws CrsException
1921
        {
1922
                if(pos<0||pos>(projectionParameterNameList.size()-1))
1923
                        throw new CrsException(new Exception());
1924
                String[] projectionParameterNames=(String[]) projectionParameterNameList.get(pos);
1925
                String[] newProjectionParameterNames=new String[projectionParameterNames.length+1];
1926
                for(int i=0;i<projectionParameterNames.length;i++)
1927
                {
1928
                        newProjectionParameterNames[i]=projectionParameterNames[i];
1929
                }
1930
                newProjectionParameterNames[projectionParameterNames.length]=projectionParameterName;
1931
                projectionParameterNameList.remove(pos);
1932
                projectionParameterNameList.add(pos,newProjectionParameterNames);
1933
        }
1934
        
1935
        public void addProjectionParameter(int pos,String projectionParameter) throws CrsException
1936
        {
1937
                if(pos<0||pos>(projectionParameterList.size()-1))
1938
                        throw new CrsException(new Exception());
1939
                String[] projectionParameters=(String[]) projectionParameterList.get(pos);
1940
                String[] newProjectionParameters=new String[projectionParameters.length+1];
1941
                for(int i=0;i<projectionParameters.length;i++)
1942
                {
1943
                        newProjectionParameters[i]=projectionParameters[i];
1944
                }
1945
                newProjectionParameters[projectionParameters.length]=projectionParameter;
1946
                projectionParameterList.remove(pos);
1947
                projectionParameterList.add(pos,newProjectionParameters);
1948
        }
1949
        
1950
        public void addProjectionParameterDefaultValue(int pos,String projectionParameterDefaultValue) throws CrsException
1951
        {
1952
                if(pos<0||pos>(projectionParameterDefaultValueList.size()-1))
1953
                        throw new CrsException(new Exception());
1954
                String[] projectionParameterDefaultValues=(String[]) projectionParameterDefaultValueList.get(pos);
1955
                String[] newProjectionParameterDefaultValues=new String[projectionParameterDefaultValues.length+1];
1956
                for(int i=0;i<projectionParameterDefaultValues.length;i++)
1957
                {
1958
                        newProjectionParameterDefaultValues[i]=projectionParameterDefaultValues[i];
1959
                }
1960
                newProjectionParameterDefaultValues[projectionParameterDefaultValues.length]=projectionParameterDefaultValue;
1961
                projectionParameterDefaultValueList.remove(pos);
1962
                projectionParameterDefaultValueList.add(pos,newProjectionParameterDefaultValues);
1963
        }
1964
        
1965
        public void addProjectionParameterMaxValue(int pos,String projectionParameterMaxValue) throws CrsException
1966
        {
1967
                if(pos<0||pos>(projectionParameterMaxValueList.size()-1))
1968
                        throw new CrsException(new Exception());
1969
                String[] projectionParameterMaxValues=(String[]) projectionParameterMaxValueList.get(pos);
1970
                String[] newProjectionParameterMaxValues=new String[projectionParameterMaxValues.length+1];
1971
                for(int i=0;i<projectionParameterMaxValues.length;i++)
1972
                {
1973
                        newProjectionParameterMaxValues[i]=projectionParameterMaxValues[i];
1974
                }
1975
                newProjectionParameterMaxValues[projectionParameterMaxValues.length]=projectionParameterMaxValue;
1976
                projectionParameterMaxValueList.remove(pos);
1977
                projectionParameterMaxValueList.add(pos,newProjectionParameterMaxValues);
1978
        }
1979
        
1980
        public void addProjectionParameterMinValue(int pos,String projectionParameterMinValue) throws CrsException
1981
        {
1982
                if(pos<0||pos>(projectionParameterMinValueList.size()-1))
1983
                        throw new CrsException(new Exception());
1984
                String[] projectionParameterMinValues=(String[]) projectionParameterMinValueList.get(pos);
1985
                String[] newProjectionParameterMinValues=new String[projectionParameterMinValues.length+1];
1986
                for(int i=0;i<projectionParameterMinValues.length;i++)
1987
                {
1988
                        newProjectionParameterMinValues[i]=projectionParameterMinValues[i];
1989
                }
1990
                newProjectionParameterMinValues[projectionParameterMinValues.length]=projectionParameterMinValue;
1991
                projectionParameterMinValueList.remove(pos);
1992
                projectionParameterMinValueList.add(pos,newProjectionParameterMinValues);
1993
        }
1994
        
1995
        public void addProjectionParameterAcronymList(int pos,String projectionParameterAcronym) throws CrsException
1996
        {
1997
                if(pos<0||pos>(projectionParameterAcronymList.size()-1))
1998
                        throw new CrsException(new Exception());
1999
                String[] projectionParameterAcronyms=(String[]) projectionParameterAcronymList.get(pos);
2000
                String[] newProjectionParameterAcronyms=new String[projectionParameterAcronyms.length+1];
2001
                for(int i=0;i<projectionParameterAcronyms.length;i++)
2002
                {
2003
                        newProjectionParameterAcronyms[i]=projectionParameterAcronyms[i];
2004
                }
2005
                newProjectionParameterAcronyms[projectionParameterAcronyms.length]=projectionParameterAcronym;
2006
                projectionParameterAcronymList.remove(pos);
2007
                projectionParameterAcronymList.add(pos,newProjectionParameterAcronyms);
2008
        }
2009
        
2010
        public int findProjection(String projectionName)
2011
        {
2012
                for(int i=0;i<projectionNameList.size();i++)
2013
                {
2014
                        String[] projectionNames=(String[]) projectionNameList.get(i);
2015
                        for(int j=0;j<projectionNames.length;j++)
2016
                        {
2017
                                if(projectionNames[j].toLowerCase().replaceAll(" ","").equals(projectionName.toLowerCase().replaceAll(" ","")))
2018
                                        return i;
2019
                        }
2020
                }
2021
                        
2022
                return -1;
2023
        }
2024
        
2025
        public int findProjectionParameter(String parameterName)
2026
        {
2027
                for(int i=0;i<projectionParameterNameList.size();i++)
2028
                {
2029
                        String[] parameterNames=(String[]) projectionParameterNameList.get(i);
2030
                        for(int j=0;j<parameterNames.length;j++)
2031
                        {
2032
                                if(parameterNames[j].toLowerCase().replaceAll(" ","").equals(parameterName.toLowerCase().replaceAll(" ","")))
2033
                                        return i;
2034
                        }
2035
                }
2036
                        
2037
                return -1;
2038
        }
2039
        
2040
        public int findProjectionParameters(String parameterName1, String parameterName2)
2041
        {
2042
                for(int i=0;i<projectionParameterNameList.size();i++)
2043
                {
2044
                        boolean existsParameter1=false;
2045
                        boolean existsParameter2=false;
2046
                        
2047
                        
2048
                        String[] parameterNames=(String[]) projectionParameterNameList.get(i);
2049
                        for(int j=0;j<parameterNames.length;j++)
2050
                        {
2051
                                if(parameterNames[j].toLowerCase().replaceAll(" ","").equals(parameterName1.toLowerCase().replaceAll(" ","")))
2052
                                        existsParameter1=true;
2053
                                if(parameterNames[j].toLowerCase().replaceAll(" ","").equals(parameterName2.toLowerCase().replaceAll(" ","")))
2054
                                        existsParameter2=true;
2055
                        }
2056
                        if(existsParameter1&&existsParameter2)
2057
                                return i;
2058
                }
2059
                        
2060
                return -1;
2061
        }
2062
        
2063
        public int findUnit(String unitName)
2064
        {
2065
                for(int i=0;i<unitNameList.size();i++)
2066
                {
2067
                        String[] unitNames=(String[]) unitNameList.get(i);
2068
                        for(int j=0;j<unitNames.length;j++)
2069
                        {
2070
                                if(unitNames[j].toLowerCase().replaceAll(" ","").equals(unitName.toLowerCase().replaceAll(" ","")))
2071
                                        return i;
2072
                        }
2073
                }
2074
                        
2075
                return -1;
2076
        }
2077
        
2078
        public String getProj4UnitName(int pos) throws CrsException 
2079
        {
2080
                if(pos<0||pos>(unitNameList.size()-1))
2081
                                throw new CrsException(new Exception());
2082
                return ((String[]) unitNameList.get(pos))[0];
2083
        }
2084
        
2085
        public String getProj4ProjectionName(int pos) throws CrsException 
2086
        {
2087
                if(pos<0||pos>(projectionNameList.size()-1))
2088
                                throw new CrsException(new Exception());
2089
                return ((String[]) projectionNameList.get(pos))[0];
2090
        }
2091
        
2092
        public String getProj4ProjectionParameterName(int pos) throws CrsException 
2093
        {
2094
                // Ojo decir a Jose Luis que quite los parametros del elipsoide
2095
                if(pos<0||pos>(projectionParameterNameList.size()-1))
2096
                                throw new CrsException(new Exception());
2097
                return ((String[]) projectionParameterNameList.get(pos))[0];
2098
        }
2099
        
2100
        public ArrayList getProj4ProjectionParameters(int pos) throws CrsException 
2101
        {
2102
                
2103
                if(pos<0||pos>(projectionParameterList.size()-1))
2104
                                throw new CrsException(new Exception());
2105
                String[] parameterList=(String[])projectionParameterList.get(pos);
2106
                ArrayList parameters=new ArrayList();
2107
                for(int i=0;i<parameterList.length;i++)
2108
                {
2109
                        String parameterName=parameterList[i];
2110
                        int posParameter=findProjectionParameter(parameterName);
2111
                        if(posParameter==-1)
2112
                        {
2113
                                System.out.println("El parametro = "+parameterName+" no esta en la lista de parametros");
2114
                                throw new CrsException(new Exception());
2115
                        }
2116
                        //String parameterNameProj4=getProj4ProjectionParameterName(posParameter);
2117
                        String parameterNameProj4=parameterName;
2118
                        parameters.add(i,parameterNameProj4);
2119
                }
2120
                return parameters;
2121
        }
2122
        
2123
        public ArrayList getProj4ProjectionParameterDefaultValues(int pos) throws CrsException 
2124
        {
2125
                
2126
                if(pos<0||pos>(projectionParameterDefaultValueList.size()-1))
2127
                                throw new CrsException(new Exception());
2128
                String[] parameterDefaultValueList=(String[])projectionParameterDefaultValueList.get(pos);
2129
                ArrayList parameterDefaultValues=new ArrayList();
2130
                for(int i=0;i<parameterDefaultValueList.length;i++)
2131
                {
2132
                        String parameterDefaultValue=parameterDefaultValueList[i];
2133
                        parameterDefaultValues.add(i,parameterDefaultValue);
2134
                }
2135
                return parameterDefaultValues;
2136
        }
2137
        
2138
        public ArrayList getProj4ProjectionParameterMaxValues(int pos) throws CrsException 
2139
        {
2140
                
2141
                if(pos<0||pos>(projectionParameterMaxValueList.size()-1))
2142
                                throw new CrsException(new Exception());
2143
                String[] parameterMaxValueList=(String[])projectionParameterMaxValueList.get(pos);
2144
                ArrayList parameterMaxValues=new ArrayList();
2145
                for(int i=0;i<parameterMaxValueList.length;i++)
2146
                {
2147
                        String parameterMaxValue=parameterMaxValueList[i];
2148
                        parameterMaxValues.add(i,parameterMaxValue);
2149
                }
2150
                return parameterMaxValues;
2151
        }
2152
        
2153
        public ArrayList getProj4ProjectionParameterMinValues(int pos) throws CrsException 
2154
        {
2155
                
2156
                if(pos<0||pos>(projectionParameterMinValueList.size()-1))
2157
                                throw new CrsException(new Exception());
2158
                String[] parameterMinValueList=(String[])projectionParameterMinValueList.get(pos);
2159
                ArrayList parameterMinValues=new ArrayList();
2160
                for(int i=0;i<parameterMinValueList.length;i++)
2161
                {
2162
                        String parameterMinValue=parameterMinValueList[i];
2163
                        parameterMinValues.add(i,parameterMinValue);
2164
                }
2165
                return parameterMinValues;
2166
        }
2167
        
2168
        public ArrayList getProj4ProjectionParameterAcronyms(int pos) throws CrsException 
2169
        {
2170
                
2171
                if(pos<0||pos>(projectionParameterAcronymList.size()-1))
2172
                                throw new CrsException(new Exception());
2173
                String[] parameterAcronymList=(String[])projectionParameterAcronymList.get(pos);
2174
                ArrayList parameterAcronyms=new ArrayList();
2175
                for(int i=0;i<parameterAcronymList.length;i++)
2176
                {
2177
                        String parameterAcronym=parameterAcronymList[i];
2178
                        parameterAcronyms.add(i,parameterAcronym);
2179
                }
2180
                return parameterAcronyms;
2181
        }
2182
        
2183
        public String getProjectionParameterUnitList(int pos) throws CrsException {
2184
                if(pos<0||pos>(projectionParameterUnitList.size()-1))
2185
                        throw new CrsException(new Exception());
2186
                String [] projParamUnit = (String[]) projectionParameterUnitList.get(pos);
2187
                return projParamUnit[0];
2188
        }
2189

    
2190
        public String exportToProj4(Crs crs) throws CrsException
2191
        {
2192
                String strProj4="+proj=";
2193
                String strDatumName="";
2194
                String strDatumCode="";
2195
                String strProj4Datum="";
2196
                String[] primeMeridian=crs.getCrsWkt().getPrimen();
2197
                String primeMeridianName=primeMeridian[0];
2198
                double primeMeridianValue=Double.parseDouble(primeMeridian[1]); // -> hacer el cambio de unidades
2199
                String[] strPrimeMeridianProj4=primeMeridianToProj4(primeMeridianName,primeMeridianValue);
2200
                primeMeridianValue=Double.parseDouble(strPrimeMeridianProj4[1]);
2201
                primeMeridianName=strPrimeMeridianProj4[0];
2202
                String primeMeridianAcronym=strPrimeMeridianProj4[2]; // Puede ser cadena vacia->Analizar
2203

    
2204
                // Extracción del código de Datum
2205
                String codDatum="";
2206
                strDatumName=crs.getCrsWkt().getDatumName();
2207
        int intCodDatum=0;//Integer.parseInt(codDatum);
2208
        strProj4Datum=datumToProj4(strDatumName,intCodDatum);
2209
        
2210
        String parameter_unit = crs.getCrsWkt().getUnit_p()[1];
2211

    
2212

    
2213
                String strProj=crs.getCrsWkt().getProjcs();
2214
                if(strProj.equals(""))
2215
                {
2216
                        //System.out.println("Projection Name = "+"Geodetic");
2217
                        strProj4+="longlat ";
2218
                }
2219
                else
2220
                {
2221
                        //System.out.println("Projection      = "+strProj);
2222
                        String strProjName=crs.getCrsWkt().getProjection();
2223
                        //System.out.println("Projection Name = "+strProjName);
2224
                        int indexProj=findProjection(strProjName);
2225
                        if(indexProj==-1)
2226
                        {
2227
                                System.out.println("La proyeccion "+strProjName+" no figura en la lista Proj4");
2228
                                throw(new CrsException(new Exception()));
2229
                        }
2230
                        String projectionName=(getProj4ProjectionName(indexProj)).trim();
2231
                        ArrayList parameterNames=getProj4ProjectionParameters(indexProj);
2232
                        ArrayList parameterAcronyms=getProj4ProjectionParameterAcronyms(indexProj);
2233
                        ArrayList parameterValues=getProj4ProjectionParameterDefaultValues(indexProj);
2234
                        ArrayList parameterMaxValues=getProj4ProjectionParameterMaxValues(indexProj);
2235
                        ArrayList parameterMinValues=getProj4ProjectionParameterMinValues(indexProj);
2236
                        //System.out.println("Parametros:"+parameterNames);
2237
                        String[] gtParameterValues=crs.getCrsWkt().getParam_value();
2238
                        String[] gtParameterNames=crs.getCrsWkt().getParam_name();
2239
                        for(int i=0;i<parameterNames.size();i++)
2240
                        {
2241
                                boolean existsParameter=false;
2242
                                String parameterValue="";
2243
                                for(int j=0;j<gtParameterNames.length;j++)
2244
                                {
2245
                                        String gtParameterName=gtParameterNames[j].trim();
2246
                                        //int posGtParameter=findProjectionParameter(gtParameterName);
2247
                                        int posGtParameter=findProjectionParameters(gtParameterName,(String)parameterNames.get(i));
2248
                                        //int posParameter=findProjectionParameter((String)parameterNames.get(i));
2249
                                        //if(((String)parameterNames.get(i)).trim().equals(gtParameterNames[j].trim()))
2250
                                        if(posGtParameter!=-1)
2251
                                        {
2252
                                                gtParameterName=getProj4ProjectionParameterName(posGtParameter);
2253
                                                gtParameterNames[j]=gtParameterName;
2254
                                                existsParameter=true;
2255
                                                double maxValue=Double.parseDouble((String)parameterMaxValues.get(i));
2256
                                                double minValue=Double.parseDouble((String)parameterMinValues.get(i));
2257
                                                //parameterValue=Double.parseDouble(gtParameterValues[j]);
2258
                                                parameterValue=gtParameterValues[j]; // Ojo unidades -> analizar
2259
                                                double auxValue=Double.parseDouble(parameterValue);
2260
                                                if((auxValue<minValue)||(auxValue>maxValue))
2261
                                                {
2262
                                                        String strError="El parametro ";
2263
                                                        strError+=gtParameterName;
2264
                                                        strError+=" esta fuera de dominio";
2265
                                                        System.out.println(strError);
2266
                                                        throw new CrsException(new Exception());
2267
                                                }
2268
                                                else if (((String)parameterNames.get(i)).trim().equals("scale_factor") && (auxValue==minValue)) {
2269
                                                        String strError="El parametro ";
2270
                                                        strError+=gtParameterName;
2271
                                                        strError+=" esta fuera de dominio";
2272
                                                        System.out.println(strError);
2273
                                                        throw new CrsException(new Exception());
2274
                                                }
2275
                                                break;
2276
                                        }
2277
                                        /*else
2278
                                        {
2279
                                                String strError="El parametro recibido de GeoTools";
2280
                                                strError+=gtParameterName;
2281
                                                strError+=" no esta contemplado en la proyeccion";
2282
                                                System.out.println(strError);
2283
                                                throw new CrsException(new Exception());
2284
                                        }*/
2285
                                }
2286
                                if(existsParameter)
2287
                                {
2288
                                        parameterValues.set(i,parameterValue);
2289
                                        //System.out.println("- Parametro["+parameterNames.get(i)+"]="+parameterValue);
2290
                                }
2291
                                /*
2292
                                else
2293
                                {
2294
                                        value=Double.parseDouble((String)parameterDefaultValues.get(i));
2295
                                        System.out.println("El parametro "+parameterNames.get(i)+" no figura en la lista geotools");
2296
                                        throw(new CrsException(new Exception()));
2297
                                }
2298
                                */
2299
                        }
2300
                        String[] projectionAcronym=(String[])projectionAcronymList.get(indexProj);
2301
                        strProj4=strProj4+projectionAcronym[0]+" ";
2302
                        String strExtraProj4="";
2303
                        // Control de casos especiales
2304
                        if(projectionAcronym.equals("merc")) // 1 - Mercator
2305
                        {
2306
                                if(projectionName.equalsIgnoreCase("Mercator_1SP")) // No deberia tener lat_ts
2307
                                {
2308
                                        for(int j=0;j<gtParameterNames.length;j++)
2309
                                        {
2310
                                                String gtParameterName=gtParameterNames[j].trim();
2311
                                                if(gtParameterName.equalsIgnoreCase("latitude_of_origin"))
2312
                                                {
2313
                                                        double gtParameterValue=Double.parseDouble(gtParameterValues[j]);
2314
                                                        if(gtParameterValue!=0.0)
2315
                                                        {
2316
                                                                String strError="La proyeccin con latitude_origin debera ser MERCATOR_2SP";
2317
                                                                System.out.println(strError);
2318
                                                                throw new CrsException(new Exception());
2319
                                                        }
2320
                                                        break;
2321
                                                }
2322
                                        }
2323
                                }
2324
                                if(projectionName.equalsIgnoreCase("Mercator_2SP")) // No deberia tener lat_ts
2325
                                {
2326
                                        for(int j=0;j<gtParameterNames.length;j++)
2327
                                        {
2328
                                                String gtParameterName=gtParameterNames[j].trim();
2329
                                                if(gtParameterName.equalsIgnoreCase("scale_factor"))
2330
                                                {
2331
                                                        double gtParameterValue=Double.parseDouble(gtParameterValues[j]);
2332
                                                        if(gtParameterValue!=0.0)
2333
                                                        {
2334
                                                                String strError="La proyeccin con scale_factor debera ser MERCATOR_1SP";
2335
                                                                System.out.println(strError);
2336
                                                                throw new CrsException(new Exception());
2337
                                                        }
2338
                                                        break;
2339
                                                }
2340
                                        }
2341
                                }
2342
                        }
2343
                        else if(projectionAcronym.equals("stere"))
2344
                        {
2345
                                if(projectionName.equalsIgnoreCase("Polar_Stereographic")) // lat_ts=lat_0={90 o -90)
2346
                                {
2347
                                        boolean isNorthPole=true;
2348
                                        for(int j=0;j<gtParameterNames.length;j++)
2349
                                        {
2350
                                                String gtParameterName=gtParameterNames[j].trim();
2351
                                                if(gtParameterName.equalsIgnoreCase("latitude_of_origin"))
2352
                                                {
2353
                                                        double gtParameterValue=Double.parseDouble(gtParameterValues[j]);
2354
                                                        if(gtParameterValue==90.0) isNorthPole=true;
2355
                                                        else if(gtParameterValue==-90.0)  isNorthPole=false;
2356
                                                        else
2357
                                                        {
2358
                                                                String strError="La proyeccin estereogrfica polar debe tener latitud origen 90 o -90";
2359
                                                                System.out.println(strError);
2360
                                                                throw new CrsException(new Exception());
2361
                                                        }
2362
                                                        break;
2363
                                                }
2364
                                        }
2365
                                        String strLatitudeOrigin="90.0";
2366
                                        if(!isNorthPole) strLatitudeOrigin="-90.0";
2367
                                        for(int k=0;k<parameterNames.size();k++)
2368
                                        {
2369
                                                String parameterName=(String)parameterNames.get(k);
2370
                                                if(parameterName.equalsIgnoreCase("latitude_of_origin"))
2371
                                                {
2372
                                                        parameterValues.set(k,strLatitudeOrigin);
2373
                                                }
2374
                                        }
2375
                                }
2376
                        }
2377
                        else if(projectionAcronym.equals("omerc"))
2378
                        {
2379
                                boolean existsLat1=false;
2380
                                boolean existsLat2=false;
2381
                                boolean existsLon1=false;
2382
                                boolean existsLon2=false;
2383
                                // Necesito buscar un caso de ejemplo
2384
                        }
2385
                        else if(projectionAcronym.equals("mill"))
2386
                        {
2387
                                strExtraProj4="+R_A ";
2388
                        }
2389
                        else if(projectionAcronym.equals("vandg"))
2390
                        {
2391
                                strExtraProj4="+R_A ";
2392
                        }
2393
                        
2394
                        for(int i=0;i<parameterNames.size();i++)
2395
                        {
2396
                                boolean control=true;
2397
                                String parameterName=((String)parameterNames.get(i)).trim();
2398
                                String parameterAcronym=((String)parameterAcronyms.get(i)).trim();
2399
                                String strParameterValue=((String)parameterValues.get(i)).trim();
2400
                                if(projectionAcronym.equals("omerc"))
2401
                                {
2402
                                        if(parameterName.equals("rectified_grid_angle"))
2403
                                                control=false;
2404
                                }
2405
                                if(parameterAcronym.equals("lon_0")
2406
                                                ||parameterAcronym.equals("lonc"))
2407
                                {
2408
                                        double parameterValue=Double.parseDouble(strParameterValue);
2409
                                        parameterValue=parameterValue-primeMeridianValue;
2410
                                        strParameterValue=Double.toString(parameterValue);
2411
                                }
2412
                                if(control)
2413
                                        strProj4=strProj4+"+"+parameterAcronym+"="+strParameterValue+" ";
2414
                        }
2415
                        strProj4+=strExtraProj4;
2416
                        //getProj4ProjectionName();
2417
                }
2418
                
2419
                // Que pasa si no hay elipsoide? -> OGR por defecto pone WGS84
2420
                double a=0;
2421
                double inv_f=0;
2422
                String elipName=crs.getCrsWkt().getSpheroid()[0];
2423
                a=Double.parseDouble(crs.getCrsWkt().getSpheroid()[1]);
2424
                inv_f=Double.parseDouble(crs.getCrsWkt().getSpheroid()[2]);
2425
                String strEllipseAcronym=ellipseToProj4(a,inv_f);
2426
                String strEllipse="";
2427
                if(strEllipseAcronym.equals(""))
2428
                {
2429
                        if (!Double.isInfinite(inv_f))
2430
                                strEllipse="+a="+a+" +rf="+inv_f+" ";
2431
                        else
2432
                                strEllipse="+R="+a+" ";
2433
                }
2434
                else
2435
                {
2436
                        strEllipse="+ellps="+strEllipseAcronym+" ";
2437
                }
2438
                strProj4+=strEllipse;
2439
                //System.out.println("Elipsoide["+elipName+"]=("+a+","+inv_f+")");
2440
                if(!strProj4Datum.equals(""))
2441
                {
2442
                        strProj4+=strProj4Datum;
2443
                }
2444
                strProj4+=primeMeridianAcronym;
2445
                String strWkt=crs.getWKT();
2446
                
2447
                //System.out.println("- Cadena proj4: "+strProj4);
2448
                return strProj4;                
2449
        }
2450
                
2451
        public String exportToProj4(CoordinateReferenceSystem crs) throws CrsException
2452
        {
2453
                String strProj4="+proj=";
2454
                String[] primeMeridian = new String[2];
2455
                String strProj="";
2456
                String strProjName="";
2457
                String strDatumName="";
2458
                String strDatumCode="";
2459
                String strProj4Datum="";
2460
                String strProj4ToMeter="";
2461
                String[] gtParameterValues=new String[1];
2462
                String[] gtParameterNames= new String[1];
2463
                String[] spheroid = new String[3];
2464
                double a=0;
2465
                double inv_f=0;
2466
                String elipName="";
2467
                if (crs instanceof DefaultProjectedCRS) {
2468
                        DefaultProjectedCRS crsProjected = (DefaultProjectedCRS) crs;
2469
                        primeMeridian = Primem(((DefaultGeodeticDatum) crsProjected.getDatum()).getPrimeMeridian());
2470
                        strProj = crsProjected.getName().toString().split(":")[1];
2471
                        strProjName = getName(crsProjected.getConversionFromBase().getMethod().getName());
2472
                        gtParameterValues = new String[crsProjected.getConversionFromBase().getParameterValues().values().size()];
2473
                        gtParameterNames = new String[crsProjected.getConversionFromBase().getParameterValues().values().size()];
2474
                        String str;
2475
                        for (int i=0; i< crsProjected.getConversionFromBase().getParameterValues().values().size();i++) {
2476
                                str = crsProjected.getConversionFromBase().getParameterValues().values().get(i).toString();
2477
                                Unit u = crsProjected.getConversionFromBase().getParameterValues().parameter(str.split("=")[0]).getUnit();
2478
                                double value = crsProjected.getConversionFromBase().getParameterValues().parameter(str.split("=")[0]).doubleValue();
2479
                                value = convert(value, u.toString());
2480
                                gtParameterNames[i] = str.split("=")[0];
2481
                                gtParameterValues [i] = String.valueOf(value);
2482
                        }
2483
                        spheroid = Spheroid(((DefaultGeodeticDatum) crsProjected.getDatum()).getEllipsoid());
2484
                        elipName=spheroid[0];
2485
                        a=Double.parseDouble(spheroid[1]);
2486
                        inv_f=Double.parseDouble(spheroid[2]);
2487
                        // Extracción del código de Datum
2488
                        String codDatum="0";
2489
                        String[] val=((DefaultProjectedCRS)crs).getDatum().getName().toString().split(":");
2490
                        if (val.length<2)
2491
                                strDatumName=val[0];
2492
                        else
2493
                                strDatumName=val[1];
2494
                for (Iterator iter =((DefaultProjectedCRS)crs).getDatum().getIdentifiers().iterator();iter.hasNext();) {
2495
                    Identifier element = (Identifier) iter.next();
2496
                    codDatum = element.getCode();          
2497
                }
2498
                int intCodDatum=Integer.parseInt(codDatum);
2499
                strProj4Datum=datumToProj4(strDatumName,intCodDatum);
2500
                double factor_to_meter=1.0;
2501
                Unit u = crs.getCoordinateSystem().getAxis(0).getUnit();
2502
                String[] un = u.toString().split("[*]");
2503
                if (un.length>1)
2504
                {
2505
                        try{
2506
                                factor_to_meter=Double.parseDouble(un[1].replaceAll("]", ""));
2507
                        }
2508
                        catch(java.lang.NumberFormatException t){}
2509
                }
2510
                else
2511
                {
2512
                        try{
2513
                                factor_to_meter=Double.parseDouble(un[0]);
2514
                        }
2515
                        catch(java.lang.NumberFormatException t){}
2516
                }
2517
                if(factor_to_meter!=1.0)
2518
                        strProj4ToMeter="+to_meter="+factor_to_meter+" ";
2519
                else
2520
                        strProj4ToMeter="+unit=m ";
2521

    
2522
                }
2523
                else if (crs instanceof DefaultGeographicCRS) {
2524
                        DefaultGeographicCRS crsGeographic = (DefaultGeographicCRS) crs;
2525
                        primeMeridian = Primem(((DefaultGeodeticDatum) crsGeographic.getDatum()).getPrimeMeridian());
2526
                        spheroid = Spheroid(((DefaultGeodeticDatum) crsGeographic.getDatum()).getEllipsoid());
2527
                        elipName=spheroid[0];
2528
                        a=Double.parseDouble(spheroid[1]);
2529
                        inv_f=Double.parseDouble(spheroid[2]);
2530
                        // Extracción del código de Datum
2531
                        String codDatum="0";
2532
                        String[] val=((DefaultGeographicCRS)crs).getDatum().getName().toString().split(":");
2533
                        if (val.length<2)
2534
                                strDatumName=val[0];
2535
                        else
2536
                                strDatumName=val[1];
2537
                for (Iterator iter =((DefaultGeographicCRS)crs).getDatum().getIdentifiers().iterator();iter.hasNext();) {
2538
                    Identifier element = (Identifier) iter.next();
2539
                    codDatum = element.getCode();          
2540
                }
2541
                int intCodDatum=Integer.parseInt(codDatum);
2542
                strProj4Datum=datumToProj4(strDatumName,intCodDatum);
2543
                }
2544
                
2545
                String primeMeridianName=primeMeridian[0];
2546
                double primeMeridianValue=Double.parseDouble(primeMeridian[1]); // -> hacer el cambio de unidades
2547
                String[] strPrimeMeridianProj4=primeMeridianToProj4(primeMeridianName,primeMeridianValue);
2548
                primeMeridianValue=Double.parseDouble(strPrimeMeridianProj4[1]);
2549
                primeMeridianName=strPrimeMeridianProj4[0];
2550
                String primeMeridianAcronym=strPrimeMeridianProj4[2]; // Puede ser cadena vacia->Analizar
2551

    
2552
                if(strProj.equals(""))
2553
                {
2554
                        //System.out.println("Projection Name = "+"Geodetic");
2555
                        strProj4+="longlat ";
2556
                }
2557
                else
2558
                {
2559
                        int indexProj=findProjection(strProjName);
2560
                        if(indexProj==-1)
2561
                        {
2562
                                System.out.println("La proyeccion "+strProjName+" no figura en la lista Proj4");
2563
                                throw(new CrsException(new Exception()));
2564
                        }
2565
                        String projectionName=(getProj4ProjectionName(indexProj)).trim();
2566
                        ArrayList parameterNames=getProj4ProjectionParameters(indexProj);
2567
                        ArrayList parameterAcronyms=getProj4ProjectionParameterAcronyms(indexProj);
2568
                        ArrayList parameterValues=getProj4ProjectionParameterDefaultValues(indexProj);
2569
                        ArrayList parameterMaxValues=getProj4ProjectionParameterMaxValues(indexProj);
2570
                        ArrayList parameterMinValues=getProj4ProjectionParameterMinValues(indexProj);
2571
                        for(int i=0;i<parameterNames.size();i++)
2572
                        {
2573
                                boolean existsParameter=false;
2574
                                String parameterValue="";
2575
                                for(int j=0;j<gtParameterNames.length;j++)
2576
                                {
2577
                                        String gtParameterName=gtParameterNames[j].trim();
2578
                                        //System.out.println( gtParameterName);
2579
                                        //int posGtParameter=findProjectionParameter(gtParameterName);
2580
                                        int posGtParameter=findProjectionParameters(gtParameterName,(String)parameterNames.get(i));
2581
                                        //int posParameter=findProjectionParameter((String)parameterNames.get(i));
2582
                                        //if(((String)parameterNames.get(i)).trim().equals(gtParameterNames[j].trim()))
2583
                                        if(posGtParameter!=-1)
2584
                                        {
2585
                                                gtParameterName=getProj4ProjectionParameterName(posGtParameter);
2586
                                                gtParameterNames[j]=gtParameterName;
2587
                                                existsParameter=true;
2588
                                                double maxValue=Double.parseDouble((String)parameterMaxValues.get(i));
2589
                                                double minValue=Double.parseDouble((String)parameterMinValues.get(i));
2590
                                                //parameterValue=Double.parseDouble(gtParameterValues[j]);
2591
                                                parameterValue=gtParameterValues[j]; // Ojo unidades -> analizar
2592
                                                double auxValue=Double.parseDouble(parameterValue);
2593
                                                if((auxValue<minValue)||(auxValue>maxValue))
2594
                                                {
2595
                                                        String strError="El parametro ";
2596
                                                        strError+=gtParameterName;
2597
                                                        strError+=" esta fuera de dominio";
2598
                                                        System.out.println(strError);
2599
                                                        throw new CrsException(new Exception());
2600
                                                }
2601
                                                else if (((String)parameterNames.get(i)).trim().equals("scale_factor") && (auxValue==minValue)) {
2602
                                                        String strError="El parametro ";
2603
                                                        strError+=gtParameterName;
2604
                                                        strError+=" esta fuera de dominio";
2605
                                                        System.out.println(strError);
2606
                                                        throw new CrsException(new Exception());
2607
                                                }
2608
                                                break;
2609
                                        }
2610
                                        /*else
2611
                                        {
2612
                                                String strError="El parametro recibido de GeoTools ";
2613
                                                strError+=gtParameterName;
2614
                                                strError+=" no esta contemplado en la proyeccion";
2615
                                                System.out.println(strError);
2616
                                                throw new CrsException(new Exception());
2617
                                        }*/
2618
                                }
2619
                                if(existsParameter)
2620
                                {
2621
                                        parameterValues.set(i,parameterValue);
2622
                                }                        
2623
                        }
2624
                        boolean isSomerc=false;
2625
                        boolean isOmerc=false;
2626
                        String[] projectionAcronym=(String[])projectionAcronymList.get(indexProj);
2627
                        if(projectionName.equals("Oblique_Mercator"))
2628
                        {
2629
                                isOmerc=true;
2630
                                boolean azimuthSwiss=false;
2631
                                boolean rectifiedGridAngleSwiss=false;
2632
                                for(int j=0;j<gtParameterNames.length;j++)
2633
                                {
2634
                                        String gtParameterName=gtParameterNames[j].trim();
2635
                                        if(gtParameterName.equalsIgnoreCase("azimuth"))
2636
                                        {
2637
                                                double dif=Double.parseDouble(gtParameterValues[j])-90.0;
2638
                                                if(Math.abs(dif)<0.0001)
2639
                                                        azimuthSwiss=true;
2640
                                        }
2641
                                        if(gtParameterName.equalsIgnoreCase("rectified_grid_angle"))
2642
                                        {
2643
                                                double dif=Double.parseDouble(gtParameterValues[j])-90.0;
2644
                                                if(Math.abs(dif)<0.0001)
2645
                                                                rectifiedGridAngleSwiss=true;
2646
                                        }
2647
                                        if(azimuthSwiss&&rectifiedGridAngleSwiss)
2648
                                        {
2649
                                                String[] prjAc={"somerc"};
2650
                                                projectionAcronym=prjAc;
2651
                                                isSomerc=true;
2652
                                                isOmerc=false;
2653
                                        }
2654
                                }
2655
                                
2656
                                // Necesito buscar un caso de ejemplo
2657
                        }
2658
                        strProj4=strProj4+projectionAcronym[0]+" ";
2659
                        String strExtraProj4="";
2660
                        // Control de casos especiales
2661
                        if(projectionAcronym.equals("merc")) // 1 - Mercator
2662
                        {
2663
                                if(projectionName.equalsIgnoreCase("Mercator_1SP")) // No deberia tener lat_ts
2664
                                {
2665
                                        for(int j=0;j<gtParameterNames.length;j++)
2666
                                        {
2667
                                                String gtParameterName=gtParameterNames[j].trim();
2668
                                                if(gtParameterName.equalsIgnoreCase("latitude_of_origin"))
2669
                                                {
2670
                                                        double gtParameterValue=Double.parseDouble(gtParameterValues[j]);
2671
                                                        if(gtParameterValue!=0.0)
2672
                                                        {
2673
                                                                String strError="La proyeccin con latitude_origin debera ser MERCATOR_2SP";
2674
                                                                System.out.println(strError);
2675
                                                                throw new CrsException(new Exception());
2676
                                                        }
2677
                                                        break;
2678
                                                }
2679
                                        }
2680
                                }
2681
                                if(projectionName.equalsIgnoreCase("Mercator_2SP")) // No deberia tener lat_ts
2682
                                {
2683
                                        for(int j=0;j<gtParameterNames.length;j++)
2684
                                        {
2685
                                                String gtParameterName=gtParameterNames[j].trim();
2686
                                                if(gtParameterName.equalsIgnoreCase("scale_factor"))
2687
                                                {
2688
                                                        double gtParameterValue=Double.parseDouble(gtParameterValues[j]);
2689
                                                        if(gtParameterValue!=0.0)
2690
                                                        {
2691
                                                                String strError="La proyeccin con scale_factor debera ser MERCATOR_1SP";
2692
                                                                System.out.println(strError);
2693
                                                                throw new CrsException(new Exception());
2694
                                                        }
2695
                                                        break;
2696
                                                }
2697
                                        }
2698
                                }
2699
                        }
2700
                        else if(projectionAcronym.equals("stere"))
2701
                        {
2702
                                if(projectionName.equalsIgnoreCase("Polar_Stereographic")) // lat_ts=lat_0={90 o -90)
2703
                                {
2704
                                        boolean isNorthPole=true;
2705
                                        for(int j=0;j<gtParameterNames.length;j++)
2706
                                        {
2707
                                                String gtParameterName=gtParameterNames[j].trim();
2708
                                                if(gtParameterName.equalsIgnoreCase("latitude_of_origin"))
2709
                                                {
2710
                                                        double gtParameterValue=Double.parseDouble(gtParameterValues[j]);
2711
                                                        if(gtParameterValue==90.0) isNorthPole=true;
2712
                                                        else if(gtParameterValue==-90.0)  isNorthPole=false;
2713
                                                        else
2714
                                                        {
2715
                                                                String strError="La proyeccin estereogrfica polar debe tener latitud origen 90 o -90";
2716
                                                                System.out.println(strError);
2717
                                                                throw new CrsException(new Exception());
2718
                                                        }
2719
                                                        break;
2720
                                                }
2721
                                        }
2722
                                        String strLatitudeOrigin="90.0";
2723
                                        if(!isNorthPole) strLatitudeOrigin="-90.0";
2724
                                        for(int k=0;k<parameterNames.size();k++)
2725
                                        {
2726
                                                String parameterName=(String)parameterNames.get(k);
2727
                                                if(parameterName.equalsIgnoreCase("latitude_of_origin"))
2728
                                                {
2729
                                                        parameterValues.set(k,strLatitudeOrigin);
2730
                                                }
2731
                                        }
2732
                                }
2733
                        }
2734
                        else if(projectionAcronym.equals("mill"))
2735
                        {
2736
                                strExtraProj4="+R_A ";
2737
                        }
2738
                        else if(projectionAcronym.equals("vandg"))
2739
                        {
2740
                                strExtraProj4="+R_A ";
2741
                        }
2742
                        
2743
                        
2744
                        for(int i=0;i<parameterNames.size();i++)
2745
                        {
2746
                                boolean control=true;
2747
                                String parameterName=((String)parameterNames.get(i)).trim();
2748
                                String parameterAcronym=((String)parameterAcronyms.get(i)).trim();
2749
                                String strParameterValue=((String)parameterValues.get(i)).trim();
2750
                                if(isSomerc)
2751
                                {
2752
                                        if(parameterName.equals("rectified_grid_angle"))
2753
                                                control=false;
2754
                                        if(parameterName.equals("azimuth"))
2755
                                                control=false;
2756
                                }
2757
                                if(isOmerc)
2758
                                {
2759
                                        if(parameterName.equals("rectified_grid_angle"))
2760
                                                control=false;
2761
                                }
2762
                                if(parameterAcronym.equals("lon_0")
2763
                                                ||parameterAcronym.equals("lonc"))
2764
                                {
2765
                                        double parameterValue=Double.parseDouble(strParameterValue);
2766
                                        parameterValue=parameterValue-primeMeridianValue;
2767
                                        strParameterValue=Double.toString(parameterValue);
2768
                                }
2769
                                if(control)
2770
                                        strProj4=strProj4+"+"+parameterAcronym+"="+strParameterValue+" ";
2771
                        }
2772
                        strProj4+=strExtraProj4;
2773
                        //getProj4ProjectionName();
2774
                }
2775
                
2776
                // Que pasa si no hay elipsoide? -> OGR por defecto pone WGS84
2777
                String strEllipseAcronym=ellipseToProj4(a,inv_f);
2778
                String strEllipse="";
2779
                if(strEllipseAcronym.equals(""))
2780
                {
2781
                        if (!Double.isInfinite(inv_f))
2782
                                strEllipse="+a="+a+" +rf="+inv_f+" ";
2783
                        else
2784
                                strEllipse="+R="+a+" ";
2785
                }
2786
                else
2787
                {
2788
                        strEllipse="+ellps="+strEllipseAcronym+" ";
2789
                }
2790
                strProj4+=strEllipse;
2791
                //System.out.println("Elipsoide["+elipName+"]=("+a+","+inv_f+")");
2792
                strProj4+=primeMeridianAcronym;
2793
                if(!strProj4Datum.equals(""))
2794
                        strProj4+=strProj4Datum;
2795
                if(!strProj4ToMeter.equals(""))
2796
                        strProj4+=strProj4ToMeter;
2797
                String strWkt=crs.toWKT();
2798
                
2799
                //System.out.println("- Cadena proj4: "+strProj4);
2800
                return strProj4;                
2801
        }
2802

    
2803
        private String[] primeMeridianToProj4(String pmName,double pmValue) throws CrsException
2804
        {
2805
            String[] primeMeridian=new String[3];
2806
                String pszPM="";
2807
                String acronym="";
2808
            double dfFromGreenwich = 0.0;
2809
            double tolerance=0.002/3600.0;
2810
            int    nPMCode = -1;
2811

    
2812
            dfFromGreenwich=-(9+7/60.0+54.862/3600.0);
2813
        if(pmName.equalsIgnoreCase("lisbon")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
2814
        {
2815
            pszPM="lisbon";
2816
            nPMCode = 8902;
2817
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
2818
            {
2819
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
2820
                                System.out.println(strError);
2821
                                //throw new CrsException(new Exception());
2822
            }
2823
            pmValue=dfFromGreenwich;
2824
            acronym="+pm="+pszPM+" ";
2825
        }
2826
        
2827
        dfFromGreenwich=(2+20/60.0+14.025/3600.0); 
2828
        if(pmName.equalsIgnoreCase("paris")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
2829
        {
2830
            pszPM="paris";
2831
            nPMCode = 8903;
2832
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
2833
            {
2834
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
2835
                                System.out.println(strError);
2836
                                //throw new CrsException(new Exception());
2837
            }
2838
            pmValue=dfFromGreenwich;
2839
            acronym="+pm="+pszPM+" ";
2840
        }
2841
        
2842
        dfFromGreenwich=-(74+4/60.0+51.3/3600.0);
2843
        if(pmName.equalsIgnoreCase("bogota")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
2844
        {
2845
            pszPM="bogota";
2846
            nPMCode = 8904;
2847
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
2848
            {
2849
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
2850
                                System.out.println(strError);
2851
                                //throw new CrsException(new Exception());
2852
            }
2853
            pmValue=dfFromGreenwich;
2854
            acronym="+pm="+pszPM+" ";
2855
        }
2856
        
2857
        dfFromGreenwich=-(3+41/60.0+16.58/3600.0);  // mal en ogr los segundos pone 16.48
2858
        if(pmName.equalsIgnoreCase("madrid")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
2859
        {
2860
            pszPM="madrid";
2861
            nPMCode = 8905;
2862
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
2863
            {
2864
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
2865
                                System.out.println(strError);
2866
                                //throw new CrsException(new Exception());
2867
            }
2868
            pmValue=dfFromGreenwich;
2869
            acronym="+pm="+pszPM+" ";
2870
        }
2871
        
2872
        dfFromGreenwich=(12+27/60.0+8.4/3600.0);
2873
        if(pmName.equalsIgnoreCase("rome")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
2874
        {
2875
            pszPM="rome";
2876
            nPMCode = 8906;
2877
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
2878
            {
2879
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
2880
                                System.out.println(strError);
2881
                                //throw new CrsException(new Exception());
2882
            }
2883
            pmValue=dfFromGreenwich;
2884
            acronym="+pm="+pszPM+" ";
2885
        }
2886
        
2887
        dfFromGreenwich=(7+26/60.0+22.5/3600.0);
2888
        if(pmName.equalsIgnoreCase("bern")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
2889
        {
2890
            pszPM="bern";
2891
            nPMCode = 8907;
2892
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
2893
            {
2894
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
2895
                                System.out.println(strError);
2896
                                //throw new CrsException(new Exception());
2897
            }
2898
            pmValue=dfFromGreenwich;
2899
            acronym="+pm="+pszPM+" ";
2900
        }
2901
        
2902
        dfFromGreenwich=(106+48/60.0+27.79/3600.0);
2903
        if(pmName.equalsIgnoreCase("jakarta")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
2904
        {
2905
            pszPM="jakarta";
2906
            nPMCode = 8908;
2907
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
2908
            {
2909
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
2910
                                System.out.println(strError);
2911
                                //throw new CrsException(new Exception());
2912
            }
2913
            pmValue=dfFromGreenwich;
2914
            acronym="+pm="+pszPM+" ";
2915
        }
2916
        
2917
        dfFromGreenwich=-(17+40/60.0+0.0/3600.0);
2918
        if(pmName.equalsIgnoreCase("ferro")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
2919
        {
2920
            pszPM="ferro";
2921
            nPMCode = 8909;
2922
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
2923
            {
2924
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
2925
                                System.out.println(strError);
2926
                                //throw new CrsException(new Exception());
2927
            }
2928
            pmValue=dfFromGreenwich;
2929
            acronym="+pm="+pszPM+" ";
2930
        }
2931
        
2932
        dfFromGreenwich=(4+22/60.0+4.71/3600.0);
2933
        if(pmName.equalsIgnoreCase("brussels")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
2934
        {
2935
            pszPM="brussels";
2936
            nPMCode = 8910;
2937
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
2938
            {
2939
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
2940
                                System.out.println(strError);
2941
                                //throw new CrsException(new Exception());
2942
            }
2943
            pmValue=dfFromGreenwich;
2944
            acronym="+pm="+pszPM+" ";
2945
        }
2946
        
2947
        dfFromGreenwich=(18+3/60.0+29.8/3600.0);
2948
        if(pmName.equalsIgnoreCase("stockholm")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
2949
        {
2950
            pszPM="stockholm";
2951
            nPMCode = 8911;
2952
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
2953
            {
2954
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
2955
                                System.out.println(strError);
2956
                                //throw new CrsException(new Exception());
2957
            }
2958
            pmValue=dfFromGreenwich;
2959
            acronym="+pm="+pszPM+" ";
2960
        }
2961
        
2962
        dfFromGreenwich=(23+42/60.0+58.815/3600.0);
2963
        if(pmName.equalsIgnoreCase("athens")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
2964
        {
2965
            pszPM="athens";
2966
            nPMCode = 8912;
2967
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
2968
            {
2969
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
2970
                                System.out.println(strError);
2971
                                //throw new CrsException(new Exception());
2972
            }
2973
            pmValue=dfFromGreenwich;
2974
            acronym="+pm="+pszPM+" ";
2975
        }
2976
        
2977
        dfFromGreenwich=(10+43/60.0+22.5/3600.0);
2978
        if(pmName.equalsIgnoreCase("oslo")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
2979
        {
2980
            pszPM="oslo";
2981
            nPMCode = 8913;
2982
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
2983
            {
2984
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
2985
                                System.out.println(strError);
2986
                                //throw new CrsException(new Exception());
2987
            }
2988
            pmValue=dfFromGreenwich;
2989
            acronym="+pm="+pszPM+" ";
2990
        }
2991
        
2992
        dfFromGreenwich=(0.0);
2993
        if(pmName.equalsIgnoreCase("Greenwich")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
2994
        {
2995
            pszPM="Greenwich";
2996
            nPMCode = 0;
2997
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
2998
            {
2999
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
3000
                                System.out.println(strError);
3001
                                //throw new CrsException(new Exception());
3002
            }
3003
            pmValue=dfFromGreenwich;
3004
        }
3005
        primeMeridian[0]=pszPM;
3006
        primeMeridian[1]=Double.toString(pmValue);
3007
        primeMeridian[2]=acronym;
3008
                return primeMeridian;
3009
        }
3010

    
3011
        private String ellipseToProj4(double dfSemiMajor, double dfInvFlattening)
3012
        {
3013
                double yo=Math.abs(4.5);
3014
                String pszPROJ4Ellipse="";
3015
            if( Math.abs(dfSemiMajor-6378249.145) < 0.01
3016
                && Math.abs(dfInvFlattening-293.465) < 0.0001 )
3017
            {
3018
                pszPROJ4Ellipse = "clrk80";     /* Clark 1880 */
3019
            }
3020
            else if( Math.abs(dfSemiMajor-6378245.0) < 0.01
3021
                     && Math.abs(dfInvFlattening-298.3) < 0.0001 )
3022
            {
3023
                pszPROJ4Ellipse = "krass";      /* Krassovsky */
3024
            }
3025
            else if( Math.abs(dfSemiMajor-6378388.0) < 0.01
3026
                     && Math.abs(dfInvFlattening-297.0) < 0.0001 )
3027
            {
3028
                pszPROJ4Ellipse = "intl";       /* International 1924 */
3029
            }
3030
            else if( Math.abs(dfSemiMajor-6378160.0) < 0.01
3031
                     && Math.abs(dfInvFlattening-298.25) < 0.0001 )
3032
            {
3033
                pszPROJ4Ellipse = "aust_SA";    /* Australian */
3034
            }
3035
            else if( Math.abs(dfSemiMajor-6377397.155) < 0.01
3036
                     && Math.abs(dfInvFlattening-299.1528128) < 0.0001 )
3037
            {
3038
                pszPROJ4Ellipse = "bessel";     /* Bessel 1841 */
3039
            }
3040
            else if( Math.abs(dfSemiMajor-6377483.865) < 0.01
3041
                     && Math.abs(dfInvFlattening-299.1528128) < 0.0001 )
3042
            {
3043
                pszPROJ4Ellipse = "bess_nam";   /* Bessel 1841 (Namibia / Schwarzeck)*/
3044
            }
3045
            else if( Math.abs(dfSemiMajor-6378160.0) < 0.01
3046
                     && Math.abs(dfInvFlattening-298.247167427) < 0.0001 )
3047
            {
3048
                pszPROJ4Ellipse = "GRS67";      /* GRS 1967 */
3049
            }
3050
            else if( Math.abs(dfSemiMajor-6378137) < 0.01
3051
                     && Math.abs(dfInvFlattening-298.257222101) < 0.000001 )
3052
            {
3053
                pszPROJ4Ellipse = "GRS80";      /* GRS 1980 */
3054
            }
3055
            else if( Math.abs(dfSemiMajor-6378206.4) < 0.01
3056
                     && Math.abs(dfInvFlattening-294.9786982) < 0.0001 )
3057
            {
3058
                pszPROJ4Ellipse = "clrk66";     /* Clarke 1866 */
3059
            }
3060
            else if( Math.abs(dfSemiMajor-6378206.4) < 0.01
3061
                     && Math.abs(dfInvFlattening-294.9786982) < 0.0001 )
3062
            {
3063
                pszPROJ4Ellipse = "mod_airy";   /* Modified Airy */
3064
            }
3065
            else if( Math.abs(dfSemiMajor-6377563.396) < 0.01
3066
                     && Math.abs(dfInvFlattening-299.3249646) < 0.0001 )
3067
            {
3068
                pszPROJ4Ellipse = "airy";       /* Modified Airy */
3069
            }
3070
            else if( Math.abs(dfSemiMajor-6378200) < 0.01
3071
                     && Math.abs(dfInvFlattening-298.3) < 0.0001 )
3072
            {
3073
                pszPROJ4Ellipse = "helmert";    /* Helmert 1906 */
3074
            }
3075
            else if( Math.abs(dfSemiMajor-6378155) < 0.01
3076
                     && Math.abs(dfInvFlattening-298.3) < 0.0001 )
3077
            {
3078
                pszPROJ4Ellipse = "fschr60m";   /* Modified Fischer 1960 */
3079
            }
3080
            else if( Math.abs(dfSemiMajor-6377298.556) < 0.01
3081
                     && Math.abs(dfInvFlattening-300.8017) < 0.0001 )
3082
            {
3083
                pszPROJ4Ellipse = "evrstSS";    /* Everest (Sabah & Sarawak) */
3084
            }
3085
            else if( Math.abs(dfSemiMajor-6378165.0) < 0.01
3086
                     && Math.abs(dfInvFlattening-298.3) < 0.0001 )
3087
            {
3088
                pszPROJ4Ellipse = "WGS60";      
3089
            }
3090
            else if( Math.abs(dfSemiMajor-6378145.0) < 0.01
3091
                     && Math.abs(dfInvFlattening-298.25) < 0.0001 )
3092
            {
3093
                pszPROJ4Ellipse = "WGS66";      
3094
            }
3095
            else if( Math.abs(dfSemiMajor-6378135.0) < 0.01
3096
                     && Math.abs(dfInvFlattening-298.26) < 0.0001 )
3097
            {
3098
                pszPROJ4Ellipse = "WGS72";      
3099
            }
3100
            else if( Math.abs(dfSemiMajor-6378137.0) < 0.01
3101
                     && Math.abs(dfInvFlattening-298.257223563) < 0.000001 )
3102
            {
3103
                pszPROJ4Ellipse = "WGS84";
3104
            }
3105
            /*
3106
            else if( EQUAL(pszDatum,"North_American_Datum_1927") )
3107
            {
3108
//                pszPROJ4Ellipse = "clrk66:+datum=nad27"; // NAD 27 
3109
                pszPROJ4Ellipse = "clrk66";
3110
            }
3111
            else if( EQUAL(pszDatum,"North_American_Datum_1983") )
3112
            {
3113
//                pszPROJ4Ellipse = "GRS80:+datum=nad83";       // NAD 83 
3114
                pszPROJ4Ellipse = "GRS80";
3115
            }
3116
            */
3117
            return pszPROJ4Ellipse;
3118
        }
3119

    
3120
        private String datumToProj4(String datumName,int epsgCode)
3121
        {
3122
            String datumProj4="";
3123
            String SRS_DN_NAD27="North_American_Datum_1927";
3124
            String SRS_DN_NAD83="North_American_Datum_1983";
3125
            String SRS_DN_WGS72="WGS_1972";
3126
            String SRS_DN_WGS84="WGS_1984";
3127
            if(datumName.equals(""))
3128
                    datumProj4="";
3129
                else if(datumName.equalsIgnoreCase(SRS_DN_NAD27) || epsgCode == 6267 )
3130
                        datumProj4 = "+datum=NAD27 ";
3131

    
3132
            else if(datumName.equalsIgnoreCase(SRS_DN_NAD83) || epsgCode == 6269 )
3133
                    datumProj4 = "+datum=NAD83 ";
3134

    
3135
            else if(datumName.equalsIgnoreCase(SRS_DN_WGS84) || epsgCode == 6326 )
3136
                    datumProj4 = "+datum=WGS84 ";
3137

    
3138
            else if( epsgCode == 6314 )
3139
                    datumProj4 = "+datum=potsdam ";
3140

    
3141
            else if( epsgCode == 6272 )
3142
                    datumProj4 = "+datum=nzgd49 ";
3143
                return datumProj4;
3144
        }
3145
        // Casos especiales
3146
        // - MERCATOR_1SP
3147
        // - HOTINE
3148
        // - MILLER
3149
        // - Polar_Stereographic
3150
        // - Polar_Stereographic
3151
        // - VanDerGrinten
3152
        // - Transverse Mercator
3153
        // - Cuando el meridiano origen no es 0 se pone pm=madrid y lon_0=
3154
        // +datum
3155
        
3156
        // Funciones privadas necesarias para el proceso
3157
        
3158
        private String getName(Identifier name) {
3159
                String[] correctName = name.toString().split(":");
3160
                if (correctName.length<2) 
3161
                        return correctName[0];
3162
                
3163
                else
3164
                        return correctName[1];
3165
        }
3166
        
3167
        private String[] Spheroid (Ellipsoid ellips) {
3168
                String[] spheroid = new String[3];
3169
                Unit u = ellips.getAxisUnit();
3170
                double semi_major = convert( ellips.getSemiMajorAxis(), u.toString());
3171
                double inv_f = convert( ellips.getInverseFlattening(), u.toString());
3172
                String[] val =        ellips.getName().toString().split(":");
3173
                if (val.length<2)
3174
                        spheroid[0] = ellips.getName().toString().split(":")[0];
3175
                else
3176
                        spheroid[0] = ellips.getName().toString().split(":")[1];
3177
                spheroid[1] = String.valueOf(semi_major);
3178
                spheroid[2] = String.valueOf(inv_f);
3179
                return spheroid;
3180
        }
3181
        
3182
        private String[] Primem (PrimeMeridian prim) {
3183
                String[] primem = new String[2];
3184
                DefaultPrimeMeridian pm = (DefaultPrimeMeridian) prim;
3185
                Unit u = pm.getAngularUnit();
3186
                double value = convert( pm.getGreenwichLongitude(), u.toString());
3187
                String[] val = pm.getName().toString().split(":");
3188
                if (val.length<2)
3189
                        primem[0] = pm.getName().toString().split(":")[0];
3190
                else
3191
                        primem[0] = pm.getName().toString().split(":")[1];
3192
                primem[1] = String.valueOf(value);
3193
                return primem;
3194
        }
3195
        
3196
        public double convert(double value, String measure) throws ConversionException {
3197
                if (measure.equals("D.MS")) {                
3198
                        value *= this.divider;
3199
                int deg,min;
3200
                deg = (int) (value/10000); value -= 10000*deg;
3201
                min = (int) (value/  100); value -=   100*min;
3202
                if (min<=-60 || min>=60) {  // Accepts NaN
3203
                    if (Math.abs(Math.abs(min) - 100) <= EPS) {
3204
                        if (min >= 0) deg++; else deg--;
3205
                        min = 0;
3206
                    } else {
3207
                        throw new ConversionException("Invalid minutes: "+min);
3208
                    }
3209
                }
3210
                if (value<=-60 || value>=60) { // Accepts NaN
3211
                    if (Math.abs(Math.abs(value) - 100) <= EPS) {
3212
                        if (value >= 0) min++; else min--;
3213
                        value = 0;
3214
                    } else {
3215
                        throw new ConversionException("Invalid secondes: "+value);
3216
                    }
3217
                }
3218
                value = ((value/60) + min)/60 + deg;
3219
                return value;
3220
                }
3221
                if (measure.equals("grad") || measure.equals("grade")) 
3222
                        return ((value * 180.0) / 200.0);                        
3223
                if (measure.equals(""+(char)176)) 
3224
                        return value;                
3225
                if (measure.equals("DMS") ) 
3226
                        return value;                
3227
                if (measure.equals("m") || measure.startsWith("[m")) 
3228
                        return value;        
3229
                if (measure.equals("")) 
3230
                        return value;
3231
                
3232
                throw new ConversionException("Conversion no contemplada: "+measure);
3233
    }
3234
        
3235
        public ArrayList getProjectionNameList(){
3236
                return projectionNameList;
3237
        }
3238
}