Statistics
| Revision:

svn-gvsig-desktop / branches / F2 / libraries / libJCRS / src / org / gvsig / crs / Proj4.java @ 12609

History | View | Annotate | Download (129 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
        private static double angularTolerance=1.0/3600.0;
33
        
34
        /**
35
     * Small tolerance factor for rounding errors.
36
     */
37
    private static final double EPS = 1E-8;
38
        
39
        public Proj4() throws CrsException
40
        {
41
                //defineProjectionNames();
42
                //defineProjectionParameterNameList();
43
                //defineProjectionParameterUnitList();
44
                defineUnitNameList();
45
                defineProjectionParameterList();
46
                defineProjections();
47
        }
48
        
49
        private void defineUnitNameList() throws CrsException
50
        {
51
                int count=0;
52
                
53
                {
54
                        String[] unitName={"Angular"};
55
                        unitNameList.add(count,unitName);
56
                }
57
                
58
                count++;
59
                {
60
                        String[] unitName={"Linear"};
61
                        unitNameList.add(count,unitName);
62
                }
63
                
64
                count++;
65
                {
66
                        String[] unitName={"Unitless"};
67
                        unitNameList.add(count,unitName);
68
                        addUnitName(count,"Adimensional");
69
                }
70
                
71
        }
72
        
73
        private void defineProjectionParameterList() throws CrsException
74
        {
75
                int count=0;
76

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

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

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

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

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

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

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

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

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

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

    
186
                count++;
187
                { // latitude_of_origin
188
                        String[] parameterName={"latitude_of_standard_parallel"};
189
                        projectionParameterNameList.add(count,parameterName);
190
                        addProjectionParameterName(count,"CenterLat");                
191
                        addProjectionParameterName(count,"FalseOriginLat");
192
                        addProjectionParameterName(count,"Latitude of center");                
193
                        addProjectionParameterName(count,"Latitude of false origin");                
194
                        addProjectionParameterName(count,"Latitude of natural origin");
195
                        addProjectionParameterName(count,"Latitude of projection center");
196
                        addProjectionParameterName(count,"Latitude of projection centre");
197
                        addProjectionParameterName(count,"Latitude_of_standard_parallel");                
198
                        addProjectionParameterName(count,"NatOriginLat");                
199
                        addProjectionParameterName(count,"ProjCenterLat");
200
                        
201
                        String[] parameterUnit={"Angular"};
202
                        projectionParameterUnitList.add(count,parameterUnit);
203
                }
204

    
205
                count++;
206
                { // longitude_of_center
207
                        String[] parameterName={"longitude_of_center"};
208
                        projectionParameterNameList.add(count,parameterName);
209
                        addProjectionParameterName(count,"Longitude of origin");                
210
                        addProjectionParameterName(count,"Longitude of false origin");                
211
                        addProjectionParameterName(count,"NatOriginLong");                
212
                        addProjectionParameterName(count,"central_meridian");                
213
                        addProjectionParameterName(count,"CenterLong");                
214

    
215
                        String[] parameterUnit={"Angular"};
216
                        projectionParameterUnitList.add(count,parameterUnit);
217
                }
218

    
219
                count++;
220
                { // Longitude_Of_1st_Point
221
                        String[] parameterName={"Longitude_Of_1st_Point"};
222
                        projectionParameterNameList.add(count,parameterName);
223
                        //addProjectionParameterName(count,"CenterLat");                
224
                        
225
                        String[] parameterUnit={"Angular"};
226
                        projectionParameterUnitList.add(count,parameterUnit);
227
                }
228

    
229
                count++;
230
                { // Longitude_Of_2nd_Point
231
                        String[] parameterName={"Longitude_Of_2nd_Point"};
232
                        projectionParameterNameList.add(count,parameterName);
233
                        //addProjectionParameterName(count,"CenterLat");                
234
                        
235
                        String[] parameterUnit={"Angular"};
236
                        projectionParameterUnitList.add(count,parameterUnit);
237
                }
238

    
239
                count++;
240
                { // pseudo_standard_parallel_1
241
                        String[] parameterName={"pseudo_standard_parallel_1"};
242
                        projectionParameterNameList.add(count,parameterName);
243
                        addProjectionParameterName(count,"Latitude of Pseudo Standard Parallel");                
244

    
245
                        String[] parameterUnit={"Angular"};
246
                        projectionParameterUnitList.add(count,parameterUnit);
247
                }
248
                
249
                count++;
250
                { // satellite_height
251
                        String[] parameterName={"rectified_grid_angle"};
252
                        projectionParameterNameList.add(count,parameterName);
253
                        addProjectionParameterName(count,"Angle from Rectified to Skew Grid");                
254
                        addProjectionParameterName(count,"XY_Plane_Rotation");                
255
                        addProjectionParameterName(count,"RectifiedGridAngle");                
256

    
257
                        String[] parameterUnit={"Linear"};
258
                        projectionParameterUnitList.add(count,parameterUnit);
259
                }
260
                
261
                count++;
262
                { // satellite_height
263
                        String[] parameterName={"satellite_height"};
264
                        projectionParameterNameList.add(count,parameterName);
265
                        addProjectionParameterName(count,"Satellite Height");                
266

    
267
                        String[] parameterUnit={"Linear"};
268
                        projectionParameterUnitList.add(count,parameterUnit);
269
                }
270
                
271
                count++;
272
                { // scale_factor
273
                        String[] parameterName={"scale_factor"};
274
                        projectionParameterNameList.add(count,parameterName);
275
                        addProjectionParameterName(count,"Scale factor at natural origin");                
276
                        addProjectionParameterName(count,"ScaleAtNatOrigin");                
277
                        addProjectionParameterName(count,"ScaleAtCenter");                
278

    
279
                        String[] parameterUnit={"Unitless"};
280
                        projectionParameterUnitList.add(count,parameterUnit);
281
                }
282

    
283
                count++;
284
                { // standard_parallel_1
285
                        String[] parameterName={"standard_parallel_1"};
286
                        projectionParameterNameList.add(count,parameterName);
287
                        addProjectionParameterName(count,"Latitude of first standard parallel");                
288
                        addProjectionParameterName(count,"Latitude of origin");                
289
                        addProjectionParameterName(count,"StdParallel1");                
290

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

    
295
                count++;
296
                { // standard_parallel_2
297
                        String[] parameterName={"standard_parallel_2"};
298
                        projectionParameterNameList.add(count,parameterName);
299
                        addProjectionParameterName(count,"Latitude of second standard parallel");                
300
                        addProjectionParameterName(count,"StdParallel2");                
301

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

    
306
                count++;
307
                { // semi_major
308
                        String[] parameterName={"semi_major"};
309
                        projectionParameterNameList.add(count,parameterName);
310
                        addProjectionParameterName(count,"semi_major_axis");                
311

    
312
                        String[] parameterUnit={"Linear"};
313
                        projectionParameterUnitList.add(count,parameterUnit);
314
                }
315

    
316
                count++;
317
                { // semi_minor
318
                        String[] parameterName={"semi_minor"};
319
                        projectionParameterNameList.add(count,parameterName);
320
                        addProjectionParameterName(count,"semi_minor_axis");                
321

    
322
                        String[] parameterUnit={"Linear"};
323
                        projectionParameterUnitList.add(count,parameterUnit);
324
                }
325

    
326
        }
327
        
328
        private void defineProjections() throws CrsException
329
        {
330
                int count=0;
331
                
332
                {// Albers Equal-Area Conic
333
                        String[] projectionName={"Albers_Conic_Equal_Area"};
334
                        projectionNameList.add(count,projectionName);
335
                        addProjectionName(count,"Albers Equal-Area Conic");
336
                        addProjectionName(count,"Albers Equal Area");
337
                        addProjectionName(count,"9822");
338
                        
339
                        String[] parameterName={"standard_parallel_1"};
340
                        projectionParameterList.add(count,parameterName);
341
                        addProjectionParameter(count,"standard_parallel_2");
342
                        addProjectionParameter(count,"latitude_of_center");
343
                        addProjectionParameter(count,"longitude_of_center");
344
                        addProjectionParameter(count,"false_easting");
345
                        addProjectionParameter(count,"false_northing");
346

    
347
                        String[] parameterAcronym={"lat_1"};
348
                        projectionParameterAcronymList.add(count,parameterAcronym);
349
                        addProjectionParameterAcronymList(count,"lat_2");
350
                        addProjectionParameterAcronymList(count,"lat_0");
351
                        addProjectionParameterAcronymList(count,"lon_0");
352
                        addProjectionParameterAcronymList(count,"x_0");
353
                        addProjectionParameterAcronymList(count,"y_0");
354

    
355
                        String[] parameterDefaultValue={"0.0"};
356
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
357
                        addProjectionParameterDefaultValue(count,"0.0");
358
                        addProjectionParameterDefaultValue(count,"0.0");
359
                        addProjectionParameterDefaultValue(count,"0.0");
360
                        addProjectionParameterDefaultValue(count,"0.0");
361
                        addProjectionParameterDefaultValue(count,"0.0");
362

    
363
                        String[] parameterMaxValue={"90.0"};
364
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
365
                        addProjectionParameterMaxValue(count,"90.0");
366
                        addProjectionParameterMaxValue(count,"90.0");
367
                        addProjectionParameterMaxValue(count,"360.0");
368
                        addProjectionParameterMaxValue(count,"100000000.0");
369
                        addProjectionParameterMaxValue(count,"100000000.0");
370

    
371
                        String[] parameterMinValue={"-90.0"};
372
                        projectionParameterMinValueList.add(count,parameterMinValue);
373
                        addProjectionParameterMinValue(count,"-90.0");
374
                        addProjectionParameterMinValue(count,"-90.0");
375
                        addProjectionParameterMinValue(count,"-360.0");
376
                        addProjectionParameterMinValue(count,"-100000000.0");
377
                        addProjectionParameterMinValue(count,"-100000000.0");
378

    
379
                        String[] projectionAcronym={"aea"};
380
                        projectionAcronymList.add(count,projectionAcronym);
381
                }
382
                
383
                count++;
384
                {// Azimuthal_Equidistantt
385
                        String[] projectionName={"Azimuthal_Equidistant"};
386
                        projectionNameList.add(count,projectionName);
387
                        addProjectionName(count,"Azimuthal Equidistant");
388
                        
389
                        String[] parameterName={"latitude_of_center"};
390
                        projectionParameterList.add(count,parameterName);
391
                        addProjectionParameter(count,"longitude_of_center");
392
                        addProjectionParameter(count,"false_easting");
393
                        addProjectionParameter(count,"false_northing");
394

    
395
                        String[] parameterAcronym={"lat_0"};
396
                        projectionParameterAcronymList.add(count,parameterAcronym);
397
                        addProjectionParameterAcronymList(count,"lon_0");
398
                        addProjectionParameterAcronymList(count,"x_0");
399
                        addProjectionParameterAcronymList(count,"y_0");
400

    
401
                        String[] parameterDefaultValue={"0.0"};
402
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
403
                        addProjectionParameterDefaultValue(count,"0.0");
404
                        addProjectionParameterDefaultValue(count,"0.0");
405
                        addProjectionParameterDefaultValue(count,"0.0");
406

    
407
                        String[] parameterMaxValue={"90.0"};
408
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
409
                        addProjectionParameterMaxValue(count,"360.0");
410
                        addProjectionParameterMaxValue(count,"100000000.0");
411
                        addProjectionParameterMaxValue(count,"100000000.0");
412

    
413
                        String[] parameterMinValue={"-90.0"};
414
                        projectionParameterMinValueList.add(count,parameterMinValue);
415
                        addProjectionParameterMinValue(count,"-360.0");
416
                        addProjectionParameterMinValue(count,"-100000000.0");
417
                        addProjectionParameterMinValue(count,"-100000000.0");
418

    
419
                        String[] projectionAcronym={"aeqd"};
420
                        projectionAcronymList.add(count,projectionAcronym);
421
                }
422

    
423
                count++;
424
                {// Bonne
425
                        String[] projectionName={"Bonne"};
426
                        projectionNameList.add(count,projectionName);
427
                        addProjectionName(count,"Bonne");
428

    
429
                        String[] parameterName={"central_meridian"};
430
                        projectionParameterList.add(count,parameterName);
431
                        addProjectionParameter(count,"standard_parallel_1");
432
                        addProjectionParameter(count,"false_easting");
433
                        addProjectionParameter(count,"false_northing");
434

    
435
                        String[] parameterAcronym={"lon_0"};
436
                        projectionParameterAcronymList.add(count,parameterAcronym);
437
                        addProjectionParameterAcronymList(count,"lat_1");
438
                        addProjectionParameterAcronymList(count,"x_0");
439
                        addProjectionParameterAcronymList(count,"y_0");
440

    
441
                        String[] parameterDefaultValue={"0.0"};
442
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
443
                        addProjectionParameterDefaultValue(count,"0.0");
444
                        addProjectionParameterDefaultValue(count,"0.0");
445
                        addProjectionParameterDefaultValue(count,"0.0");
446

    
447
                        String[] parameterMaxValue={"360.0"};
448
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
449
                        addProjectionParameterMaxValue(count,"90.0");
450
                        addProjectionParameterMaxValue(count,"100000000.0");
451
                        addProjectionParameterMaxValue(count,"100000000.0");
452

    
453
                        String[] parameterMinValue={"-360.0"};
454
                        projectionParameterMinValueList.add(count,parameterMinValue);
455
                        addProjectionParameterMinValue(count,"-90.0");
456
                        addProjectionParameterMinValue(count,"-100000000.0");
457
                        addProjectionParameterMinValue(count,"-100000000.0");
458

    
459
                        String[] projectionAcronym={"bonne"};
460
                        projectionAcronymList.add(count,projectionAcronym);
461
                }
462

    
463
                count++;
464
                {// Cassini_Soldner
465
                        String[] projectionName={"Cassini_Soldner"};
466
                        projectionNameList.add(count,projectionName);
467
                        addProjectionName(count,"Cassini-Soldner");
468
                        addProjectionName(count,"9806");
469

    
470
                        String[] parameterName={"latitude_of_origin"};
471
                        projectionParameterList.add(count,parameterName);
472
                        addProjectionParameter(count,"central_meridian");
473
                        addProjectionParameter(count,"false_easting");
474
                        addProjectionParameter(count,"false_northing");
475

    
476
                        String[] parameterAcronym={"lat_0"};
477
                        projectionParameterAcronymList.add(count,parameterAcronym);
478
                        addProjectionParameterAcronymList(count,"lon_0");
479
                        addProjectionParameterAcronymList(count,"x_0");
480
                        addProjectionParameterAcronymList(count,"y_0");
481

    
482
                        String[] parameterDefaultValue={"0.0"};
483
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
484
                        addProjectionParameterDefaultValue(count,"0.0");
485
                        addProjectionParameterDefaultValue(count,"0.0");
486
                        addProjectionParameterDefaultValue(count,"0.0");
487

    
488
                        String[] parameterMaxValue={"90.0"};
489
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
490
                        addProjectionParameterMaxValue(count,"360.0");
491
                        addProjectionParameterMaxValue(count,"100000000.0");
492
                        addProjectionParameterMaxValue(count,"100000000.0");
493

    
494
                        String[] parameterMinValue={"-90.0"};
495
                        projectionParameterMinValueList.add(count,parameterMinValue);
496
                        addProjectionParameterMinValue(count,"-360.0");
497
                        addProjectionParameterMinValue(count,"-100000000.0");
498
                        addProjectionParameterMinValue(count,"-100000000.0");
499

    
500
                        String[] projectionAcronym={"cass"};
501
                        projectionAcronymList.add(count,projectionAcronym);
502
                }
503

    
504
                count++;
505
                {// Cylindrical_Equal_Area
506
                        String[] projectionName={"Cylindrical_Equal_Area"};
507
                        projectionNameList.add(count,projectionName);
508
                        addProjectionName(count,"Cylindrical Equal Area");
509
                        addProjectionName(count,"Normal Authalic Cylindrical (FME)");
510
                        addProjectionName(count,"Lambert Cylindrical Equal Area");
511
                        addProjectionName(count,"Behrmann (standard parallel = 30)");
512
                        addProjectionName(count,"Gall Orthographic (standard parallel = 45)");
513
                        addProjectionName(count,"Peters (approximated by Gall Orthographic)");
514
                        addProjectionName(count,"Lambert Cylindrical Equal Area (Spherical)");
515

    
516
                        String[] parameterName={"central_meridian"};
517
                        projectionParameterList.add(count,parameterName);
518
                        addProjectionParameter(count,"standard_parallel_1");
519
                        addProjectionParameter(count,"false_easting");
520
                        addProjectionParameter(count,"false_northing");
521

    
522
                        String[] parameterAcronym={"lon_0"};
523
                        projectionParameterAcronymList.add(count,parameterAcronym);
524
                        addProjectionParameterAcronymList(count,"lat_ts");
525
                        addProjectionParameterAcronymList(count,"x_0");
526
                        addProjectionParameterAcronymList(count,"y_0");
527

    
528
                        String[] parameterDefaultValue={"0.0"};
529
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
530
                        addProjectionParameterDefaultValue(count,"0.0");
531
                        addProjectionParameterDefaultValue(count,"0.0");
532
                        addProjectionParameterDefaultValue(count,"0.0");
533

    
534
                        String[] parameterMaxValue={"360.0"};
535
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
536
                        addProjectionParameterMaxValue(count,"90.0");
537
                        addProjectionParameterMaxValue(count,"100000000.0");
538
                        addProjectionParameterMaxValue(count,"100000000.0");
539

    
540
                        String[] parameterMinValue={"-360.0"};
541
                        projectionParameterMinValueList.add(count,parameterMinValue);
542
                        addProjectionParameterMinValue(count,"-90.0");
543
                        addProjectionParameterMinValue(count,"-100000000.0");
544
                        addProjectionParameterMinValue(count,"-100000000.0");
545

    
546
                        String[] projectionAcronym={"cea"};
547
                        projectionAcronymList.add(count,projectionAcronym);
548
                }
549

    
550
                count++;
551
                {// Eckert_IV
552
                        String[] projectionName={"Eckert_IV"};
553
                        projectionNameList.add(count,projectionName);
554
                        addProjectionName(count,"Eckert IV");
555

    
556
                        String[] parameterName={"central_meridian"};
557
                        projectionParameterList.add(count,parameterName);
558
                        addProjectionParameter(count,"false_easting");
559
                        addProjectionParameter(count,"false_northing");
560

    
561
                        String[] parameterAcronym={"lon_0"};
562
                        projectionParameterAcronymList.add(count,parameterAcronym);
563
                        addProjectionParameterAcronymList(count,"x_0");
564
                        addProjectionParameterAcronymList(count,"y_0");
565

    
566
                        String[] parameterDefaultValue={"0.0"};
567
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
568
                        addProjectionParameterDefaultValue(count,"0.0");
569
                        addProjectionParameterDefaultValue(count,"0.0");
570

    
571
                        String[] parameterMaxValue={"360.0"};
572
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
573
                        addProjectionParameterMaxValue(count,"100000000.0");
574
                        addProjectionParameterMaxValue(count,"100000000.0");
575

    
576
                        String[] parameterMinValue={"-360.0"};
577
                        projectionParameterMinValueList.add(count,parameterMinValue);
578
                        addProjectionParameterMinValue(count,"-100000000.0");
579
                        addProjectionParameterMinValue(count,"-100000000.0");
580

    
581
                        String[] projectionAcronym={"eck4"};
582
                        projectionAcronymList.add(count,projectionAcronym);
583
                }
584

    
585
                count++;
586
                {// Eckert_VI
587
                        String[] projectionName={"Eckert_VI"};
588
                        projectionNameList.add(count,projectionName);
589
                        addProjectionName(count,"Eckert VI");
590

    
591
                        String[] parameterName={"central_meridian"};
592
                        projectionParameterList.add(count,parameterName);
593
                        addProjectionParameter(count,"false_easting");
594
                        addProjectionParameter(count,"false_northing");
595

    
596
                        String[] parameterAcronym={"lon_0"};
597
                        projectionParameterAcronymList.add(count,parameterAcronym);
598
                        addProjectionParameterAcronymList(count,"x_0");
599
                        addProjectionParameterAcronymList(count,"y_0");
600

    
601
                        String[] parameterDefaultValue={"0.0"};
602
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
603
                        addProjectionParameterDefaultValue(count,"0.0");
604
                        addProjectionParameterDefaultValue(count,"0.0");
605

    
606
                        String[] parameterMaxValue={"360.0"};
607
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
608
                        addProjectionParameterMaxValue(count,"100000000.0");
609
                        addProjectionParameterMaxValue(count,"100000000.0");
610

    
611
                        String[] parameterMinValue={"-360.0"};
612
                        projectionParameterMinValueList.add(count,parameterMinValue);
613
                        addProjectionParameterMinValue(count,"-100000000.0");
614
                        addProjectionParameterMinValue(count,"-100000000.0");
615

    
616
                        String[] projectionAcronym={"eck6"};
617
                        projectionAcronymList.add(count,projectionAcronym);
618
                }
619
                
620
                count++;
621
                {// Equidistant_Conic
622
                        String[] projectionName={"Equidistant_Conic"};
623
                        projectionNameList.add(count,projectionName);
624
                        addProjectionName(count,"Equidistant Conic");
625
                        
626
                        String[] parameterName={"latitude_of_center"};
627
                        projectionParameterList.add(count,parameterName);
628
                        addProjectionParameter(count,"longitude_of_center");
629
                        addProjectionParameter(count,"standard_parallel_1");
630
                        addProjectionParameter(count,"standard_parallel_2");
631
                        addProjectionParameter(count,"false_easting");
632
                        addProjectionParameter(count,"false_northing");
633

    
634
                        String[] parameterAcronym={"lat_0"};
635
                        projectionParameterAcronymList.add(count,parameterAcronym);
636
                        addProjectionParameterAcronymList(count,"lon_0");
637
                        addProjectionParameterAcronymList(count,"lat_1");
638
                        addProjectionParameterAcronymList(count,"lat_2");
639
                        addProjectionParameterAcronymList(count,"x_0");
640
                        addProjectionParameterAcronymList(count,"y_0");
641

    
642
                        String[] parameterDefaultValue={"0.0"};
643
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
644
                        addProjectionParameterDefaultValue(count,"0.0");
645
                        addProjectionParameterDefaultValue(count,"0.0");
646
                        addProjectionParameterDefaultValue(count,"0.0");
647
                        addProjectionParameterDefaultValue(count,"0.0");
648
                        addProjectionParameterDefaultValue(count,"0.0");
649

    
650
                        String[] parameterMaxValue={"90.0"};
651
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
652
                        addProjectionParameterMaxValue(count,"360.0");
653
                        addProjectionParameterMaxValue(count,"90.0");
654
                        addProjectionParameterMaxValue(count,"90.0");
655
                        addProjectionParameterMaxValue(count,"100000000.0");
656
                        addProjectionParameterMaxValue(count,"100000000.0");
657

    
658
                        String[] parameterMinValue={"-90.0"};
659
                        projectionParameterMinValueList.add(count,parameterMinValue);
660
                        addProjectionParameterMinValue(count,"-360.0");
661
                        addProjectionParameterMinValue(count,"-90.0");
662
                        addProjectionParameterMinValue(count,"-90.0");
663
                        addProjectionParameterMinValue(count,"-100000000.0");
664
                        addProjectionParameterMinValue(count,"-100000000.0");
665

    
666
                        String[] projectionAcronym={"eqdc"};
667
                        projectionAcronymList.add(count,projectionAcronym);
668
                }
669

    
670
                count++;
671
                {// Equirectangular
672
                        String[] projectionName={"Equirectangular"};
673
                        projectionNameList.add(count,projectionName);
674
                        addProjectionName(count,"Plate Caree");
675
                        addProjectionName(count,"Equidistant Cylindrical");
676
                        addProjectionName(count,"9823");
677

    
678
                        String[] parameterName={"latitude_of_origin"};
679
                        projectionParameterList.add(count,parameterName);
680
                        addProjectionParameter(count,"central_meridian");
681
                        addProjectionParameter(count,"false_easting");
682
                        addProjectionParameter(count,"false_northing");
683

    
684
                        String[] parameterAcronym={"lat_ts"};
685
                        projectionParameterAcronymList.add(count,parameterAcronym);
686
                        addProjectionParameterAcronymList(count,"lon_0");
687
                        addProjectionParameterAcronymList(count,"x_0");
688
                        addProjectionParameterAcronymList(count,"y_0");
689

    
690
                        String[] parameterDefaultValue={"0.0"};
691
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
692
                        addProjectionParameterDefaultValue(count,"0.0");
693
                        addProjectionParameterDefaultValue(count,"0.0");
694
                        addProjectionParameterDefaultValue(count,"0.0");
695

    
696
                        String[] parameterMaxValue={"90.0"};
697
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
698
                        addProjectionParameterMaxValue(count,"360.0");
699
                        addProjectionParameterMaxValue(count,"100000000.0");
700
                        addProjectionParameterMaxValue(count,"100000000.0");
701

    
702
                        String[] parameterMinValue={"-90.0"};
703
                        projectionParameterMinValueList.add(count,parameterMinValue);
704
                        addProjectionParameterMinValue(count,"-360.0");
705
                        addProjectionParameterMinValue(count,"-100000000.0");
706
                        addProjectionParameterMinValue(count,"-100000000.0");
707

    
708
                        String[] projectionAcronym={"eqc"};
709
                        projectionAcronymList.add(count,projectionAcronym);
710
                }
711

    
712
                count++;
713
                {// Gall_Stereographic
714
                        String[] projectionName={"Gall_Stereographic"};
715
                        projectionNameList.add(count,projectionName);
716
                        addProjectionName(count,"Gall Stereograpic");
717
                        addProjectionName(count,"Gall");
718

    
719
                        String[] parameterName={"central_meridian"};
720
                        projectionParameterList.add(count,parameterName);
721
                        addProjectionParameter(count,"false_easting");
722
                        addProjectionParameter(count,"false_northing");
723

    
724
                        String[] parameterAcronym={"lon_0"};
725
                        projectionParameterAcronymList.add(count,parameterAcronym);
726
                        addProjectionParameterAcronymList(count,"x_0");
727
                        addProjectionParameterAcronymList(count,"y_0");
728

    
729
                        String[] parameterDefaultValue={"0.0"};
730
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
731
                        addProjectionParameterDefaultValue(count,"0.0");
732
                        addProjectionParameterDefaultValue(count,"0.0");
733

    
734
                        String[] parameterMaxValue={"360.0"};
735
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
736
                        addProjectionParameterMaxValue(count,"100000000.0");
737
                        addProjectionParameterMaxValue(count,"100000000.0");
738

    
739
                        String[] parameterMinValue={"-360.0"};
740
                        projectionParameterMinValueList.add(count,parameterMinValue);
741
                        addProjectionParameterMinValue(count,"-100000000.0");
742
                        addProjectionParameterMinValue(count,"-100000000.0");
743

    
744
                        String[] projectionAcronym={"gall"};
745
                        projectionAcronymList.add(count,projectionAcronym);
746
                }
747

    
748
                count++;
749
                {// GEOS
750
                        String[] projectionName={"GEOS"};
751
                        projectionNameList.add(count,projectionName);
752
                        addProjectionName(count,"Geostationary Satellite View");
753
                        addProjectionName(count,"Normalized Geostationary Projection");
754

    
755
                        String[] parameterName={"central_meridian"};
756
                        projectionParameterList.add(count,parameterName);
757
                        addProjectionParameter(count,"satellite_height");
758
                        addProjectionParameter(count,"false_easting");
759
                        addProjectionParameter(count,"false_northing");
760

    
761
                        String[] parameterAcronym={"lon_0"};
762
                        projectionParameterAcronymList.add(count,parameterAcronym);
763
                        addProjectionParameterAcronymList(count,"h");
764
                        addProjectionParameterAcronymList(count,"y_0");
765

    
766
                        String[] parameterDefaultValue={"0.0"};
767
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
768
                        addProjectionParameterDefaultValue(count,"35785831.0");
769
                        addProjectionParameterDefaultValue(count,"0.0");
770
                        addProjectionParameterDefaultValue(count,"0.0");
771

    
772
                        String[] parameterMaxValue={"360.0"};
773
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
774
                        addProjectionParameterMaxValue(count,"100000000.0");
775
                        addProjectionParameterMaxValue(count,"100000000.0");
776
                        addProjectionParameterMaxValue(count,"100000000.0");
777

    
778
                        String[] parameterMinValue={"-360.0"};
779
                        projectionParameterMinValueList.add(count,parameterMinValue);
780
                        addProjectionParameterMinValue(count,"-100000000.0");
781
                        addProjectionParameterMinValue(count,"-100000000.0");
782
                        addProjectionParameterMinValue(count,"-100000000.0");
783

    
784
                        String[] projectionAcronym={"geos"};
785
                        projectionAcronymList.add(count,projectionAcronym);
786
                }
787

    
788
                count++;
789
                {// Gnomonic
790
                        String[] projectionName={"Gnomonic"};
791
                        projectionNameList.add(count,projectionName);
792
                        addProjectionName(count,"Gnomonic");
793

    
794
                        String[] parameterName={"latitude_of_origin"};
795
                        projectionParameterList.add(count,parameterName);
796
                        addProjectionParameter(count,"central_meridian");
797
                        addProjectionParameter(count,"false_easting");
798
                        addProjectionParameter(count,"false_northing");
799

    
800
                        String[] parameterAcronym={"lat_0"};
801
                        projectionParameterAcronymList.add(count,parameterAcronym);
802
                        addProjectionParameterAcronymList(count,"lon_0");
803
                        addProjectionParameterAcronymList(count,"x_0");
804
                        addProjectionParameterAcronymList(count,"y_0");
805

    
806
                        String[] parameterDefaultValue={"0.0"};
807
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
808
                        addProjectionParameterDefaultValue(count,"0.0");
809
                        addProjectionParameterDefaultValue(count,"0.0");
810
                        addProjectionParameterDefaultValue(count,"0.0");
811

    
812
                        String[] parameterMaxValue={"90.0"};
813
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
814
                        addProjectionParameterMaxValue(count,"360.0");
815
                        addProjectionParameterMaxValue(count,"100000000.0");
816
                        addProjectionParameterMaxValue(count,"100000000.0");
817

    
818
                        String[] parameterMinValue={"-90.0"};
819
                        projectionParameterMinValueList.add(count,parameterMinValue);
820
                        addProjectionParameterMinValue(count,"-360.0");
821
                        addProjectionParameterMinValue(count,"-100000000.0");
822
                        addProjectionParameterMinValue(count,"-100000000.0");
823

    
824
                        String[] projectionAcronym={"gnom"};
825
                        projectionAcronymList.add(count,projectionAcronym);
826
                }
827

    
828
                count++;
829
                {// Goode
830
                        String[] projectionName={"Goode"};
831
                        projectionNameList.add(count,projectionName);
832

    
833
                        String[] parameterName={"central_meridian"};
834
                        projectionParameterList.add(count,parameterName);
835
                        addProjectionParameter(count,"false_easting");
836
                        addProjectionParameter(count,"false_northing");
837

    
838
                        String[] parameterAcronym={"lon_0"};
839
                        projectionParameterAcronymList.add(count,parameterAcronym);
840
                        addProjectionParameterAcronymList(count,"x_0");
841
                        addProjectionParameterAcronymList(count,"y_0");
842

    
843
                        String[] parameterDefaultValue={"0.0"};
844
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
845
                        addProjectionParameterDefaultValue(count,"0.0");
846
                        addProjectionParameterDefaultValue(count,"0.0");
847

    
848
                        String[] parameterMaxValue={"360.0"};
849
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
850
                        addProjectionParameterMaxValue(count,"100000000.0");
851
                        addProjectionParameterMaxValue(count,"100000000.0");
852

    
853
                        String[] parameterMinValue={"-360.0"};
854
                        projectionParameterMinValueList.add(count,parameterMinValue);
855
                        addProjectionParameterMinValue(count,"-100000000.0");
856
                        addProjectionParameterMinValue(count,"-100000000.0");
857

    
858
                        String[] projectionAcronym={"goode"};
859
                        projectionAcronymList.add(count,projectionAcronym);
860
                }
861
                
862
                count++;
863
                {// Krovak
864
                        String[] projectionName={"Krovak"};
865
                        projectionNameList.add(count,projectionName);
866
                        addProjectionName(count,"Krovak Oblique Conic Conformal");
867
                        addProjectionName(count,"9819");
868

    
869
                        String[] parameterName={"latitude_of_center"};
870
                        projectionParameterList.add(count,parameterName);
871
                        addProjectionParameter(count,"longitude_of_center");
872
                        addProjectionParameter(count,"azimuth");
873
                        addProjectionParameter(count,"scale_factor");
874
                        addProjectionParameter(count,"false_easting");
875
                        addProjectionParameter(count,"false_northing");
876

    
877
                        String[] parameterAcronym={"lat_0"};
878
                        projectionParameterAcronymList.add(count,parameterAcronym);
879
                        addProjectionParameterAcronymList(count,"lon_0");
880
                        addProjectionParameterAcronymList(count,"alpha");
881
                        addProjectionParameterAcronymList(count,"k");
882
                        addProjectionParameterAcronymList(count,"x_0");
883
                        addProjectionParameterAcronymList(count,"y_0");
884

    
885
                        String[] parameterDefaultValue={"0.0"};
886
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
887
                        addProjectionParameterDefaultValue(count,"0.0");
888
                        addProjectionParameterDefaultValue(count,"0.0");
889
                        addProjectionParameterDefaultValue(count,"1.0");
890
                        addProjectionParameterDefaultValue(count,"0.0");
891
                        addProjectionParameterDefaultValue(count,"0.0");
892

    
893
                        String[] parameterMaxValue={"90.0"};
894
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
895
                        addProjectionParameterMaxValue(count,"360.0");
896
                        addProjectionParameterMaxValue(count,"360.0");
897
                        addProjectionParameterMaxValue(count,"10.0");
898
                        addProjectionParameterMaxValue(count,"100000000.0");
899
                        addProjectionParameterMaxValue(count,"100000000.0");
900

    
901
                        String[] parameterMinValue={"-90.0"};
902
                        projectionParameterMinValueList.add(count,parameterMinValue);
903
                        addProjectionParameterMinValue(count,"-360.0");
904
                        addProjectionParameterMinValue(count,"-360.0");
905
                        addProjectionParameterMinValue(count,"0.0");
906
                        addProjectionParameterMinValue(count,"-100000000.0");
907
                        addProjectionParameterMinValue(count,"-100000000.0");
908

    
909
                        String[] projectionAcronym={"krovak"};
910
                        projectionAcronymList.add(count,projectionAcronym);
911
                }
912
                
913
                
914
                count++;
915
                {// Laborde Madagascar
916
                        String[] projectionName={"Laborde_Madagascar"};
917
                        projectionNameList.add(count,projectionName);
918
                        addProjectionName(count,"Laborde Madagascar");
919
                        addProjectionName(count,"Laborde");
920
                        addProjectionName(count,"9813");
921

    
922
                        String[] parameterName={};
923
                        projectionParameterList.add(count,parameterName);
924

    
925
                        String[] parameterAcronym={};
926
                        projectionParameterAcronymList.add(count,parameterAcronym);
927

    
928
                        String[] parameterDefaultValue={};
929
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
930

    
931
                        String[] parameterMaxValue={};
932
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
933

    
934
                        String[] parameterMinValue={};
935
                        projectionParameterMinValueList.add(count,parameterMinValue);
936

    
937
                        String[] projectionAcronym={"labrd"};
938
                        projectionAcronymList.add(count,projectionAcronym);
939
                        
940
                        /*String[] parameterName={"azimuth"};
941
                        projectionParameterList.add(count,parameterName);
942

943
                        String[] parameterAcronym={"azi"};
944
                        projectionParameterAcronymList.add(count,parameterAcronym);
945

946
                        String[] parameterDefaultValue={"18.9"};
947
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
948

949
                        String[] parameterMaxValue={"19"};
950
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
951

952
                        String[] parameterMinValue={"18"};
953
                        projectionParameterMinValueList.add(count,parameterMinValue);
954

955
                        String[] projectionAcronym={"labrd"};
956
                        projectionAcronymList.add(count,projectionAcronym);*/
957
                }
958

    
959
                count++;
960
                {// Lambert_Azimuthal_Equal_Area
961
                        String[] projectionName={"Lambert_Azimuthal_Equal_Area"};
962
                        projectionNameList.add(count,projectionName);
963
                        addProjectionName(count,"Lambert Azimuthal Equal Area");
964
                        addProjectionName(count,"Lambert Azimuthal Equal Area (Spherical)");
965
                        addProjectionName(count,"9820");
966

    
967
                        String[] parameterName={"latitude_of_center"};
968
                        projectionParameterList.add(count,parameterName);
969
                        addProjectionParameter(count,"longitude_of_center");
970
                        addProjectionParameter(count,"false_easting");
971
                        addProjectionParameter(count,"false_northing");
972

    
973
                        String[] parameterAcronym={"lat_0"};
974
                        projectionParameterAcronymList.add(count,parameterAcronym);
975
                        addProjectionParameterAcronymList(count,"lon_0");
976
                        addProjectionParameterAcronymList(count,"x_0");
977
                        addProjectionParameterAcronymList(count,"y_0");
978

    
979
                        String[] parameterDefaultValue={"0.0"};
980
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
981
                        addProjectionParameterDefaultValue(count,"0.0");
982
                        addProjectionParameterDefaultValue(count,"0.0");
983
                        addProjectionParameterDefaultValue(count,"0.0");
984

    
985
                        String[] parameterMaxValue={"90.0"};
986
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
987
                        addProjectionParameterMaxValue(count,"360.0");
988
                        addProjectionParameterMaxValue(count,"100000000.0");
989
                        addProjectionParameterMaxValue(count,"100000000.0");
990

    
991
                        String[] parameterMinValue={"-90.0"};
992
                        projectionParameterMinValueList.add(count,parameterMinValue);
993
                        addProjectionParameterMinValue(count,"-360.0");
994
                        addProjectionParameterMinValue(count,"-100000000.0");
995
                        addProjectionParameterMinValue(count,"-100000000.0");
996

    
997
                        String[] projectionAcronym={"laea"};
998
                        projectionAcronymList.add(count,projectionAcronym);
999
                }
1000
                
1001
                count++;
1002
                {// Lambert_Conformal_Conic_1SP
1003
                        String[] projectionName={"Lambert_Conformal_Conic_1SP"};
1004
                        projectionNameList.add(count,projectionName);
1005
                        addProjectionName(count,"Lambert Conic Conformal (1SP)");
1006
                        addProjectionName(count,"9801");
1007

    
1008
                        String[] parameterName={"latitude_of_origin"};
1009
                        projectionParameterList.add(count,parameterName);
1010
                        addProjectionParameter(count,"central_meridian");
1011
                        addProjectionParameter(count,"scale_factor");
1012
                        addProjectionParameter(count,"false_easting");
1013
                        addProjectionParameter(count,"false_northing");
1014

    
1015
                        String[] parameterAcronym={"lat_0"};
1016
                        projectionParameterAcronymList.add(count,parameterAcronym);
1017
                        addProjectionParameterAcronymList(count,"lon_0");
1018
                        addProjectionParameterAcronymList(count,"k_0");
1019
                        addProjectionParameterAcronymList(count,"x_0");
1020
                        addProjectionParameterAcronymList(count,"y_0");
1021

    
1022
                        String[] parameterDefaultValue={"0.0"};
1023
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1024
                        addProjectionParameterDefaultValue(count,"0.0");
1025
                        addProjectionParameterDefaultValue(count,"1.0");
1026
                        addProjectionParameterDefaultValue(count,"0.0");
1027
                        addProjectionParameterDefaultValue(count,"0.0");
1028

    
1029
                        String[] parameterMaxValue={"90.0"};
1030
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1031
                        addProjectionParameterMaxValue(count,"360.0");
1032
                        addProjectionParameterMaxValue(count,"10.0");
1033
                        addProjectionParameterMaxValue(count,"100000000.0");
1034
                        addProjectionParameterMaxValue(count,"100000000.0");
1035

    
1036
                        String[] parameterMinValue={"-90.0"};
1037
                        projectionParameterMinValueList.add(count,parameterMinValue);
1038
                        addProjectionParameterMinValue(count,"-360.0");
1039
                        addProjectionParameterMinValue(count,"0.0");
1040
                        addProjectionParameterMinValue(count,"-100000000.0");
1041
                        addProjectionParameterMinValue(count,"-100000000.0");
1042

    
1043
                        String[] projectionAcronym={"lcca"};
1044
                        projectionAcronymList.add(count,projectionAcronym);
1045
                }
1046
                
1047
                count++;
1048
                {// Lambert_Conformal_Conic_2SP
1049
                        String[] projectionName={"Lambert_Conformal_Conic_2SP"};
1050
                        projectionNameList.add(count,projectionName);
1051
                        addProjectionName(count,"Lambert Conic Conformal (2SP)");
1052
                        addProjectionName(count,"9802");
1053

    
1054
                        String[] parameterName={"standard_parallel_1"};
1055
                        projectionParameterList.add(count,parameterName);
1056
                        addProjectionParameter(count,"standard_parallel_2");
1057
                        addProjectionParameter(count,"latitude_of_origin");
1058
                        addProjectionParameter(count,"central_meridian");
1059
                        addProjectionParameter(count,"false_easting");
1060
                        addProjectionParameter(count,"false_northing");
1061

    
1062
                        String[] parameterAcronym={"lat_1"};
1063
                        projectionParameterAcronymList.add(count,parameterAcronym);
1064
                        addProjectionParameterAcronymList(count,"lat_2");
1065
                        addProjectionParameterAcronymList(count,"lat_0");
1066
                        addProjectionParameterAcronymList(count,"lon_0");
1067
                        addProjectionParameterAcronymList(count,"x_0");
1068
                        addProjectionParameterAcronymList(count,"y_0");
1069

    
1070
                        String[] parameterDefaultValue={"0.0"};
1071
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1072
                        addProjectionParameterDefaultValue(count,"0.0");
1073
                        addProjectionParameterDefaultValue(count,"0.0");
1074
                        addProjectionParameterDefaultValue(count,"0.0");
1075
                        addProjectionParameterDefaultValue(count,"0.0");
1076
                        addProjectionParameterDefaultValue(count,"0.0");
1077

    
1078
                        String[] parameterMaxValue={"90.0"};
1079
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1080
                        addProjectionParameterMaxValue(count,"90.0");
1081
                        addProjectionParameterMaxValue(count,"90.0");
1082
                        addProjectionParameterMaxValue(count,"360.0");
1083
                        addProjectionParameterMaxValue(count,"100000000.0");
1084
                        addProjectionParameterMaxValue(count,"100000000.0");
1085

    
1086
                        String[] parameterMinValue={"-90.0"};
1087
                        projectionParameterMinValueList.add(count,parameterMinValue);
1088
                        addProjectionParameterMinValue(count,"-90.0");
1089
                        addProjectionParameterMinValue(count,"-90.0");
1090
                        addProjectionParameterMinValue(count,"-360.0");
1091
                        addProjectionParameterMinValue(count,"-100000000.0");
1092
                        addProjectionParameterMinValue(count,"-100000000.0");
1093

    
1094
                        String[] projectionAcronym={"lcc"};
1095
                        projectionAcronymList.add(count,projectionAcronym);
1096
                }
1097
                
1098
                count++;
1099
                {// Lambert_Conformal_Conic_2SP_Belgium
1100
                        String[] projectionName={"Lambert_Conformal_Conic_2SP_Belgium"};
1101
                        projectionNameList.add(count,projectionName);
1102
                        addProjectionName(count,"Lambert Conic Conformal (2SP Belgium)");
1103
                        addProjectionName(count,"9803");
1104

    
1105
                        String[] parameterName={"standard_parallel_1"};
1106
                        projectionParameterList.add(count,parameterName);
1107
                        addProjectionParameter(count,"standard_parallel_2");
1108
                        addProjectionParameter(count,"latitude_of_origin");
1109
                        addProjectionParameter(count,"central_meridian");
1110
                        addProjectionParameter(count,"false_easting");
1111
                        addProjectionParameter(count,"false_northing");
1112

    
1113
                        String[] parameterAcronym={"lat_1"};
1114
                        projectionParameterAcronymList.add(count,parameterAcronym);
1115
                        addProjectionParameterAcronymList(count,"lat_2");
1116
                        addProjectionParameterAcronymList(count,"lat_0");
1117
                        addProjectionParameterAcronymList(count,"lon_0");
1118
                        addProjectionParameterAcronymList(count,"x_0");
1119
                        addProjectionParameterAcronymList(count,"y_0");
1120

    
1121
                        String[] parameterDefaultValue={"0.0"};
1122
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1123
                        addProjectionParameterDefaultValue(count,"0.0");
1124
                        addProjectionParameterDefaultValue(count,"0.0");
1125
                        addProjectionParameterDefaultValue(count,"0.0");
1126
                        addProjectionParameterDefaultValue(count,"0.0");
1127
                        addProjectionParameterDefaultValue(count,"0.0");
1128

    
1129
                        String[] parameterMaxValue={"90.0"};
1130
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1131
                        addProjectionParameterMaxValue(count,"90.0");
1132
                        addProjectionParameterMaxValue(count,"90.0");
1133
                        addProjectionParameterMaxValue(count,"360.0");
1134
                        addProjectionParameterMaxValue(count,"100000000.0");
1135
                        addProjectionParameterMaxValue(count,"100000000.0");
1136

    
1137
                        String[] parameterMinValue={"-90.0"};
1138
                        projectionParameterMinValueList.add(count,parameterMinValue);
1139
                        addProjectionParameterMinValue(count,"-90.0");
1140
                        addProjectionParameterMinValue(count,"-90.0");
1141
                        addProjectionParameterMinValue(count,"-360.0");
1142
                        addProjectionParameterMinValue(count,"-100000000.0");
1143
                        addProjectionParameterMinValue(count,"-100000000.0");
1144

    
1145
                        String[] projectionAcronym={"lcc"};
1146
                        projectionAcronymList.add(count,projectionAcronym);
1147
                }
1148
                
1149
                count++;
1150
                {// Mercator_1SP
1151
                        String[] projectionName={"Mercator_1SP"};
1152
                        projectionNameList.add(count,projectionName);
1153
                        addProjectionName(count,"Mercator");
1154
                        addProjectionName(count,"9804");
1155
                        addProjectionName(count, "Mercator (1SP)");
1156
                        addProjectionName(count, "Mercator_(1SP)");
1157

    
1158
                        String[] parameterName={"central_meridian"};
1159
                        projectionParameterList.add(count,parameterName);
1160
                        addProjectionParameter(count,"latitude_of_origin");  // o latitude_origin
1161
                        addProjectionParameter(count,"scale_factor");  // o latitude_origin
1162
                        addProjectionParameter(count,"false_easting");
1163
                        addProjectionParameter(count,"false_northing");
1164

    
1165
                        String[] parameterAcronym={"lon_0"};
1166
                        projectionParameterAcronymList.add(count,parameterAcronym);
1167
                        addProjectionParameterAcronymList(count,"lat_ts"); // o lat_ts
1168
                        addProjectionParameterAcronymList(count,"k"); // o lat_ts
1169
                        addProjectionParameterAcronymList(count,"x_0");
1170
                        addProjectionParameterAcronymList(count,"y_0");
1171

    
1172
                        String[] parameterDefaultValue={"0.0"};
1173
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1174
                        addProjectionParameterDefaultValue(count,"0.0"); // o 0.0
1175
                        addProjectionParameterDefaultValue(count,"1.0"); // o 0.0
1176
                        addProjectionParameterDefaultValue(count,"0.0");
1177
                        addProjectionParameterDefaultValue(count,"0.0");
1178

    
1179
                        String[] parameterMaxValue={"360.0"};
1180
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1181
                        addProjectionParameterMaxValue(count,"90.0");
1182
                        addProjectionParameterMaxValue(count,"10.0");
1183
                        addProjectionParameterMaxValue(count,"100000000.0");
1184
                        addProjectionParameterMaxValue(count,"100000000.0");
1185

    
1186
                        String[] parameterMinValue={"-360.0"};
1187
                        projectionParameterMinValueList.add(count,parameterMinValue);
1188
                        addProjectionParameterMinValue(count,"-90.0");
1189
                        addProjectionParameterMinValue(count,"0.0");
1190
                        addProjectionParameterMinValue(count,"-100000000.0");
1191
                        addProjectionParameterMinValue(count,"-100000000.0");
1192

    
1193
                        String[] projectionAcronym={"merc"};
1194
                        projectionAcronymList.add(count,projectionAcronym);
1195
                }
1196
                
1197
                count++;
1198
                {// Mercator_2SP
1199
                        String[] projectionName={"Mercator_2SP"};
1200
                        projectionNameList.add(count,projectionName);
1201
                        addProjectionName(count,"Mercator");
1202
                        addProjectionName(count,"9805");
1203
                        addProjectionName(count, "Mercator (2SP)");
1204

    
1205
                        String[] parameterName={"central_meridian"};
1206
                        projectionParameterList.add(count,parameterName);
1207
                        addProjectionParameter(count,"standard_parallel_1");
1208
                        addProjectionParameter(count,"false_easting");
1209
                        addProjectionParameter(count,"false_northing");
1210

    
1211
                        String[] parameterAcronym={"lon_0"};
1212
                        projectionParameterAcronymList.add(count,parameterAcronym);
1213
                        addProjectionParameterAcronymList(count,"lat_ts");
1214
                        addProjectionParameterAcronymList(count,"x_0");
1215
                        addProjectionParameterAcronymList(count,"y_0");
1216

    
1217
                        String[] parameterDefaultValue={"0.0"};
1218
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1219
                        addProjectionParameterDefaultValue(count,"0.0"); // o 0.0
1220
                        addProjectionParameterDefaultValue(count,"0.0");
1221
                        addProjectionParameterDefaultValue(count,"0.0");
1222

    
1223
                        String[] parameterMaxValue={"360.0"};
1224
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1225
                        addProjectionParameterMaxValue(count,"90.0");
1226
                        addProjectionParameterMaxValue(count,"100000000.0");
1227
                        addProjectionParameterMaxValue(count,"100000000.0");
1228

    
1229
                        String[] parameterMinValue={"-360.0"};
1230
                        projectionParameterMinValueList.add(count,parameterMinValue);
1231
                        addProjectionParameterMinValue(count,"-90.0");
1232
                        addProjectionParameterMinValue(count,"-100000000.0");
1233
                        addProjectionParameterMinValue(count,"-100000000.0");
1234

    
1235
                        String[] projectionAcronym={"merc"};
1236
                        projectionAcronymList.add(count,projectionAcronym);
1237
                }
1238

    
1239
                count++;
1240
                {// Miller_Cylindrical
1241
                        String[] projectionName={"Miller_Cylindrical"};
1242
                        projectionNameList.add(count,projectionName);
1243
                        addProjectionName(count,"Miller Cylindrical");
1244

    
1245
                        String[] parameterName={"latitude_of_center"};
1246
                        projectionParameterList.add(count,parameterName);
1247
                        addProjectionParameter(count,"longitude_of_center");
1248
                        addProjectionParameter(count,"false_easting");
1249
                        addProjectionParameter(count,"false_northing");
1250

    
1251
                        String[] parameterAcronym={"lat_0"};
1252
                        projectionParameterAcronymList.add(count,parameterAcronym);
1253
                        addProjectionParameterAcronymList(count,"lon_0");
1254
                        addProjectionParameterAcronymList(count,"x_0");
1255
                        addProjectionParameterAcronymList(count,"y_0");
1256

    
1257
                        String[] parameterDefaultValue={"0.0"};
1258
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1259
                        addProjectionParameterDefaultValue(count,"0.0");
1260
                        addProjectionParameterDefaultValue(count,"0.0");
1261
                        addProjectionParameterDefaultValue(count,"0.0");
1262

    
1263
                        String[] parameterMaxValue={"90.0"};
1264
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1265
                        addProjectionParameterMaxValue(count,"360.0");
1266
                        addProjectionParameterMaxValue(count,"100000000.0");
1267
                        addProjectionParameterMaxValue(count,"100000000.0");
1268

    
1269
                        String[] parameterMinValue={"-90.0"};
1270
                        projectionParameterMinValueList.add(count,parameterMinValue);
1271
                        addProjectionParameterMinValue(count,"-360.0");
1272
                        addProjectionParameterMinValue(count,"-100000000.0");
1273
                        addProjectionParameterMinValue(count,"-100000000.0");
1274

    
1275
                        String[] projectionAcronym={"mill"};
1276
                        projectionAcronymList.add(count,projectionAcronym);
1277
                }
1278
                
1279
                count++;
1280
                {// Mollweide
1281
                        String[] projectionName={"Mollweide"};
1282
                        projectionNameList.add(count,projectionName);
1283
                        addProjectionName(count,"Hornolographic");
1284
                        addProjectionName(count,"Babinet");
1285
                        addProjectionName(count,"Elliptical");
1286

    
1287
                        String[] parameterName={"central_meridian"};
1288
                        projectionParameterList.add(count,parameterName);
1289
                        addProjectionParameter(count,"false_easting");
1290
                        addProjectionParameter(count,"false_northing");
1291

    
1292
                        String[] parameterAcronym={"lon_0"};
1293
                        projectionParameterAcronymList.add(count,parameterAcronym);
1294
                        addProjectionParameterAcronymList(count,"x_0");
1295
                        addProjectionParameterAcronymList(count,"y_0");
1296

    
1297
                        String[] parameterDefaultValue={"0.0"};
1298
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1299
                        addProjectionParameterDefaultValue(count,"0.0");
1300
                        addProjectionParameterDefaultValue(count,"0.0");
1301

    
1302
                        String[] parameterMaxValue={"360.0"};
1303
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1304
                        addProjectionParameterMaxValue(count,"100000000.0");
1305
                        addProjectionParameterMaxValue(count,"100000000.0");
1306

    
1307
                        String[] parameterMinValue={"-360.0"};
1308
                        projectionParameterMinValueList.add(count,parameterMinValue);
1309
                        addProjectionParameterMinValue(count,"-100000000.0");
1310
                        addProjectionParameterMinValue(count,"-100000000.0");
1311

    
1312
                        String[] projectionAcronym={"moll"};
1313
                        projectionAcronymList.add(count,projectionAcronym);
1314
                }
1315

    
1316
                count++;
1317
                {// New_Zealand_Map_Grid
1318
                        String[] projectionName={"New_Zealand_Map_Grid"};
1319
                        projectionNameList.add(count,projectionName);
1320
                        addProjectionName(count,"New Zealand Map Grid");
1321
                        addProjectionName(count,"9811");
1322

    
1323
                        String[] parameterName={"latitude_of_origin"};
1324
                        projectionParameterList.add(count,parameterName);
1325
                        addProjectionParameter(count,"central_meridian");
1326
                        addProjectionParameter(count,"false_easting");
1327
                        addProjectionParameter(count,"false_northing");
1328

    
1329
                        String[] parameterAcronym={"lat_0"};
1330
                        projectionParameterAcronymList.add(count,parameterAcronym);
1331
                        addProjectionParameterAcronymList(count,"lon_0");
1332
                        addProjectionParameterAcronymList(count,"x_0");
1333
                        addProjectionParameterAcronymList(count,"y_0");
1334

    
1335
                        String[] parameterDefaultValue={"0.0"};
1336
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1337
                        addProjectionParameterDefaultValue(count,"0.0");
1338
                        addProjectionParameterDefaultValue(count,"0.0");
1339
                        addProjectionParameterDefaultValue(count,"0.0");
1340

    
1341
                        String[] parameterMaxValue={"90.0"};
1342
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1343
                        addProjectionParameterMaxValue(count,"360.0");
1344
                        addProjectionParameterMaxValue(count,"100000000.0");
1345
                        addProjectionParameterMaxValue(count,"100000000.0");
1346

    
1347
                        String[] parameterMinValue={"-90.0"};
1348
                        projectionParameterMinValueList.add(count,parameterMinValue);
1349
                        addProjectionParameterMinValue(count,"-360.0");
1350
                        addProjectionParameterMinValue(count,"-100000000.0");
1351
                        addProjectionParameterMinValue(count,"-100000000.0");
1352

    
1353
                        String[] projectionAcronym={"nzmg"};
1354
                        projectionAcronymList.add(count,projectionAcronym);
1355
                }
1356

    
1357
                count++;
1358
                {// Oblique_Mercator
1359
                        String[] projectionName={"Oblique_Mercator"};
1360
                        projectionNameList.add(count,projectionName);
1361
                        addProjectionName(count,"Oblique Mercator");
1362
                        addProjectionName(count,"9815");
1363
                        addProjectionName(count,"CT_ObliqueMercator");
1364
                        addProjectionName(count,"Hotine_Oblique_Mercator_Azimuth_Center");
1365
                        addProjectionName(count,"Rectified_Skew_Orthomorphic_Center");
1366
                        addProjectionName(count,"Hotine Oblique Mercator");
1367
                        addProjectionName(count,"Hotine_Oblique_Mercator");
1368

    
1369
                        String[] parameterName={"latitude_of_center"};
1370
                        projectionParameterList.add(count,parameterName);
1371
                        addProjectionParameter(count,"longitude_of_center");
1372
                        addProjectionParameter(count,"azimuth");
1373
                        addProjectionParameter(count,"rectified_grid_angle");
1374
                        addProjectionParameter(count,"scale_factor");
1375
                        addProjectionParameter(count,"false_easting");
1376
                        addProjectionParameter(count,"false_northing");
1377

    
1378
                        String[] parameterAcronym={"lat_0"};
1379
                        projectionParameterAcronymList.add(count,parameterAcronym);
1380
                        addProjectionParameterAcronymList(count,"lonc");
1381
                        addProjectionParameterAcronymList(count,"alpha");
1382
                        addProjectionParameterAcronymList(count,"gamma");
1383
                        addProjectionParameterAcronymList(count,"k");
1384
                        addProjectionParameterAcronymList(count,"x_0");
1385
                        addProjectionParameterAcronymList(count,"y_0");
1386

    
1387
                        String[] parameterDefaultValue={"0.0"};
1388
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1389
                        addProjectionParameterDefaultValue(count,"0.0");
1390
                        addProjectionParameterDefaultValue(count,"0.0");
1391
                        addProjectionParameterDefaultValue(count,"0.0");
1392
                        addProjectionParameterDefaultValue(count,"1.0");
1393
                        addProjectionParameterDefaultValue(count,"0.0");
1394
                        addProjectionParameterDefaultValue(count,"0.0");
1395

    
1396
                        String[] parameterMaxValue={"90.0"};
1397
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1398
                        addProjectionParameterMaxValue(count,"360.0");
1399
                        addProjectionParameterMaxValue(count,"360.0");
1400
                        addProjectionParameterMaxValue(count,"360.0");
1401
                        addProjectionParameterMaxValue(count,"10.0");
1402
                        addProjectionParameterMaxValue(count,"100000000.0");
1403
                        addProjectionParameterMaxValue(count,"100000000.0");
1404

    
1405
                        String[] parameterMinValue={"-90.0"};
1406
                        projectionParameterMinValueList.add(count,parameterMinValue);
1407
                        addProjectionParameterMinValue(count,"-360.0");
1408
                        addProjectionParameterMinValue(count,"-360.0");
1409
                        addProjectionParameterMinValue(count,"-360.0");
1410
                        addProjectionParameterMinValue(count,"0.0");
1411
                        addProjectionParameterMinValue(count,"-100000000.0");
1412
                        addProjectionParameterMinValue(count,"-100000000.0");
1413

    
1414
                        String[] projectionAcronym={"omerc"};
1415
                        projectionAcronymList.add(count,projectionAcronym);
1416
                }
1417

    
1418
                count++;
1419
                {// Oblique_Mercator
1420
                        String[] projectionName={"Hotine_Oblique_Mercator_Two_Point_Center"};
1421
                        projectionNameList.add(count,projectionName);
1422
                        addProjectionName(count,"Hotine_Oblique_Mercator_Two_Point_Natural_Origin");
1423

    
1424
            /*SEMI_MAJOR,          SEMI_MINOR,
1425
            LAT_OF_1ST_POINT,    LONG_OF_1ST_POINT,
1426
            LAT_OF_2ND_POINT,    LONG_OF_2ND_POINT,
1427
                    LAT_OF_CENTRE,       SCALE_FACTOR_LOCAL,
1428
            FALSE_EASTING_LOCAL,       FALSE_NORTHING_LOCAL*/
1429

    
1430
            String[] parameterName={"Latitude_Of_2nd_Point"};
1431
                        projectionParameterList.add(count,parameterName);
1432
                        addProjectionParameter(count,"Longitude_Of_1st_Point");
1433
                        addProjectionParameter(count,"Latitude_Of_2nd_Point");
1434
                        addProjectionParameter(count,"Longitude_Of_2nd_Point");
1435
                        addProjectionParameter(count,"scale_factor");
1436
                        addProjectionParameter(count,"false_easting");
1437
                        addProjectionParameter(count,"false_northing");
1438

    
1439
                        String[] parameterAcronym={"lat_1"};
1440
                        projectionParameterAcronymList.add(count,parameterAcronym);
1441
                        addProjectionParameterAcronymList(count,"lon_1");
1442
                        addProjectionParameterAcronymList(count,"lat_2");
1443
                        addProjectionParameterAcronymList(count,"lon_2");
1444
                        addProjectionParameterAcronymList(count,"k");
1445
                        addProjectionParameterAcronymList(count,"x_0");
1446
                        addProjectionParameterAcronymList(count,"y_0");
1447

    
1448
                        String[] parameterDefaultValue={"0.0"};
1449
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1450
                        addProjectionParameterDefaultValue(count,"0.0");
1451
                        addProjectionParameterDefaultValue(count,"0.0");
1452
                        addProjectionParameterDefaultValue(count,"0.0");
1453
                        addProjectionParameterDefaultValue(count,"1.0");
1454
                        addProjectionParameterDefaultValue(count,"0.0");
1455
                        addProjectionParameterDefaultValue(count,"0.0");
1456

    
1457
                        String[] parameterMaxValue={"90.0"};
1458
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1459
                        addProjectionParameterMaxValue(count,"360.0");
1460
                        addProjectionParameterMaxValue(count,"90.0");
1461
                        addProjectionParameterMaxValue(count,"360.0");
1462
                        addProjectionParameterMaxValue(count,"10.0");
1463
                        addProjectionParameterMaxValue(count,"100000000.0");
1464
                        addProjectionParameterMaxValue(count,"100000000.0");
1465

    
1466
                        String[] parameterMinValue={"-90.0"};
1467
                        projectionParameterMinValueList.add(count,parameterMinValue);
1468
                        addProjectionParameterMinValue(count,"-360.0");
1469
                        addProjectionParameterMinValue(count,"-90.0");
1470
                        addProjectionParameterMinValue(count,"-360.0");
1471
                        addProjectionParameterMinValue(count,"0.0");
1472
                        addProjectionParameterMinValue(count,"-100000000.0");
1473
                        addProjectionParameterMinValue(count,"-100000000.0");
1474

    
1475
                        String[] projectionAcronym={"omerc"};
1476
                        projectionAcronymList.add(count,projectionAcronym);
1477
                }
1478

    
1479
                count++;
1480
                {// Oblique_Stereographic
1481
                        String[] projectionName={"Oblique_Stereographic"};
1482
                        projectionNameList.add(count,projectionName);
1483
                        addProjectionName(count,"Oblique Stereographic");
1484
                        addProjectionName(count,"9809");
1485

    
1486
                        String[] parameterName={"latitude_of_origin"};
1487
                        projectionParameterList.add(count,parameterName);
1488
                        addProjectionParameter(count,"central_meridian");
1489
                        addProjectionParameter(count,"scale_factor");
1490
                        addProjectionParameter(count,"false_easting");
1491
                        addProjectionParameter(count,"false_northing");
1492

    
1493
                        String[] parameterAcronym={"lat_0"};
1494
                        projectionParameterAcronymList.add(count,parameterAcronym);
1495
                        addProjectionParameterAcronymList(count,"lon_0");
1496
                        addProjectionParameterAcronymList(count,"k");
1497
                        addProjectionParameterAcronymList(count,"x_0");
1498
                        addProjectionParameterAcronymList(count,"y_0");
1499

    
1500
                        String[] parameterDefaultValue={"0.0"};
1501
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1502
                        addProjectionParameterDefaultValue(count,"0.0");
1503
                        addProjectionParameterDefaultValue(count,"1.0");
1504
                        addProjectionParameterDefaultValue(count,"0.0");
1505
                        addProjectionParameterDefaultValue(count,"0.0");
1506

    
1507
                        String[] parameterMaxValue={"90.0"};
1508
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1509
                        addProjectionParameterMaxValue(count,"360.0");
1510
                        addProjectionParameterMaxValue(count,"10.0");
1511
                        addProjectionParameterMaxValue(count,"100000000.0");
1512
                        addProjectionParameterMaxValue(count,"100000000.0");
1513

    
1514
                        String[] parameterMinValue={"-90.0"};
1515
                        projectionParameterMinValueList.add(count,parameterMinValue);
1516
                        addProjectionParameterMinValue(count,"-360.0");
1517
                        addProjectionParameterMinValue(count,"0.0");
1518
                        addProjectionParameterMinValue(count,"-100000000.0");
1519
                        addProjectionParameterMinValue(count,"-100000000.0");
1520

    
1521
                        String[] projectionAcronym={"sterea"};
1522
                        projectionAcronymList.add(count,projectionAcronym);
1523
                }
1524

    
1525
                count++;
1526
                {// Orthographic
1527
                        String[] projectionName={"Orthographic"};
1528
                        projectionNameList.add(count,projectionName);
1529

    
1530
                        String[] parameterName={"latitude_of_origin"};
1531
                        projectionParameterList.add(count,parameterName);
1532
                        addProjectionParameter(count,"central_meridian");
1533
                        addProjectionParameter(count,"false_easting");
1534
                        addProjectionParameter(count,"false_northing");
1535

    
1536
                        String[] parameterAcronym={"lat_0"};
1537
                        projectionParameterAcronymList.add(count,parameterAcronym);
1538
                        addProjectionParameterAcronymList(count,"lon_0");
1539
                        addProjectionParameterAcronymList(count,"x_0");
1540
                        addProjectionParameterAcronymList(count,"y_0");
1541

    
1542
                        String[] parameterDefaultValue={"0.0"};
1543
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1544
                        addProjectionParameterDefaultValue(count,"0.0");
1545
                        addProjectionParameterDefaultValue(count,"0.0");
1546
                        addProjectionParameterDefaultValue(count,"0.0");
1547

    
1548
                        String[] parameterMaxValue={"90.0"};
1549
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1550
                        addProjectionParameterMaxValue(count,"360.0");
1551
                        addProjectionParameterMaxValue(count,"100000000.0");
1552
                        addProjectionParameterMaxValue(count,"100000000.0");
1553

    
1554
                        String[] parameterMinValue={"-90.0"};
1555
                        projectionParameterMinValueList.add(count,parameterMinValue);
1556
                        addProjectionParameterMinValue(count,"-360.0");
1557
                        addProjectionParameterMinValue(count,"-100000000.0");
1558
                        addProjectionParameterMinValue(count,"-100000000.0");
1559

    
1560
                        String[] projectionAcronym={"ortho"};
1561
                        projectionAcronymList.add(count,projectionAcronym);
1562
                }
1563

    
1564
                count++;
1565
                {// Polar_Stereographic
1566
                        String[] projectionName={"Polar_Stereographic"};
1567
                        projectionNameList.add(count,projectionName);
1568
                        addProjectionName(count,"Polar Stereographic");
1569
                        addProjectionName(count,"Polar_Stereographic_(variant_A)");
1570
                        addProjectionName(count,"Polar_Stereographic_(variant_B)");
1571
                        addProjectionName(count,"9810");
1572
                        addProjectionName(count,"9829");
1573

    
1574
                        String[] parameterName={"latitude_of_origin"};
1575
                        projectionParameterList.add(count,parameterName);
1576
                        addProjectionParameter(count,"latitude_of_standard_parallel");
1577
                        addProjectionParameter(count,"central_meridian");
1578
                        addProjectionParameter(count,"scale_factor");
1579
                        addProjectionParameter(count,"false_easting");
1580
                        addProjectionParameter(count,"false_northing");
1581

    
1582
                        String[] parameterAcronym={"lat_0"};
1583
                        //lat_0=90 o lat_0=-90
1584
                        projectionParameterAcronymList.add(count,parameterAcronym);
1585
                        addProjectionParameterAcronymList(count,"lat_ts");
1586
                        addProjectionParameterAcronymList(count,"lon_0");
1587
                        addProjectionParameterAcronymList(count,"k_0");
1588
                        addProjectionParameterAcronymList(count,"x_0");
1589
                        addProjectionParameterAcronymList(count,"y_0");
1590

    
1591
                        String[] parameterDefaultValue={"90.0"};
1592
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1593
                        addProjectionParameterDefaultValue(count,"90.0");
1594
                        addProjectionParameterDefaultValue(count,"0.0");
1595
                        addProjectionParameterDefaultValue(count,"1.0");
1596
                        addProjectionParameterDefaultValue(count,"0.0");
1597
                        addProjectionParameterDefaultValue(count,"0.0");
1598

    
1599
                        String[] parameterMaxValue={"90.0"};
1600
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1601
                        addProjectionParameterMaxValue(count,"90.0");
1602
                        addProjectionParameterMaxValue(count,"360.0");
1603
                        addProjectionParameterMaxValue(count,"10.0");
1604
                        addProjectionParameterMaxValue(count,"100000000.0");
1605
                        addProjectionParameterMaxValue(count,"100000000.0");
1606

    
1607
                        String[] parameterMinValue={"-90.0"};
1608
                        projectionParameterMinValueList.add(count,parameterMinValue);
1609
                        addProjectionParameterMinValue(count,"-90.0");
1610
                        addProjectionParameterMinValue(count,"-360.0");
1611
                        addProjectionParameterMinValue(count,"0.0");
1612
                        addProjectionParameterMinValue(count,"-100000000.0");
1613
                        addProjectionParameterMinValue(count,"-100000000.0");
1614

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

    
1619
                count++;
1620
                {// Polyconic
1621
                        String[] projectionName={"Polyconic"};
1622
                        projectionNameList.add(count,projectionName);
1623
                        addProjectionName(count,"American_Polyconic");
1624
                        addProjectionName(count,"American Polyconic");
1625
                        addProjectionName(count,"9818");
1626

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

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

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

    
1645
                        String[] parameterMaxValue={"90.0"};
1646
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1647
                        addProjectionParameterMaxValue(count,"360.0");
1648
                        addProjectionParameterMaxValue(count,"100000000.0");
1649
                        addProjectionParameterMaxValue(count,"100000000.0");
1650

    
1651
                        String[] parameterMinValue={"-90.0"};
1652
                        projectionParameterMinValueList.add(count,parameterMinValue);
1653
                        addProjectionParameterMinValue(count,"-360.0");
1654
                        addProjectionParameterMinValue(count,"-100000000.0");
1655
                        addProjectionParameterMinValue(count,"-100000000.0");
1656

    
1657
                        String[] projectionAcronym={"poly"};
1658
                        projectionAcronymList.add(count,projectionAcronym);
1659
                }
1660

    
1661
                count++;
1662
                {// Robinson
1663
                        String[] projectionName={"Robinson"};
1664
                        projectionNameList.add(count,projectionName);
1665

    
1666
                        String[] parameterName={"longitude_of_center"};
1667
                        projectionParameterList.add(count,parameterName);
1668
                        addProjectionParameter(count,"false_easting");
1669
                        addProjectionParameter(count,"false_northing");
1670

    
1671
                        String[] parameterAcronym={"lon_0"};
1672
                        projectionParameterAcronymList.add(count,parameterAcronym);
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

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

    
1686
                        String[] parameterMinValue={"-360.0"};
1687
                        projectionParameterMinValueList.add(count,parameterMinValue);
1688
                        addProjectionParameterMinValue(count,"-100000000.0");
1689
                        addProjectionParameterMinValue(count,"-100000000.0");
1690

    
1691
                        String[] projectionAcronym={"robin"};
1692
                        projectionAcronymList.add(count,projectionAcronym);
1693
                }
1694

    
1695
                //         Rosenmund Oblique Mercator - No en EPSG
1696

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

    
1702
                        String[] parameterName={"longitude_of_center"};
1703
                        projectionParameterList.add(count,parameterName);
1704
                        addProjectionParameter(count,"false_easting");
1705
                        addProjectionParameter(count,"false_northing");
1706

    
1707
                        String[] parameterAcronym={"lon_0"};
1708
                        projectionParameterAcronymList.add(count,parameterAcronym);
1709
                        addProjectionParameterAcronymList(count,"x_0");
1710
                        addProjectionParameterAcronymList(count,"y_0");
1711

    
1712
                        String[] parameterDefaultValue={"0.0"};
1713
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1714
                        addProjectionParameterDefaultValue(count,"0.0");
1715
                        addProjectionParameterDefaultValue(count,"0.0");
1716

    
1717
                        String[] parameterMaxValue={"360.0"};
1718
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1719
                        addProjectionParameterMaxValue(count,"100000000.0");
1720
                        addProjectionParameterMaxValue(count,"100000000.0");
1721

    
1722
                        String[] parameterMinValue={"-360.0"};
1723
                        projectionParameterMinValueList.add(count,parameterMinValue);
1724
                        addProjectionParameterMinValue(count,"-100000000.0");
1725
                        addProjectionParameterMinValue(count,"-100000000.0");
1726

    
1727
                        String[] projectionAcronym={"sinu"};
1728
                        projectionAcronymList.add(count,projectionAcronym);
1729
                }
1730

    
1731
                count++;
1732
                {// Swiss_Oblique_Cylindrical
1733
                        String[] projectionName={"Swiss_Oblique_Cylindrical"};
1734
                        projectionNameList.add(count,projectionName);
1735
                        addProjectionName(count,"Swiss Oblique Cylindrical");
1736
                        addProjectionName(count,"Swiss Oblique Mercator");
1737
                        addProjectionName(count,"9814");
1738

    
1739
                        String[] parameterName={"latitude_of_origin"};
1740
                        projectionParameterList.add(count,parameterName);
1741
                        addProjectionParameter(count,"central_meridian");
1742
                        addProjectionParameter(count,"false_easting");
1743
                        addProjectionParameter(count,"false_northing");
1744

    
1745
                        String[] parameterAcronym={"lat_0"};
1746
                        projectionParameterAcronymList.add(count,parameterAcronym);
1747
                        addProjectionParameterAcronymList(count,"lon_0");
1748
                        addProjectionParameterAcronymList(count,"x_0");
1749
                        addProjectionParameterAcronymList(count,"y_0");
1750

    
1751
                        String[] parameterDefaultValue={"0.0"};
1752
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1753
                        addProjectionParameterDefaultValue(count,"0.0");
1754
                        addProjectionParameterDefaultValue(count,"0.0");
1755
                        addProjectionParameterDefaultValue(count,"0.0");
1756

    
1757
                        String[] parameterMaxValue={"90.0"};
1758
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1759
                        addProjectionParameterMaxValue(count,"360.0");
1760
                        addProjectionParameterMaxValue(count,"100000000.0");
1761
                        addProjectionParameterMaxValue(count,"100000000.0");
1762

    
1763
                        String[] parameterMinValue={"-90.0"};
1764
                        projectionParameterMinValueList.add(count,parameterMinValue);
1765
                        addProjectionParameterMinValue(count,"-360.0");
1766
                        addProjectionParameterMinValue(count,"-100000000.0");
1767
                        addProjectionParameterMinValue(count,"-100000000.0");
1768

    
1769
                        String[] projectionAcronym={"somerc"};
1770
                        projectionAcronymList.add(count,projectionAcronym);
1771
                }
1772

    
1773
                count++;
1774
                {// Stereographic
1775
                        String[] projectionName={"Stereographic"};
1776
                        projectionNameList.add(count,projectionName);
1777

    
1778
                        String[] parameterName={"latitude_of_origin"};
1779
                        projectionParameterList.add(count,parameterName);
1780
                        addProjectionParameter(count,"central_meridian");
1781
                        addProjectionParameter(count,"scale_factor");
1782
                        addProjectionParameter(count,"false_easting");
1783
                        addProjectionParameter(count,"false_northing");
1784

    
1785
                        String[] parameterAcronym={"lat_0"};
1786
                        projectionParameterAcronymList.add(count,parameterAcronym);
1787
                        addProjectionParameterAcronymList(count,"lon_0");
1788
                        addProjectionParameterAcronymList(count,"k");
1789
                        addProjectionParameterAcronymList(count,"x_0");
1790
                        addProjectionParameterAcronymList(count,"y_0");
1791

    
1792
                        String[] parameterDefaultValue={"0.0"};
1793
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1794
                        addProjectionParameterDefaultValue(count,"0.0");
1795
                        addProjectionParameterDefaultValue(count,"1.0");
1796
                        addProjectionParameterDefaultValue(count,"0.0");
1797
                        addProjectionParameterDefaultValue(count,"0.0");
1798

    
1799
                        String[] parameterMaxValue={"90.0"};
1800
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1801
                        addProjectionParameterMaxValue(count,"360.0");
1802
                        addProjectionParameterMaxValue(count,"10.0");
1803
                        addProjectionParameterMaxValue(count,"100000000.0");
1804
                        addProjectionParameterMaxValue(count,"100000000.0");
1805

    
1806
                        String[] parameterMinValue={"-90.0"};
1807
                        projectionParameterMinValueList.add(count,parameterMinValue);
1808
                        addProjectionParameterMinValue(count,"-360.0");
1809
                        addProjectionParameterMinValue(count,"0.0");
1810
                        addProjectionParameterMinValue(count,"-100000000.0");
1811
                        addProjectionParameterMinValue(count,"-100000000.0");
1812

    
1813
                        String[] projectionAcronym={"stere"};
1814
                        projectionAcronymList.add(count,projectionAcronym);
1815
                }
1816

    
1817
                count++;
1818
                {// Transverse_Mercator
1819
                        String[] projectionName={"Transverse_Mercator"};
1820
                        projectionNameList.add(count,projectionName);
1821
                        addProjectionName(count,"Transverse Mercator");
1822
                        addProjectionName(count,"Gauss-Kruger");
1823
                        addProjectionName(count,"9807");
1824

    
1825
                        String[] parameterName={"latitude_of_origin"};
1826
                        projectionParameterList.add(count,parameterName);
1827
                        addProjectionParameter(count,"central_meridian");
1828
                        addProjectionParameter(count,"scale_factor");
1829
                        addProjectionParameter(count,"false_easting");
1830
                        addProjectionParameter(count,"false_northing");
1831

    
1832
                        String[] parameterAcronym={"lat_0"};
1833
                        projectionParameterAcronymList.add(count,parameterAcronym);
1834
                        addProjectionParameterAcronymList(count,"lon_0");
1835
                        addProjectionParameterAcronymList(count,"k");
1836
                        addProjectionParameterAcronymList(count,"x_0");
1837
                        addProjectionParameterAcronymList(count,"y_0");
1838

    
1839
                        String[] parameterDefaultValue={"0.0"};
1840
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1841
                        addProjectionParameterDefaultValue(count,"0.0");
1842
                        addProjectionParameterDefaultValue(count,"1.0");
1843
                        addProjectionParameterDefaultValue(count,"0.0");
1844
                        addProjectionParameterDefaultValue(count,"0.0");
1845

    
1846
                        String[] parameterMaxValue={"90.0"};
1847
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1848
                        addProjectionParameterMaxValue(count,"360.0");
1849
                        addProjectionParameterMaxValue(count,"10.0");
1850
                        addProjectionParameterMaxValue(count,"100000000.0");
1851
                        addProjectionParameterMaxValue(count,"100000000.0");
1852

    
1853
                        String[] parameterMinValue={"-90.0"};
1854
                        projectionParameterMinValueList.add(count,parameterMinValue);
1855
                        addProjectionParameterMinValue(count,"-360.0");
1856
                        addProjectionParameterMinValue(count,"0.0");
1857
                        addProjectionParameterMinValue(count,"-100000000.0");
1858
                        addProjectionParameterMinValue(count,"-100000000.0");
1859

    
1860
                        String[] projectionAcronym={"tmerc"};
1861
                        projectionAcronymList.add(count,projectionAcronym);
1862
                }
1863

    
1864
                /*
1865
                count++;
1866
                {// Tunisia_Mining_Grid
1867
                        String[] projectionName={"Tunisia_Mining_Gridr"};
1868
                        projectionNameList.add(count,projectionName);
1869
                        addProjectionName(count,"Tunisia Mining Grid");
1870
                        addProjectionName(count,"9816");
1871

1872
                        String[] parameterName={"latitude_of_origin"};
1873
                        projectionParameterList.add(count,parameterName);
1874
                        addProjectionParameter(count,"central_meridian");
1875
                        addProjectionParameter(count,"false_easting");
1876
                        addProjectionParameter(count,"false_northing");
1877

1878
                        String[] parameterAcronym={"lat_0"};
1879
                        projectionParameterAcronymList.add(count,parameterAcronym);
1880
                        addProjectionParameterAcronymList(count,"lon_0");
1881
                        addProjectionParameterAcronymList(count,"x_0");
1882
                        addProjectionParameterAcronymList(count,"y_0");
1883

1884
                        String[] parameterDefaultValue={"0.0"};
1885
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1886
                        addProjectionParameterDefaultValue(count,"0.0");
1887
                        addProjectionParameterDefaultValue(count,"0.0");
1888
                        addProjectionParameterDefaultValue(count,"0.0");
1889

1890
                        String[] parameterMaxValue={"90.0"};
1891
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1892
                        addProjectionParameterMaxValue(count,"360.0");
1893
                        addProjectionParameterMaxValue(count,"100000000.0");
1894
                        addProjectionParameterMaxValue(count,"100000000.0");
1895

1896
                        String[] parameterMinValue={"-90.0"};
1897
                        projectionParameterMinValueList.add(count,parameterMinValue);
1898
                        addProjectionParameterMinValue(count,"-360.0");
1899
                        addProjectionParameterMinValue(count,"-100000000.0");
1900
                        addProjectionParameterMinValue(count,"-100000000.0");
1901

1902
                        String[] projectionAcronym={"cass"};
1903
                        projectionAcronymList.add(count,projectionAcronym);
1904
                }
1905
                */
1906

    
1907
                count++;
1908
                {// VanDerGrinten
1909
                        String[] projectionName={"VanDerGrinten"};
1910
                        projectionNameList.add(count,projectionName);
1911
                        addProjectionName(count,"VanDerGrinten I");
1912

    
1913
                        String[] parameterName={"central_meridian"};
1914
                        projectionParameterList.add(count,parameterName);
1915
                        addProjectionParameter(count,"false_easting");
1916
                        addProjectionParameter(count,"false_northing");
1917

    
1918
                        String[] parameterAcronym={"lon_0"};
1919
                        projectionParameterAcronymList.add(count,parameterAcronym);
1920
                        addProjectionParameterAcronymList(count,"x_0");
1921
                        addProjectionParameterAcronymList(count,"y_0");
1922

    
1923
                        String[] parameterDefaultValue={"0.0"};
1924
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1925
                        addProjectionParameterDefaultValue(count,"0.0");
1926
                        addProjectionParameterDefaultValue(count,"0.0");
1927

    
1928
                        String[] parameterMaxValue={"360.0"};
1929
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1930
                        addProjectionParameterMaxValue(count,"100000000.0");
1931
                        addProjectionParameterMaxValue(count,"100000000.0");
1932

    
1933
                        String[] parameterMinValue={"-360.0"};
1934
                        projectionParameterMinValueList.add(count,parameterMinValue);
1935
                        addProjectionParameterMinValue(count,"-100000000.0");
1936
                        addProjectionParameterMinValue(count,"-100000000.0");
1937

    
1938
                        String[] projectionAcronym={"sinu"};
1939
                        projectionAcronymList.add(count,projectionAcronym);
1940
                }
1941
        }
1942
        
1943
        public void addProjectionName(int pos,String projectionName) throws CrsException
1944
        {
1945
                if(pos<0||pos>(projectionNameList.size()-1))
1946
                        throw new CrsException(new Exception());
1947
                String[] projectionNames=(String[]) projectionNameList.get(pos);
1948
                String[] newProjectionNames=new String[projectionNames.length+1];
1949
                for(int i=0;i<projectionNames.length;i++)
1950
                {
1951
                        newProjectionNames[i]=projectionNames[i];
1952
                }
1953
                newProjectionNames[projectionNames.length]=projectionName;
1954
                projectionNameList.remove(pos);
1955
                projectionNameList.add(pos,newProjectionNames);
1956
        }
1957
        
1958
        public void addUnitName(int pos,String unitName) throws CrsException
1959
        {
1960
                if(pos<0||pos>(unitNameList.size()-1))
1961
                        throw new CrsException(new Exception());
1962
                String[] unitNames=(String[]) unitNameList.get(pos);
1963
                String[] newUnitNames=new String[unitNames.length+1];
1964
                for(int i=0;i<unitNames.length;i++)
1965
                {
1966
                        newUnitNames[i]=unitNames[i];
1967
                }
1968
                newUnitNames[unitNames.length]=unitName;
1969
                unitNameList.remove(pos);
1970
                unitNameList.add(pos,newUnitNames);
1971
        }
1972
        
1973
        public void addProjectionParameterName(int pos,String projectionParameterName) throws CrsException
1974
        {
1975
                if(pos<0||pos>(projectionParameterNameList.size()-1))
1976
                        throw new CrsException(new Exception());
1977
                String[] projectionParameterNames=(String[]) projectionParameterNameList.get(pos);
1978
                String[] newProjectionParameterNames=new String[projectionParameterNames.length+1];
1979
                for(int i=0;i<projectionParameterNames.length;i++)
1980
                {
1981
                        newProjectionParameterNames[i]=projectionParameterNames[i];
1982
                }
1983
                newProjectionParameterNames[projectionParameterNames.length]=projectionParameterName;
1984
                projectionParameterNameList.remove(pos);
1985
                projectionParameterNameList.add(pos,newProjectionParameterNames);
1986
        }
1987
        
1988
        public void addProjectionParameter(int pos,String projectionParameter) throws CrsException
1989
        {
1990
                if(pos<0||pos>(projectionParameterList.size()-1))
1991
                        throw new CrsException(new Exception());
1992
                String[] projectionParameters=(String[]) projectionParameterList.get(pos);
1993
                String[] newProjectionParameters=new String[projectionParameters.length+1];
1994
                for(int i=0;i<projectionParameters.length;i++)
1995
                {
1996
                        newProjectionParameters[i]=projectionParameters[i];
1997
                }
1998
                newProjectionParameters[projectionParameters.length]=projectionParameter;
1999
                projectionParameterList.remove(pos);
2000
                projectionParameterList.add(pos,newProjectionParameters);
2001
        }
2002
        
2003
        public void addProjectionParameterDefaultValue(int pos,String projectionParameterDefaultValue) throws CrsException
2004
        {
2005
                if(pos<0||pos>(projectionParameterDefaultValueList.size()-1))
2006
                        throw new CrsException(new Exception());
2007
                String[] projectionParameterDefaultValues=(String[]) projectionParameterDefaultValueList.get(pos);
2008
                String[] newProjectionParameterDefaultValues=new String[projectionParameterDefaultValues.length+1];
2009
                for(int i=0;i<projectionParameterDefaultValues.length;i++)
2010
                {
2011
                        newProjectionParameterDefaultValues[i]=projectionParameterDefaultValues[i];
2012
                }
2013
                newProjectionParameterDefaultValues[projectionParameterDefaultValues.length]=projectionParameterDefaultValue;
2014
                projectionParameterDefaultValueList.remove(pos);
2015
                projectionParameterDefaultValueList.add(pos,newProjectionParameterDefaultValues);
2016
        }
2017
        
2018
        public void addProjectionParameterMaxValue(int pos,String projectionParameterMaxValue) throws CrsException
2019
        {
2020
                if(pos<0||pos>(projectionParameterMaxValueList.size()-1))
2021
                        throw new CrsException(new Exception());
2022
                String[] projectionParameterMaxValues=(String[]) projectionParameterMaxValueList.get(pos);
2023
                String[] newProjectionParameterMaxValues=new String[projectionParameterMaxValues.length+1];
2024
                for(int i=0;i<projectionParameterMaxValues.length;i++)
2025
                {
2026
                        newProjectionParameterMaxValues[i]=projectionParameterMaxValues[i];
2027
                }
2028
                newProjectionParameterMaxValues[projectionParameterMaxValues.length]=projectionParameterMaxValue;
2029
                projectionParameterMaxValueList.remove(pos);
2030
                projectionParameterMaxValueList.add(pos,newProjectionParameterMaxValues);
2031
        }
2032
        
2033
        public void addProjectionParameterMinValue(int pos,String projectionParameterMinValue) throws CrsException
2034
        {
2035
                if(pos<0||pos>(projectionParameterMinValueList.size()-1))
2036
                        throw new CrsException(new Exception());
2037
                String[] projectionParameterMinValues=(String[]) projectionParameterMinValueList.get(pos);
2038
                String[] newProjectionParameterMinValues=new String[projectionParameterMinValues.length+1];
2039
                for(int i=0;i<projectionParameterMinValues.length;i++)
2040
                {
2041
                        newProjectionParameterMinValues[i]=projectionParameterMinValues[i];
2042
                }
2043
                newProjectionParameterMinValues[projectionParameterMinValues.length]=projectionParameterMinValue;
2044
                projectionParameterMinValueList.remove(pos);
2045
                projectionParameterMinValueList.add(pos,newProjectionParameterMinValues);
2046
        }
2047
        
2048
        public void addProjectionParameterAcronymList(int pos,String projectionParameterAcronym) throws CrsException
2049
        {
2050
                if(pos<0||pos>(projectionParameterAcronymList.size()-1))
2051
                        throw new CrsException(new Exception());
2052
                String[] projectionParameterAcronyms=(String[]) projectionParameterAcronymList.get(pos);
2053
                String[] newProjectionParameterAcronyms=new String[projectionParameterAcronyms.length+1];
2054
                for(int i=0;i<projectionParameterAcronyms.length;i++)
2055
                {
2056
                        newProjectionParameterAcronyms[i]=projectionParameterAcronyms[i];
2057
                }
2058
                newProjectionParameterAcronyms[projectionParameterAcronyms.length]=projectionParameterAcronym;
2059
                projectionParameterAcronymList.remove(pos);
2060
                projectionParameterAcronymList.add(pos,newProjectionParameterAcronyms);
2061
        }
2062
        
2063
        public int findProjection(String projectionName)
2064
        {
2065
                for(int i=0;i<projectionNameList.size();i++)
2066
                {
2067
                        String[] projectionNames=(String[]) projectionNameList.get(i);
2068
                        for(int j=0;j<projectionNames.length;j++)
2069
                        {
2070
                                if(projectionNames[j].toLowerCase().replaceAll(" ","").equals(projectionName.toLowerCase().replaceAll(" ","")))
2071
                                        return i;
2072
                        }
2073
                }
2074
                        
2075
                return -1;
2076
        }
2077
        
2078
        public int findProjectionParameter(String parameterName)
2079
        {
2080
                for(int i=0;i<projectionParameterNameList.size();i++)
2081
                {
2082
                        String[] parameterNames=(String[]) projectionParameterNameList.get(i);
2083
                        for(int j=0;j<parameterNames.length;j++)
2084
                        {
2085
                                if(parameterNames[j].toLowerCase().replaceAll(" ","").equals(parameterName.toLowerCase().replaceAll(" ","")))
2086
                                        return i;
2087
                        }
2088
                }
2089
                        
2090
                return -1;
2091
        }
2092
        
2093
        public int findProjectionParameters(String parameterName1, String parameterName2)
2094
        {
2095
                for(int i=0;i<projectionParameterNameList.size();i++)
2096
                {
2097
                        boolean existsParameter1=false;
2098
                        boolean existsParameter2=false;
2099
                        
2100
                        
2101
                        String[] parameterNames=(String[]) projectionParameterNameList.get(i);
2102
                        if(parameterNames[0].toLowerCase().replaceAll(" ","").equals(parameterName2.toLowerCase().replaceAll(" ","")))
2103
                        {
2104
                                existsParameter2=true;
2105
                                for(int j=0;j<parameterNames.length;j++)
2106
                                {
2107
                                        if(parameterNames[j].toLowerCase().replaceAll(" ","").equals(parameterName1.toLowerCase().replaceAll(" ","")))
2108
                                        {
2109
                                                existsParameter1=true;
2110
                                                break;
2111
                                        }
2112
                                }
2113
                        }
2114
                        if(existsParameter1&&existsParameter2)
2115
                                return i;
2116
                }
2117
                        
2118
                return -1;
2119
        }
2120
        
2121
        public int findUnit(String unitName)
2122
        {
2123
                for(int i=0;i<unitNameList.size();i++)
2124
                {
2125
                        String[] unitNames=(String[]) unitNameList.get(i);
2126
                        for(int j=0;j<unitNames.length;j++)
2127
                        {
2128
                                if(unitNames[j].toLowerCase().replaceAll(" ","").equals(unitName.toLowerCase().replaceAll(" ","")))
2129
                                        return i;
2130
                        }
2131
                }
2132
                        
2133
                return -1;
2134
        }
2135
        
2136
        public String getProj4UnitName(int pos) throws CrsException 
2137
        {
2138
                if(pos<0||pos>(unitNameList.size()-1))
2139
                                throw new CrsException(new Exception());
2140
                return ((String[]) unitNameList.get(pos))[0];
2141
        }
2142
        
2143
        public String getProj4ProjectionName(int pos) throws CrsException 
2144
        {
2145
                if(pos<0||pos>(projectionNameList.size()-1))
2146
                                throw new CrsException(new Exception());
2147
                return ((String[]) projectionNameList.get(pos))[0];
2148
        }
2149
        
2150
        public String getProj4ProjectionParameterName(int pos) throws CrsException 
2151
        {
2152
                // Ojo decir a Jose Luis que quite los parametros del elipsoide
2153
                if(pos<0||pos>(projectionParameterNameList.size()-1))
2154
                                throw new CrsException(new Exception());
2155
                return ((String[]) projectionParameterNameList.get(pos))[0];
2156
        }
2157
        
2158
        public ArrayList getProj4ProjectionParameters(int pos) throws CrsException 
2159
        {
2160
                
2161
                if(pos<0||pos>(projectionParameterList.size()-1))
2162
                                throw new CrsException(new Exception());
2163
                String[] parameterList=(String[])projectionParameterList.get(pos);
2164
                ArrayList parameters=new ArrayList();
2165
                for(int i=0;i<parameterList.length;i++)
2166
                {
2167
                        String parameterName=parameterList[i];
2168
                        int posParameter=findProjectionParameter(parameterName);
2169
                        if(posParameter==-1)
2170
                        {
2171
                                System.out.println("El parametro = "+parameterName+" no esta en la lista de parametros");
2172
                                throw new CrsException(new Exception());
2173
                        }
2174
                        //String parameterNameProj4=getProj4ProjectionParameterName(posParameter);
2175
                        String parameterNameProj4=parameterName;
2176
                        parameters.add(i,parameterNameProj4);
2177
                }
2178
                return parameters;
2179
        }
2180
        
2181
        public ArrayList getProj4ProjectionParameterDefaultValues(int pos) throws CrsException 
2182
        {
2183
                
2184
                if(pos<0||pos>(projectionParameterDefaultValueList.size()-1))
2185
                                throw new CrsException(new Exception());
2186
                String[] parameterDefaultValueList=(String[])projectionParameterDefaultValueList.get(pos);
2187
                ArrayList parameterDefaultValues=new ArrayList();
2188
                for(int i=0;i<parameterDefaultValueList.length;i++)
2189
                {
2190
                        String parameterDefaultValue=parameterDefaultValueList[i];
2191
                        parameterDefaultValues.add(i,parameterDefaultValue);
2192
                }
2193
                return parameterDefaultValues;
2194
        }
2195
        
2196
        public ArrayList getProj4ProjectionParameterMaxValues(int pos) throws CrsException 
2197
        {
2198
                
2199
                if(pos<0||pos>(projectionParameterMaxValueList.size()-1))
2200
                                throw new CrsException(new Exception());
2201
                String[] parameterMaxValueList=(String[])projectionParameterMaxValueList.get(pos);
2202
                ArrayList parameterMaxValues=new ArrayList();
2203
                for(int i=0;i<parameterMaxValueList.length;i++)
2204
                {
2205
                        String parameterMaxValue=parameterMaxValueList[i];
2206
                        parameterMaxValues.add(i,parameterMaxValue);
2207
                }
2208
                return parameterMaxValues;
2209
        }
2210
        
2211
        public ArrayList getProj4ProjectionParameterMinValues(int pos) throws CrsException 
2212
        {
2213
                
2214
                if(pos<0||pos>(projectionParameterMinValueList.size()-1))
2215
                                throw new CrsException(new Exception());
2216
                String[] parameterMinValueList=(String[])projectionParameterMinValueList.get(pos);
2217
                ArrayList parameterMinValues=new ArrayList();
2218
                for(int i=0;i<parameterMinValueList.length;i++)
2219
                {
2220
                        String parameterMinValue=parameterMinValueList[i];
2221
                        parameterMinValues.add(i,parameterMinValue);
2222
                }
2223
                return parameterMinValues;
2224
        }
2225
        
2226
        public ArrayList getProj4ProjectionParameterAcronyms(int pos) throws CrsException 
2227
        {
2228
                
2229
                if(pos<0||pos>(projectionParameterAcronymList.size()-1))
2230
                                throw new CrsException(new Exception());
2231
                String[] parameterAcronymList=(String[])projectionParameterAcronymList.get(pos);
2232
                ArrayList parameterAcronyms=new ArrayList();
2233
                for(int i=0;i<parameterAcronymList.length;i++)
2234
                {
2235
                        String parameterAcronym=parameterAcronymList[i];
2236
                        parameterAcronyms.add(i,parameterAcronym);
2237
                }
2238
                return parameterAcronyms;
2239
        }
2240
        
2241
        public String getProjectionParameterUnitList(int pos) throws CrsException {
2242
                if(pos<0||pos>(projectionParameterUnitList.size()-1))
2243
                        throw new CrsException(new Exception());
2244
                String [] projParamUnit = (String[]) projectionParameterUnitList.get(pos);
2245
                return projParamUnit[0];
2246
        }
2247

    
2248
        public String exportToProj4(Crs crs) throws CrsException
2249
        {
2250
                String strProj4="+proj=";
2251
                String strDatumName="";
2252
                String strDatumCode="";
2253
                String strProj4ToMeter="";
2254
                String strProj4Datum="";
2255
                String[] primeMeridian=crs.getCrsWkt().getPrimen();
2256
                String primeMeridianName=primeMeridian[0];
2257
                double primeMeridianValue=Double.parseDouble(primeMeridian[1]); // -> hacer el cambio de unidades
2258
                String[] strPrimeMeridianProj4=primeMeridianToProj4(primeMeridianName,primeMeridianValue);
2259
                primeMeridianValue=Double.parseDouble(strPrimeMeridianProj4[1]);
2260
                primeMeridianName=strPrimeMeridianProj4[0];
2261
                String primeMeridianAcronym=strPrimeMeridianProj4[2]; // Puede ser cadena vacia->Analizar
2262

    
2263
                // Extracci?n del c?digo de Datum
2264
                String codDatum="0";
2265
                strDatumName=crs.getCrsWkt().getDatumName();
2266
        int intCodDatum=0;//Integer.parseInt(codDatum);
2267
        strProj4Datum=datumToProj4(strDatumName,intCodDatum);
2268
        
2269

    
2270

    
2271
                String strProj=crs.getCrsWkt().getProjcs();
2272
                if(strProj.equals(""))
2273
                {
2274
                        //System.out.println("Projection Name = "+"Geodetic");
2275
                        strProj4+="longlat ";
2276
                }
2277
                else
2278
                {
2279
                // OJO ******************************************
2280
                        /*
2281
                        if(factor_to_meter!=1.0)
2282
                        strProj4ToMeter="+to_meter="+factor_to_meter+" ";
2283
                else
2284
                        strProj4ToMeter="+units=m ";
2285
                */
2286
                        
2287
                        
2288
                        //System.out.println("Projection      = "+strProj);
2289
                        String strProjName=crs.getCrsWkt().getProjection();
2290
                        //System.out.println("Projection Name = "+strProjName);
2291
                        int indexProj=findProjection(strProjName);
2292
                        if(indexProj==-1)
2293
                        {
2294
                                System.out.println("La proyeccion "+strProjName+" no figura en Proj4");
2295
                                throw(new CrsException(new Exception()));
2296
                        }
2297
                        String projectionName=(getProj4ProjectionName(indexProj)).trim();
2298
                        ArrayList parameterNames=getProj4ProjectionParameters(indexProj);
2299
                        ArrayList parameterAcronyms=getProj4ProjectionParameterAcronyms(indexProj);
2300
                        ArrayList parameterValues=getProj4ProjectionParameterDefaultValues(indexProj);
2301
                        ArrayList parameterMaxValues=getProj4ProjectionParameterMaxValues(indexProj);
2302
                        ArrayList parameterMinValues=getProj4ProjectionParameterMinValues(indexProj);
2303
                        //System.out.println("Parametros:"+parameterNames);
2304
                        String[] gtParameterValues=crs.getCrsWkt().getParam_value();
2305
                        String[] gtParameterNames=crs.getCrsWkt().getParam_name();
2306
                        for(int i=0;i<parameterNames.size();i++)
2307
                        {
2308
                                boolean existsParameter=false;
2309
                                String parameterValue="";
2310
                                for(int j=0;j<gtParameterNames.length;j++)
2311
                                {
2312
                                        String gtParameterName=gtParameterNames[j].trim();
2313
                                        //int posGtParameter=findProjectionParameter(gtParameterName);
2314
                                        int posGtParameter=findProjectionParameters(gtParameterName,(String)parameterNames.get(i));
2315
                                        //int posParameter=findProjectionParameter((String)parameterNames.get(i));
2316
                                        //if(((String)parameterNames.get(i)).trim().equals(gtParameterNames[j].trim()))
2317
                                        if(posGtParameter!=-1)
2318
                                        {
2319
                                                gtParameterName=getProj4ProjectionParameterName(posGtParameter);
2320
                                                gtParameterNames[j]=gtParameterName;
2321
                                                existsParameter=true;
2322
                                                double maxValue=Double.parseDouble((String)parameterMaxValues.get(i));
2323
                                                double minValue=Double.parseDouble((String)parameterMinValues.get(i));
2324
                                                //parameterValue=Double.parseDouble(gtParameterValues[j]);
2325
                                                parameterValue=gtParameterValues[j]; // Ojo unidades -> analizar
2326
                                                double auxValue=Double.parseDouble(parameterValue);
2327
                                                if((auxValue<minValue)||(auxValue>maxValue))
2328
                                                {
2329
                                                        String strError="El parametro ";
2330
                                                        strError+=gtParameterName;
2331
                                                        strError+=" esta fuera de dominio";
2332
                                                        System.out.println(strError);
2333
                                                        throw new CrsException(new Exception());
2334
                                                }
2335
                                                else if (((String)parameterNames.get(i)).trim().equals("scale_factor") && (auxValue==minValue)) {
2336
                                                        String strError="El parametro ";
2337
                                                        strError+=gtParameterName;
2338
                                                        strError+=" esta fuera de dominio";
2339
                                                        System.out.println(strError);
2340
                                                        throw new CrsException(new Exception());
2341
                                                }
2342
                                                break;
2343
                                        }
2344
                                        /*else
2345
                                        {
2346
                                                String strError="El parametro recibido de GeoTools";
2347
                                                strError+=gtParameterName;
2348
                                                strError+=" no esta contemplado en la proyeccion";
2349
                                                System.out.println(strError);
2350
                                                throw new CrsException(new Exception());
2351
                                        }*/
2352
                                }
2353
                                if(existsParameter)
2354
                                {
2355
                                        parameterValues.set(i,parameterValue);
2356
                                        //System.out.println("- Parametro["+parameterNames.get(i)+"]="+parameterValue);
2357
                                }
2358
                                /*
2359
                                else
2360
                                {
2361
                                        value=Double.parseDouble((String)parameterDefaultValues.get(i));
2362
                                        System.out.println("El parametro "+parameterNames.get(i)+" no figura en la lista geotools");
2363
                                        throw(new CrsException(new Exception()));
2364
                                }
2365
                                */
2366
                        }
2367
                        boolean isSomerc=false;
2368
                        boolean isOmerc=false;
2369
                        double valueAlpha=0;
2370
                        double valueGamma=0;
2371
                        boolean existsAlpha=false;
2372
                        boolean existsGamma=false;
2373
                        String[] projectionAcronym=(String[])projectionAcronymList.get(indexProj);
2374
                        if(projectionName.equals("Oblique_Mercator"))
2375
                        {
2376
                                isOmerc=true;
2377
                                for(int j=0;j<gtParameterNames.length;j++)
2378
                                {
2379
                                        String gtParameterName=gtParameterNames[j].trim();
2380
                                        if(gtParameterName.equalsIgnoreCase("azimuth"))
2381
                                        {
2382
                                                valueAlpha=Double.parseDouble(gtParameterValues[j]);
2383
                                                existsAlpha=true;
2384
                                        }
2385
                                        if(gtParameterName.equalsIgnoreCase("rectified_grid_angle"))
2386
                                        {
2387
                                                valueGamma=Double.parseDouble(gtParameterValues[j]);
2388
                                                existsGamma=true;
2389
                                        }
2390
                                }
2391
                                if(existsAlpha&&existsGamma)
2392
                                {
2393
                                        if(Math.abs(valueAlpha-valueGamma)>0.00000001)
2394
                                        {
2395
                                                String strError="En proj4 la proyeccion no admite azimut y giro de ejes diferentes";
2396
                                                throw new CrsException(new Exception(strError));
2397
                                        }
2398
                                }
2399
                                
2400
                                // Necesito buscar un caso de ejemplo
2401
                        }
2402
                        strProj4=strProj4+projectionAcronym[0]+" ";
2403
                        String strExtraProj4="";
2404
                        // Control de casos especiales
2405
                        boolean isLaborde=false;
2406
                        boolean isMerc=false;
2407
                        boolean exists_sf=false;
2408
                        boolean exists_lo=false;
2409
                        boolean isSterePolar=false;
2410
                        boolean exists_stdPar=false;
2411
                        double value_stdPar=0.0;
2412
                        if(projectionAcronym[0].equals("merc")) // 1 - Mercator
2413
                        {
2414
                                isMerc=true;
2415
                                double value_sf=0.0;
2416
                                double value_lo=0.0;
2417
                                for(int j=0;j<gtParameterNames.length;j++)
2418
                                {
2419
                                        String gtParameterName=gtParameterNames[j].trim();
2420
                                        if(gtParameterName.equalsIgnoreCase("latitude_of_origin")
2421
                                                        ||gtParameterName.equalsIgnoreCase("standard_parallel_1")
2422
                                                        ||gtParameterName.equalsIgnoreCase("latitude_of_center"))
2423
                                        {
2424
                                                exists_lo=true;
2425
                                                value_lo=Double.parseDouble(gtParameterValues[j]);
2426
                                        }
2427
                                        if(gtParameterName.equalsIgnoreCase("scale_factor"))
2428
                                        {
2429
                                                exists_sf=true;
2430
                                                value_sf=Double.parseDouble(gtParameterValues[j]);
2431
                                        }
2432
                                }
2433
                                if(exists_sf&&exists_lo)
2434
                                {
2435
                                        if(value_sf!=1.0&&value_lo!=0.0)
2436
                                        {
2437
                                                String strError="La proyeccion mercator no admite scale_factor!=1.0 y latitude_of_origin!=0.0";
2438
                                                System.out.println(strError);
2439
                                                throw new CrsException(new Exception());
2440
                                        }
2441
                                        else if(projectionName.equals("Mercator_1SP"))
2442
                                                exists_lo=false;
2443
                                        else if(projectionName.equals("Mercator_2SP"))
2444
                                                exists_sf=false;
2445
                                        /*
2446
                                        else if(value_sf!=1.0)
2447
                                                exists_lo=false;
2448
                                        else if(value_sf==1.0)
2449
                                                exists_sf=false;
2450
                                        */
2451
                                }
2452
                        }
2453
                        else if(projectionAcronym[0].equals("stere"))
2454
                        {
2455
                                if(projectionName.equalsIgnoreCase("Polar_Stereographic")) // lat_ts=lat_0={90 o -90)
2456
                                {
2457
                                        isSterePolar=true;
2458
                                        for(int j=0;j<gtParameterNames.length;j++)
2459
                                        {
2460
                                                String gtParameterName=gtParameterNames[j].trim();
2461
                                                if(gtParameterName.equalsIgnoreCase("scale_factor"))
2462
                                                {
2463
                                                        double value_sf=Double.parseDouble(gtParameterValues[j]);
2464
                                                        if(Math.abs(value_sf-1.0)>0.000001)
2465
                                                                exists_sf=true;
2466
                                                }
2467
                                                if(gtParameterName.equalsIgnoreCase("latitude_of_standard_parallel"))
2468
                                                {
2469
                                                        value_stdPar=Double.parseDouble(gtParameterValues[j]);
2470
                                                        exists_stdPar=true;
2471
                                                }
2472
                                                
2473
                                        }
2474
                                }
2475
                                
2476
                                /*
2477
                                boolean isNorthPole=true;
2478
                                        boolean sterePolarLatts=false;
2479
                                        for(int j=0;j<gtParameterNames.length;j++)
2480
                                        {
2481
                                                String gtParameterAcronymn=((String)parameterAcronyms.get(j)).trim();
2482
                                                if(gtParameterAcronymn.equalsIgnoreCase("lat_0"))
2483
                                                {
2484
                                                        double gtParameterValue=Double.parseDouble(gtParameterValues[j]);
2485
                                                        if(Math.abs(gtParameterValue-90.0)<angularTolerance) isNorthPole=true;
2486
                                                        else if(Math.abs(gtParameterValue-(-90.0))<angularTolerance)  isNorthPole=false;
2487
                                                        else
2488
                                                        {
2489
                                                                String strError="La proyeccin estereogrfica polar debe tener latitud origen 90 o -90";
2490
                                                                System.out.println(strError);
2491
                                                                throw new CrsException(new Exception());
2492
                                                        }
2493
                                                        break;
2494
                                                }else if{
2495
                                                        
2496
                                                }
2497
                                        }
2498
                                        String strLatitudeOrigin="90.0";
2499
                                        if(!isNorthPole) strLatitudeOrigin="-90.0";
2500
                                        for(int k=0;k<parameterNames.size();k++)
2501
                                        {
2502
                                                String parameterName=(String)parameterNames.get(k);
2503
                                                if(parameterName.equalsIgnoreCase("latitude_of_origin"))
2504
                                                {
2505
                                                        parameterValues.set(k,strLatitudeOrigin);
2506
                                                }
2507
                                        }
2508
                                }
2509
                                */
2510
                        }
2511
                        else if(projectionAcronym[0].equals("omerc"))
2512
                        {
2513
                                boolean existsLat1=false;
2514
                                boolean existsLat2=false;
2515
                                boolean existsLon1=false;
2516
                                boolean existsLon2=false;
2517
                                // Necesito buscar un caso de ejemplo
2518
                        }
2519
                        else if(projectionAcronym[0].equals("mill"))
2520
                        {
2521
                                strExtraProj4="+R_A ";
2522
                        }
2523
                        else if(projectionAcronym[0].equals("vandg"))
2524
                        {
2525
                                strExtraProj4="+R_A ";
2526
                        }
2527
                        else if(projectionAcronym[0].equals("labrd"))
2528
                        {
2529
                                isLaborde=true;
2530
                        }
2531
                        
2532
                        for(int i=0;i<parameterNames.size();i++)
2533
                        {
2534
                                boolean control=true;
2535
                                String parameterName=((String)parameterNames.get(i)).trim();
2536
                                String parameterAcronym=((String)parameterAcronyms.get(i)).trim();
2537
                                String strParameterValue=((String)parameterValues.get(i)).trim();
2538
                                if(isMerc)
2539
                                {
2540
                                        if(parameterName.equalsIgnoreCase("latitude_of_origin")
2541
                                                        ||parameterName.equalsIgnoreCase("standard_parallel_1")
2542
                                                        ||parameterName.equalsIgnoreCase("latitude_of_center"))
2543
                                        {
2544
                                                if(!exists_lo)
2545
                                                        control=false;
2546
                                        }
2547
                                        if(parameterName.equalsIgnoreCase("scale_factor"))
2548
                                        {
2549
                                                if(!exists_sf)
2550
                                                        control=false;
2551
                                        }
2552
                                }
2553
                                if(isSterePolar)
2554
                                {
2555
                                        String gtParameterAcronymn=((String)parameterAcronyms.get(i)).trim();
2556
                                        if(gtParameterAcronymn.equalsIgnoreCase("lat_0")) // Esto resuelve el caso del EPSG:3031
2557
                                        {
2558
                                                if(exists_stdPar){
2559
                                                        double parameterValue=Double.parseDouble(strParameterValue);
2560
                                                        if((parameterValue>0)&&(value_stdPar<0)){
2561
                                                                strParameterValue="-90.0";
2562
                                                        }
2563
                                                        if((parameterValue<0)&&(value_stdPar>0)){
2564
                                                                strParameterValue="90.0";
2565
                                                        }
2566
                                                }
2567
                                        }
2568
                                        
2569
                                        if(gtParameterAcronymn.equalsIgnoreCase("lat_ts"))
2570
                                        {
2571
                                                if(exists_sf)
2572
                                                        control=false;
2573
                                        }
2574
                                        if(parameterName.equalsIgnoreCase("scale_factor"))
2575
                                        {
2576
                                                if(!exists_sf)
2577
                                                        control=false;
2578
                                        }
2579
                                }
2580
                                if(isSomerc)
2581
                                {
2582
                                        if(parameterName.equals("rectified_grid_angle"))
2583
                                                control=false;
2584
                                        if(parameterName.equals("azimuth"))
2585
                                                control=false;
2586
                                }
2587
                                if(isOmerc)
2588
                                {
2589
                                        if(parameterName.equals("rectified_grid_angle"))
2590
                                        {
2591
                                                if(existsAlpha)
2592
                                                        control=false;
2593
                                                else
2594
                                                        parameterAcronym="alpha";
2595
                                        }
2596
                                }
2597
                                if(parameterAcronym.equals("lon_0")
2598
                                                ||parameterAcronym.equals("lonc"))
2599
                                {
2600
                                        double parameterValue=Double.parseDouble(strParameterValue);
2601
                                        parameterValue=parameterValue-primeMeridianValue;
2602
                                        strParameterValue=Double.toString(parameterValue);
2603
                                }
2604
                                if(control)
2605
                                        strProj4=strProj4+"+"+parameterAcronym+"="+strParameterValue+" ";
2606
                        }
2607
                        if(isLaborde)
2608
                                strProj4+="+azi=18.9 +lat_0=-18.9 +lon_0=44.1 +k_0=0.9995 +x_0=400000 +y_0=800000 +ellps=intl ";
2609
                        strProj4+=strExtraProj4;
2610
                        //getProj4ProjectionName();
2611
                }
2612
                
2613
                // Que pasa si no hay elipsoide? -> OGR por defecto pone WGS84
2614
                double a=0;
2615
                double inv_f=0;
2616
                String elipName=crs.getCrsWkt().getSpheroid()[0];
2617
                a=Double.parseDouble(crs.getCrsWkt().getSpheroid()[1]);
2618
                inv_f=Double.parseDouble(crs.getCrsWkt().getSpheroid()[2]);
2619
                String strEllipseAcronym=ellipseToProj4(a,inv_f);
2620
                String strEllipse="";
2621
                if(strEllipseAcronym.equals(""))
2622
                {
2623
                        if (!Double.isInfinite(inv_f))
2624
                                strEllipse="+a="+a+" +rf="+inv_f+" ";
2625
                        else
2626
                                strEllipse="+R="+a+" ";
2627
                }
2628
                else
2629
                {
2630
                        strEllipse="+ellps="+strEllipseAcronym+" ";
2631
                }
2632
                strProj4+=strEllipse;
2633
                //System.out.println("Elipsoide["+elipName+"]=("+a+","+inv_f+")");
2634
                if(!strProj4Datum.equals(""))
2635
                {
2636
                        strProj4+=strProj4Datum;
2637
                }
2638
                strProj4+=primeMeridianAcronym;
2639
                String strWkt=crs.getWKT();
2640
                if(!strProj4ToMeter.equals(""))
2641
                        strProj4+=strProj4ToMeter;
2642
                
2643
                //System.out.println("- Cadena proj4: "+strProj4);
2644
                return strProj4;                
2645
        }
2646
                
2647
        public String exportToProj4(CoordinateReferenceSystem crs) throws CrsException
2648
        {
2649
                String strProj4="+proj=";
2650
                String[] primeMeridian = new String[2];
2651
                String strProj="";
2652
                String strProjName="";
2653
                String strDatumName="";
2654
                String strDatumCode="";
2655
                String strProj4Datum="";
2656
                String strProj4ToMeter="";
2657
                String[] gtParameterValues=new String[1];
2658
                String[] gtParameterNames= new String[1];
2659
                String[] spheroid = new String[3];
2660
                double a=0;
2661
                double inv_f=0;
2662
                String elipName="";
2663
                if (crs instanceof DefaultProjectedCRS) {
2664
                        DefaultProjectedCRS crsProjected = (DefaultProjectedCRS) crs;
2665
                        primeMeridian = Primem(((DefaultGeodeticDatum) crsProjected.getDatum()).getPrimeMeridian());
2666
                        strProj = crsProjected.getName().toString().split(":")[1];
2667
                        strProjName = getName(crsProjected.getConversionFromBase().getMethod().getName());
2668
                        gtParameterValues = new String[crsProjected.getConversionFromBase().getParameterValues().values().size()];
2669
                        gtParameterNames = new String[crsProjected.getConversionFromBase().getParameterValues().values().size()];
2670
                        String str;
2671
                        for (int i=0; i< crsProjected.getConversionFromBase().getParameterValues().values().size();i++) {
2672
                                str = crsProjected.getConversionFromBase().getParameterValues().values().get(i).toString();
2673
                                Unit u = crsProjected.getConversionFromBase().getParameterValues().parameter(str.split("=")[0]).getUnit();
2674
                                double value = crsProjected.getConversionFromBase().getParameterValues().parameter(str.split("=")[0]).doubleValue();
2675
                                value = convert(value, u.toString());
2676
                                gtParameterNames[i] = str.split("=")[0];
2677
                                gtParameterValues [i] = String.valueOf(value);
2678
                        }
2679
                        spheroid = Spheroid(((DefaultGeodeticDatum) crsProjected.getDatum()).getEllipsoid());
2680
                        elipName=spheroid[0];
2681
                        a=Double.parseDouble(spheroid[1]);
2682
                        inv_f=Double.parseDouble(spheroid[2]);
2683
                        // Extracci?n del c?digo de Datum
2684
                        String codDatum="0";
2685
                        String[] val=((DefaultProjectedCRS)crs).getDatum().getName().toString().split(":");
2686
                        if (val.length<2)
2687
                                strDatumName=val[0];
2688
                        else
2689
                                strDatumName=val[1];
2690
                for (Iterator iter =((DefaultProjectedCRS)crs).getDatum().getIdentifiers().iterator();iter.hasNext();) {
2691
                    Identifier element = (Identifier) iter.next();
2692
                    codDatum = element.getCode();          
2693
                }
2694
                int intCodDatum=Integer.parseInt(codDatum);
2695
                strProj4Datum=datumToProj4(strDatumName,intCodDatum);
2696
                double factor_to_meter=1.0;
2697
                Unit u = crs.getCoordinateSystem().getAxis(0).getUnit();
2698
                String[] un = u.toString().split("[*]");
2699
                if (un.length>1)
2700
                {
2701
                        try{
2702
                                factor_to_meter=Double.parseDouble(un[1].replaceAll("]", ""));
2703
                        }
2704
                        catch(java.lang.NumberFormatException t){}
2705
                }
2706
                else
2707
                {
2708
                        try{
2709
                                factor_to_meter=Double.parseDouble(un[0]);
2710
                        }
2711
                        catch(java.lang.NumberFormatException t){}
2712
                }
2713
                if(factor_to_meter!=1.0)
2714
                        strProj4ToMeter="+to_meter="+factor_to_meter+" ";
2715
                else
2716
                        strProj4ToMeter="+units=m ";
2717

    
2718
                }
2719
                else if (crs instanceof DefaultGeographicCRS) {
2720
                        DefaultGeographicCRS crsGeographic = (DefaultGeographicCRS) crs;
2721
                        primeMeridian = Primem(((DefaultGeodeticDatum) crsGeographic.getDatum()).getPrimeMeridian());
2722
                        spheroid = Spheroid(((DefaultGeodeticDatum) crsGeographic.getDatum()).getEllipsoid());
2723
                        elipName=spheroid[0];
2724
                        a=Double.parseDouble(spheroid[1]);
2725
                        inv_f=Double.parseDouble(spheroid[2]);
2726
                        // Extracci?n del c?digo de Datum
2727
                        String codDatum="0";
2728
                        String[] val=((DefaultGeographicCRS)crs).getDatum().getName().toString().split(":");
2729
                        if (val.length<2)
2730
                                strDatumName=val[0];
2731
                        else
2732
                                strDatumName=val[1];
2733
                for (Iterator iter =((DefaultGeographicCRS)crs).getDatum().getIdentifiers().iterator();iter.hasNext();) {
2734
                    Identifier element = (Identifier) iter.next();
2735
                    codDatum = element.getCode();          
2736
                }
2737
                int intCodDatum=Integer.parseInt(codDatum);
2738
                strProj4Datum=datumToProj4(strDatumName,intCodDatum);
2739
                }
2740
                else {
2741
                        throw(new CrsException(new Exception("El CRS no es ni geogr?fico ni proyectado")));
2742
                }
2743
                
2744
                String primeMeridianName=primeMeridian[0];
2745
                double primeMeridianValue = -1;
2746
                if (primeMeridian[1] == null) {
2747
                        throw(new CrsException(new Exception("Falla algun parametro del prime meridian")));
2748
                } else {
2749
                        primeMeridianValue=Double.parseDouble(primeMeridian[1]); // -> hacer el cambio de unidades
2750
                }                
2751
                String[] strPrimeMeridianProj4=primeMeridianToProj4(primeMeridianName,primeMeridianValue);
2752
                primeMeridianValue=Double.parseDouble(strPrimeMeridianProj4[1]);
2753
                primeMeridianName=strPrimeMeridianProj4[0];
2754
                String primeMeridianAcronym=strPrimeMeridianProj4[2]; // Puede ser cadena vacia->Analizar
2755

    
2756
                if(strProj.equals(""))
2757
                {
2758
                        //System.out.println("Projection Name = "+"Geodetic");
2759
                        strProj4+="longlat ";
2760
                }
2761
                else
2762
                {
2763
                        int indexProj=findProjection(strProjName);
2764
                        if(indexProj==-1)
2765
                        {
2766
                                System.out.println("La proyeccion "+strProjName+" no figura en Proj4");
2767
                                throw(new CrsException(new Exception("La proyeccion "+strProjName+" no figura en Proj4")));
2768
                        }
2769
                        String projectionName=(getProj4ProjectionName(indexProj)).trim();
2770
                        ArrayList parameterNames=getProj4ProjectionParameters(indexProj);
2771
                        ArrayList parameterAcronyms=getProj4ProjectionParameterAcronyms(indexProj);
2772
                        ArrayList parameterValues=getProj4ProjectionParameterDefaultValues(indexProj);
2773
                        ArrayList parameterMaxValues=getProj4ProjectionParameterMaxValues(indexProj);
2774
                        ArrayList parameterMinValues=getProj4ProjectionParameterMinValues(indexProj);
2775
                        for(int i=0;i<parameterNames.size();i++)
2776
                        {
2777
                                boolean existsParameter=false;
2778
                                String parameterValue="";
2779
                                for(int j=0;j<gtParameterNames.length;j++)
2780
                                {
2781
                                        String gtParameterName=gtParameterNames[j].trim();
2782
                                        //System.out.println( gtParameterName);
2783
                                        //int posGtParameter=findProjectionParameter(gtParameterName);
2784
                                        int posGtParameter=findProjectionParameters(gtParameterName,(String)parameterNames.get(i));
2785
                                        //int posParameter=findProjectionParameter((String)parameterNames.get(i));
2786
                                        //if(((String)parameterNames.get(i)).trim().equals(gtParameterNames[j].trim()))
2787
                                        if(posGtParameter!=-1)
2788
                                        {
2789
                                                gtParameterName=getProj4ProjectionParameterName(posGtParameter);
2790
                                                gtParameterNames[j]=gtParameterName;
2791
                                                existsParameter=true;
2792
                                                double maxValue=Double.parseDouble((String)parameterMaxValues.get(i));
2793
                                                double minValue=Double.parseDouble((String)parameterMinValues.get(i));
2794
                                                //parameterValue=Double.parseDouble(gtParameterValues[j]);
2795
                                                parameterValue=gtParameterValues[j]; // Ojo unidades -> analizar
2796
                                                double auxValue=Double.parseDouble(parameterValue);
2797
                                                if((auxValue<minValue)||(auxValue>maxValue))
2798
                                                {
2799
                                                        String strError="El parametro ";
2800
                                                        strError+=gtParameterName;
2801
                                                        strError+=" esta fuera de dominio";
2802
                                                        System.out.println(strError);
2803
                                                        throw new CrsException(new Exception());
2804
                                                }
2805
                                                else if (((String)parameterNames.get(i)).trim().equals("scale_factor") && (auxValue==minValue)) {
2806
                                                        String strError="El parametro ";
2807
                                                        strError+=gtParameterName;
2808
                                                        strError+=" esta fuera de dominio";
2809
                                                        System.out.println(strError);
2810
                                                        throw new CrsException(new Exception());
2811
                                                }
2812
                                                break;
2813
                                        }
2814
                                        /*else
2815
                                        {
2816
                                                String strError="El parametro recibido de GeoTools ";
2817
                                                strError+=gtParameterName;
2818
                                                strError+=" no esta contemplado en la proyeccion";
2819
                                                System.out.println(strError);
2820
                                                throw new CrsException(new Exception());
2821
                                        }*/
2822
                                }
2823
                                if(existsParameter)
2824
                                {
2825
                                        parameterValues.set(i,parameterValue);
2826
                                }                        
2827
                        }
2828
                        boolean isSomerc=false;
2829
                        boolean isOmerc=false;
2830
                        double valueAlpha=0;
2831
                        double valueGamma=0;
2832
                        boolean existsAlpha=false;
2833
                        boolean existsGamma=false;
2834
                        String[] projectionAcronym=(String[])projectionAcronymList.get(indexProj);
2835
                        if(projectionName.equals("Oblique_Mercator"))
2836
                        {
2837
                                isOmerc=true;
2838
                                for(int j=0;j<gtParameterNames.length;j++)
2839
                                {
2840
                                        String gtParameterName=gtParameterNames[j].trim();
2841
                                        if(gtParameterName.equalsIgnoreCase("azimuth"))
2842
                                        {
2843
                                                valueAlpha=Double.parseDouble(gtParameterValues[j]);
2844
                                                existsAlpha=true;
2845
                                        }
2846
                                        if(gtParameterName.equalsIgnoreCase("rectified_grid_angle"))
2847
                                        {
2848
                                                valueGamma=Double.parseDouble(gtParameterValues[j]);
2849
                                                existsGamma=true;
2850
                                        }
2851
                                }
2852
                                if(existsAlpha&&existsGamma)
2853
                                {
2854
                                        if(Math.abs(valueAlpha-valueGamma)>0.00000001)
2855
                                        {
2856
                                                String strError="En proj4 la proyeccion no admite azimut y giro de ejes diferentes";
2857
                                                System.out.println(strError);
2858
                                                throw new CrsException(new Exception());
2859
                                        }
2860
                                }
2861
                                
2862
                                // Necesito buscar un caso de ejemplo
2863
                        }
2864
                        strProj4=strProj4+projectionAcronym[0]+" ";
2865
                        String strExtraProj4="";
2866
                        // Control de casos especiales
2867
                        boolean isLaborde=false;
2868
                        boolean isMerc=false;
2869
                        boolean exists_sf=false;
2870
                        boolean exists_lo=false;
2871
                        boolean isSterePolar=false;
2872
                        boolean exists_stdPar=false;
2873
                        double value_stdPar=0.0;
2874
                        if(projectionAcronym[0].equals("merc")) // 1 - Mercator
2875
                        {
2876
                                isMerc=true;
2877
                                double value_sf=0.0;
2878
                                double value_lo=0.0;
2879
                                for(int j=0;j<gtParameterNames.length;j++)
2880
                                {
2881
                                        String gtParameterName=gtParameterNames[j].trim();
2882
                                        if(gtParameterName.equalsIgnoreCase("latitude_of_origin")
2883
                                                        ||gtParameterName.equalsIgnoreCase("standard_parallel_1")
2884
                                                        ||gtParameterName.equalsIgnoreCase("latitude_of_center"))
2885
                                        {
2886
                                                exists_lo=true;
2887
                                                value_lo=Double.parseDouble(gtParameterValues[j]);
2888
                                        }
2889
                                        if(gtParameterName.equalsIgnoreCase("scale_factor"))
2890
                                        {
2891
                                                exists_sf=true;
2892
                                                value_sf=Double.parseDouble(gtParameterValues[j]);
2893
                                        }
2894
                                }
2895
                                if(exists_sf&&exists_lo)
2896
                                {
2897
                                        if(value_sf!=1.0&&value_lo!=0.0)
2898
                                        {
2899
                                                String strError="La proyeccion mercator no admite scale_factor!=1.0 y latittude_of_origin!=0.0";
2900
                                                System.out.println(strError);
2901
                                                throw new CrsException(new Exception());
2902
                                        }
2903
                                        else if(projectionName.equals("Mercator_1SP"))
2904
                                                exists_lo=false;
2905
                                        else if(projectionName.equals("Mercator_2SP"))
2906
                                                exists_sf=false;
2907
                                        /*
2908
                                        else if(value_sf!=1.0)
2909
                                                exists_lo=false;
2910
                                        else if(value_sf==1.0)
2911
                                                exists_sf=false;
2912
                                        */
2913
                                }
2914
                        }
2915
                        else if(projectionAcronym[0].equals("stere"))
2916
                        {
2917
                                if(projectionName.equalsIgnoreCase("Polar_Stereographic")) // lat_ts=lat_0={90 o -90)
2918
                                {
2919
                                        isSterePolar=true;
2920
                                        for(int j=0;j<gtParameterNames.length;j++)
2921
                                        {
2922
                                                String gtParameterName=gtParameterNames[j].trim();
2923
                                                if(gtParameterName.equalsIgnoreCase("scale_factor"))
2924
                                                {
2925
                                                        double value_sf=Double.parseDouble(gtParameterValues[j]);
2926
                                                        if(Math.abs(value_sf-1.0)>0.000001)
2927
                                                                exists_sf=true;
2928
                                                }
2929
                                                if(gtParameterName.equalsIgnoreCase("latitude_of_standard_parallel"))
2930
                                                {
2931
                                                        value_stdPar=Double.parseDouble(gtParameterValues[j]);
2932
                                                        exists_stdPar=true;
2933
                                                }
2934
                                        }
2935
                                }
2936
                        }
2937
                        /*
2938
                        else if(projectionAcronym[0].equals("stere"))
2939
                        {
2940
                                if(projectionName.equalsIgnoreCase("Polar_Stereographic")) // lat_ts=lat_0={90 o -90)
2941
                                {
2942
                                        boolean isNorthPole=true;
2943
                                        for(int j=0;j<gtParameterNames.length;j++)
2944
                                        {
2945
                                                String gtParameterName=gtParameterNames[j].trim();
2946
                                                if(gtParameterName.equalsIgnoreCase("latitude_of_origin"))
2947
                                                {
2948
                                                        double gtParameterValue=Double.parseDouble(gtParameterValues[j]);
2949
                                                        if(gtParameterValue==90.0) isNorthPole=true;
2950
                                                        else if(gtParameterValue==-90.0)  isNorthPole=false;
2951
                                                        else
2952
                                                        {
2953
                                                                String strError="La proyeccin estereogrfica polar debe tener latitud origen 90 o -90";
2954
                                                                System.out.println(strError);
2955
                                                                throw new CrsException(new Exception());
2956
                                                        }
2957
                                                        break;
2958
                                                }
2959
                                        }
2960
                                        String strLatitudeOrigin="90.0";
2961
                                        if(!isNorthPole) strLatitudeOrigin="-90.0";
2962
                                        for(int k=0;k<parameterNames.size();k++)
2963
                                        {
2964
                                                String parameterName=(String)parameterNames.get(k);
2965
                                                if(parameterName.equalsIgnoreCase("latitude_of_origin"))
2966
                                                {
2967
                                                        parameterValues.set(k,strLatitudeOrigin);
2968
                                                }
2969
                                        }
2970
                                }
2971
                        }
2972
                        */
2973
                        else if(projectionAcronym[0].equals("mill"))
2974
                        {
2975
                                strExtraProj4="+R_A ";
2976
                        }
2977
                        else if(projectionAcronym[0].equals("vandg"))
2978
                        {
2979
                                strExtraProj4="+R_A ";
2980
                        }
2981
                        else if(projectionAcronym[0].equals("labrd"))
2982
                        {
2983
                                isLaborde=true;
2984
                        }
2985
                        
2986
                        
2987
                        for(int i=0;i<parameterNames.size();i++)
2988
                        {
2989
                                boolean control=true;
2990
                                String parameterName=((String)parameterNames.get(i)).trim();
2991
                                String parameterAcronym=((String)parameterAcronyms.get(i)).trim();
2992
                                String strParameterValue=((String)parameterValues.get(i)).trim();
2993
                                if(isMerc)
2994
                                {
2995
                                        if(parameterName.equalsIgnoreCase("latitude_of_origin")
2996
                                                        ||parameterName.equalsIgnoreCase("standard_parallel_1")
2997
                                                        ||parameterName.equalsIgnoreCase("latitude_of_center"))
2998
                                        {
2999
                                                if(!exists_lo)
3000
                                                        control=false;
3001
                                        }
3002
                                        if(parameterName.equalsIgnoreCase("scale_factor"))
3003
                                        {
3004
                                                if(!exists_sf)
3005
                                                        control=false;
3006
                                        }
3007
                                }
3008
                                if(isSterePolar)
3009
                                {
3010
                                        String gtParameterAcronymn=((String)parameterAcronyms.get(i)).trim();
3011
                                        if(gtParameterAcronymn.equalsIgnoreCase("lat_0")) // Esto resuelve el caso del EPSG:3031
3012
                                        {
3013
                                                if(exists_stdPar){
3014
                                                        double parameterValue=Double.parseDouble(strParameterValue);
3015
                                                        if((parameterValue>0)&&(value_stdPar<0)){
3016
                                                                strParameterValue="-90.0";
3017
                                                        }
3018
                                                        if((parameterValue<0)&&(value_stdPar>0)){
3019
                                                                strParameterValue="90.0";
3020
                                                        }
3021
                                                }
3022
                                        }
3023
                                        if(gtParameterAcronymn.equalsIgnoreCase("lat_ts"))
3024
                                        {
3025
                                                if(exists_sf)
3026
                                                        control=false;
3027
                                        }
3028
                                        if(parameterName.equalsIgnoreCase("scale_factor"))
3029
                                        {
3030
                                                if(!exists_sf)
3031
                                                        control=false;
3032
                                        }
3033
                                }
3034
                                if(isSomerc)
3035
                                {
3036
                                        if(parameterName.equals("rectified_grid_angle"))
3037
                                                control=false;
3038
                                        if(parameterName.equals("azimuth"))
3039
                                                control=false;
3040
                                }
3041
                                if(isOmerc)
3042
                                {
3043
                                        if(parameterName.equals("rectified_grid_angle"))
3044
                                        {
3045
                                                if(existsAlpha)
3046
                                                        control=false;
3047
                                                else
3048
                                                        parameterAcronym="alpha";
3049
                                        }
3050
                                }
3051
                                if(parameterAcronym.equals("lon_0")
3052
                                                ||parameterAcronym.equals("lonc"))
3053
                                {
3054
                                        double parameterValue=Double.parseDouble(strParameterValue);
3055
                                        parameterValue=parameterValue-primeMeridianValue;
3056
                                        strParameterValue=Double.toString(parameterValue);
3057
                                }
3058
                                if(control)
3059
                                        strProj4=strProj4+"+"+parameterAcronym+"="+strParameterValue+" ";
3060
                        }
3061
                        if(isLaborde)
3062
                                strProj4+="+azi=18.9 +lat_0=-18.9 +lon_0=44.1 +k_0=0.9995 +x_0=400000 +y_0=800000 +ellps=intl ";
3063
                        strProj4+=strExtraProj4;
3064
                        //getProj4ProjectionName();
3065
                }
3066
                
3067
                // Que pasa si no hay elipsoide? -> OGR por defecto pone WGS84
3068
                String strEllipseAcronym=ellipseToProj4(a,inv_f);
3069
                String strEllipse="";
3070
                if(strEllipseAcronym.equals(""))
3071
                {
3072
                        if (!Double.isInfinite(inv_f))
3073
                                strEllipse="+a="+a+" +rf="+inv_f+" ";
3074
                        else
3075
                                strEllipse="+R="+a+" ";
3076
                }
3077
                else
3078
                {
3079
                        strEllipse="+ellps="+strEllipseAcronym+" ";
3080
                }
3081
                strProj4+=strEllipse;
3082
                //System.out.println("Elipsoide["+elipName+"]=("+a+","+inv_f+")");
3083
                strProj4+=primeMeridianAcronym;
3084
                if(!strProj4Datum.equals(""))
3085
                        strProj4+=strProj4Datum;
3086
                if(!strProj4ToMeter.equals(""))
3087
                        strProj4+=strProj4ToMeter;
3088
                String strWkt=crs.toWKT();
3089
                
3090
                //System.out.println("- Cadena proj4: "+strProj4);
3091
                return strProj4;                
3092
        }
3093

    
3094
        private String[] primeMeridianToProj4(String pmName,double pmValue) throws CrsException
3095
        {
3096
            String[] primeMeridian=new String[3];
3097
                String pszPM="";
3098
                String acronym="";
3099
            double dfFromGreenwich = 0.0;
3100
            double tolerance=0.002/3600.0;
3101
            int    nPMCode = -1;
3102

    
3103
            dfFromGreenwich=-(9+7/60.0+54.862/3600.0);
3104
        if(pmName.equalsIgnoreCase("lisbon")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
3105
        {
3106
            pszPM="lisbon";
3107
            nPMCode = 8902;
3108
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
3109
            {
3110
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
3111
                                System.out.println(strError);
3112
                                //throw new CrsException(new Exception());
3113
            }
3114
            pmValue=dfFromGreenwich;
3115
            acronym="+pm="+pszPM+" ";
3116
        }
3117
        
3118
        dfFromGreenwich=(2+20/60.0+14.025/3600.0); 
3119
        if(pmName.equalsIgnoreCase("paris")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
3120
        {
3121
            pszPM="paris";
3122
            nPMCode = 8903;
3123
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
3124
            {
3125
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
3126
                                System.out.println(strError);
3127
                                //throw new CrsException(new Exception());
3128
            }
3129
            pmValue=dfFromGreenwich;
3130
            acronym="+pm="+pszPM+" ";
3131
        }
3132
        
3133
        dfFromGreenwich=-(74+4/60.0+51.3/3600.0);
3134
        if(pmName.equalsIgnoreCase("bogota")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
3135
        {
3136
            pszPM="bogota";
3137
            nPMCode = 8904;
3138
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
3139
            {
3140
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
3141
                                System.out.println(strError);
3142
                                //throw new CrsException(new Exception());
3143
            }
3144
            pmValue=dfFromGreenwich;
3145
            acronym="+pm="+pszPM+" ";
3146
        }
3147
        
3148
        dfFromGreenwich=-(3+41/60.0+16.58/3600.0);  // mal en ogr los segundos pone 16.48
3149
        if(pmName.equalsIgnoreCase("madrid")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
3150
        {
3151
            pszPM="madrid";
3152
            nPMCode = 8905;
3153
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
3154
            {
3155
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
3156
                                System.out.println(strError);
3157
                                //throw new CrsException(new Exception());
3158
            }
3159
            pmValue=dfFromGreenwich;
3160
            acronym="+pm="+pszPM+" ";
3161
        }
3162
        
3163
        dfFromGreenwich=(12+27/60.0+8.4/3600.0);
3164
        if(pmName.equalsIgnoreCase("rome")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
3165
        {
3166
            pszPM="rome";
3167
            nPMCode = 8906;
3168
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
3169
            {
3170
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
3171
                                System.out.println(strError);
3172
                                //throw new CrsException(new Exception());
3173
            }
3174
            pmValue=dfFromGreenwich;
3175
            acronym="+pm="+pszPM+" ";
3176
        }
3177
        
3178
        dfFromGreenwich=(7+26/60.0+22.5/3600.0);
3179
        if(pmName.equalsIgnoreCase("bern")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
3180
        {
3181
            pszPM="bern";
3182
            nPMCode = 8907;
3183
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
3184
            {
3185
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
3186
                                System.out.println(strError);
3187
                                //throw new CrsException(new Exception());
3188
            }
3189
            pmValue=dfFromGreenwich;
3190
            acronym="+pm="+pszPM+" ";
3191
        }
3192
        
3193
        dfFromGreenwich=(106+48/60.0+27.79/3600.0);
3194
        if(pmName.equalsIgnoreCase("jakarta")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
3195
        {
3196
            pszPM="jakarta";
3197
            nPMCode = 8908;
3198
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
3199
            {
3200
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
3201
                                System.out.println(strError);
3202
                                //throw new CrsException(new Exception());
3203
            }
3204
            pmValue=dfFromGreenwich;
3205
            acronym="+pm="+pszPM+" ";
3206
        }
3207
        
3208
        dfFromGreenwich=-(17+40/60.0+0.0/3600.0);
3209
        if(pmName.equalsIgnoreCase("ferro")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
3210
        {
3211
            pszPM="ferro";
3212
            nPMCode = 8909;
3213
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
3214
            {
3215
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
3216
                                System.out.println(strError);
3217
                                //throw new CrsException(new Exception());
3218
            }
3219
            pmValue=dfFromGreenwich;
3220
            acronym="+pm="+pszPM+" ";
3221
        }
3222
        
3223
        dfFromGreenwich=(4+22/60.0+4.71/3600.0);
3224
        if(pmName.equalsIgnoreCase("brussels")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
3225
        {
3226
            pszPM="brussels";
3227
            nPMCode = 8910;
3228
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
3229
            {
3230
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
3231
                                System.out.println(strError);
3232
                                //throw new CrsException(new Exception());
3233
            }
3234
            pmValue=dfFromGreenwich;
3235
            acronym="+pm="+pszPM+" ";
3236
        }
3237
        
3238
        dfFromGreenwich=(18+3/60.0+29.8/3600.0);
3239
        if(pmName.equalsIgnoreCase("stockholm")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
3240
        {
3241
            pszPM="stockholm";
3242
            nPMCode = 8911;
3243
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
3244
            {
3245
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
3246
                                System.out.println(strError);
3247
                                //throw new CrsException(new Exception());
3248
            }
3249
            pmValue=dfFromGreenwich;
3250
            acronym="+pm="+pszPM+" ";
3251
        }
3252
        
3253
        dfFromGreenwich=(23+42/60.0+58.815/3600.0);
3254
        if(pmName.equalsIgnoreCase("athens")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
3255
        {
3256
            pszPM="athens";
3257
            nPMCode = 8912;
3258
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
3259
            {
3260
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
3261
                                System.out.println(strError);
3262
                                //throw new CrsException(new Exception());
3263
            }
3264
            pmValue=dfFromGreenwich;
3265
            acronym="+pm="+pszPM+" ";
3266
        }
3267
        
3268
        dfFromGreenwich=(10+43/60.0+22.5/3600.0);
3269
        if(pmName.equalsIgnoreCase("oslo")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
3270
        {
3271
            pszPM="oslo";
3272
            nPMCode = 8913;
3273
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
3274
            {
3275
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
3276
                                System.out.println(strError);
3277
                                //throw new CrsException(new Exception());
3278
            }
3279
            pmValue=dfFromGreenwich;
3280
            acronym="+pm="+pszPM+" ";
3281
        }
3282
        
3283
        dfFromGreenwich=(0.0);
3284
        if(pmName.equalsIgnoreCase("Greenwich")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
3285
        {
3286
            pszPM="Greenwich";
3287
            nPMCode = 0;
3288
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
3289
            {
3290
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
3291
                                System.out.println(strError);
3292
                                //throw new CrsException(new Exception());
3293
            }
3294
            pmValue=dfFromGreenwich;
3295
        }
3296
        primeMeridian[0]=pszPM;
3297
        primeMeridian[1]=Double.toString(pmValue);
3298
        primeMeridian[2]=acronym;
3299
                return primeMeridian;
3300
        }
3301

    
3302
        private String ellipseToProj4(double dfSemiMajor, double dfInvFlattening)
3303
        {
3304
                double yo=Math.abs(4.5);
3305
                String pszPROJ4Ellipse="";
3306
            if( Math.abs(dfSemiMajor-6378249.145) < 0.01
3307
                && Math.abs(dfInvFlattening-293.465) < 0.0001 )
3308
            {
3309
                pszPROJ4Ellipse = "clrk80";     /* Clark 1880 */
3310
            }
3311
            else if( Math.abs(dfSemiMajor-6378245.0) < 0.01
3312
                     && Math.abs(dfInvFlattening-298.3) < 0.0001 )
3313
            {
3314
                pszPROJ4Ellipse = "krass";      /* Krassovsky */
3315
            }
3316
            else if( Math.abs(dfSemiMajor-6378388.0) < 0.01
3317
                     && Math.abs(dfInvFlattening-297.0) < 0.0001 )
3318
            {
3319
                pszPROJ4Ellipse = "intl";       /* International 1924 */
3320
            }
3321
            else if( Math.abs(dfSemiMajor-6378160.0) < 0.01
3322
                     && Math.abs(dfInvFlattening-298.25) < 0.0001 )
3323
            {
3324
                pszPROJ4Ellipse = "aust_SA";    /* Australian */
3325
            }
3326
            else if( Math.abs(dfSemiMajor-6377397.155) < 0.01
3327
                     && Math.abs(dfInvFlattening-299.1528128) < 0.0001 )
3328
            {
3329
                pszPROJ4Ellipse = "bessel";     /* Bessel 1841 */
3330
            }
3331
            else if( Math.abs(dfSemiMajor-6377483.865) < 0.01
3332
                     && Math.abs(dfInvFlattening-299.1528128) < 0.0001 )
3333
            {
3334
                pszPROJ4Ellipse = "bess_nam";   /* Bessel 1841 (Namibia / Schwarzeck)*/
3335
            }
3336
            else if( Math.abs(dfSemiMajor-6378160.0) < 0.01
3337
                     && Math.abs(dfInvFlattening-298.247167427) < 0.0001 )
3338
            {
3339
                pszPROJ4Ellipse = "GRS67";      /* GRS 1967 */
3340
            }
3341
            else if( Math.abs(dfSemiMajor-6378137) < 0.01
3342
                     && Math.abs(dfInvFlattening-298.257222101) < 0.000001 )
3343
            {
3344
                pszPROJ4Ellipse = "GRS80";      /* GRS 1980 */
3345
            }
3346
            else if( Math.abs(dfSemiMajor-6378206.4) < 0.01
3347
                     && Math.abs(dfInvFlattening-294.9786982) < 0.0001 )
3348
            {
3349
                pszPROJ4Ellipse = "clrk66";     /* Clarke 1866 */
3350
            }
3351
            else if( Math.abs(dfSemiMajor-6378206.4) < 0.01
3352
                     && Math.abs(dfInvFlattening-294.9786982) < 0.0001 )
3353
            {
3354
                pszPROJ4Ellipse = "mod_airy";   /* Modified Airy */
3355
            }
3356
            else if( Math.abs(dfSemiMajor-6377563.396) < 0.01
3357
                     && Math.abs(dfInvFlattening-299.3249646) < 0.0001 )
3358
            {
3359
                pszPROJ4Ellipse = "airy";       /* Modified Airy */
3360
            }
3361
            else if( Math.abs(dfSemiMajor-6378200) < 0.01
3362
                     && Math.abs(dfInvFlattening-298.3) < 0.0001 )
3363
            {
3364
                pszPROJ4Ellipse = "helmert";    /* Helmert 1906 */
3365
            }
3366
            else if( Math.abs(dfSemiMajor-6378155) < 0.01
3367
                     && Math.abs(dfInvFlattening-298.3) < 0.0001 )
3368
            {
3369
                pszPROJ4Ellipse = "fschr60m";   /* Modified Fischer 1960 */
3370
            }
3371
            else if( Math.abs(dfSemiMajor-6377298.556) < 0.01
3372
                     && Math.abs(dfInvFlattening-300.8017) < 0.0001 )
3373
            {
3374
                pszPROJ4Ellipse = "evrstSS";    /* Everest (Sabah & Sarawak) */
3375
            }
3376
            else if( Math.abs(dfSemiMajor-6378165.0) < 0.01
3377
                     && Math.abs(dfInvFlattening-298.3) < 0.0001 )
3378
            {
3379
                pszPROJ4Ellipse = "WGS60";      
3380
            }
3381
            else if( Math.abs(dfSemiMajor-6378145.0) < 0.01
3382
                     && Math.abs(dfInvFlattening-298.25) < 0.0001 )
3383
            {
3384
                pszPROJ4Ellipse = "WGS66";      
3385
            }
3386
            else if( Math.abs(dfSemiMajor-6378135.0) < 0.01
3387
                     && Math.abs(dfInvFlattening-298.26) < 0.0001 )
3388
            {
3389
                pszPROJ4Ellipse = "WGS72";      
3390
            }
3391
            else if( Math.abs(dfSemiMajor-6378137.0) < 0.01
3392
                     && Math.abs(dfInvFlattening-298.257223563) < 0.000001 )
3393
            {
3394
                pszPROJ4Ellipse = "WGS84";
3395
            }
3396
            /*
3397
            else if( EQUAL(pszDatum,"North_American_Datum_1927") )
3398
            {
3399
//                pszPROJ4Ellipse = "clrk66:+datum=nad27"; // NAD 27 
3400
                pszPROJ4Ellipse = "clrk66";
3401
            }
3402
            else if( EQUAL(pszDatum,"North_American_Datum_1983") )
3403
            {
3404
//                pszPROJ4Ellipse = "GRS80:+datum=nad83";       // NAD 83 
3405
                pszPROJ4Ellipse = "GRS80";
3406
            }
3407
            */
3408
            return pszPROJ4Ellipse;
3409
        }
3410

    
3411
        private String datumToProj4(String datumName,int epsgCode)
3412
        {
3413
            String datumProj4="";
3414
            String SRS_DN_NAD27="North_American_Datum_1927";
3415
            String SRS_DN_NAD83="North_American_Datum_1983";
3416
            String SRS_DN_WGS72="WGS_1972";
3417
            String SRS_DN_WGS84="WGS_1984";
3418
            if(datumName.equals(""))
3419
                    datumProj4="";
3420
                else if(datumName.equalsIgnoreCase(SRS_DN_NAD27) || epsgCode == 6267 )
3421
                        datumProj4 = "+datum=NAD27 ";
3422

    
3423
            else if(datumName.equalsIgnoreCase(SRS_DN_NAD83) || epsgCode == 6269 )
3424
                    datumProj4 = "+datum=NAD83 ";
3425

    
3426
            else if(datumName.equalsIgnoreCase(SRS_DN_WGS84) || epsgCode == 6326 )
3427
                    datumProj4 = "+datum=WGS84 ";
3428

    
3429
            else if( epsgCode == 6314 )
3430
                    datumProj4 = "+datum=potsdam ";
3431

    
3432
            else if( epsgCode == 6272 )
3433
                    datumProj4 = "+datum=nzgd49 ";
3434
                return datumProj4;
3435
        }
3436
        // Casos especiales
3437
        // - MERCATOR_1SP
3438
        // - HOTINE
3439
        // - MILLER
3440
        // - Polar_Stereographic
3441
        // - Polar_Stereographic
3442
        // - VanDerGrinten
3443
        // - Transverse Mercator
3444
        // - Cuando el meridiano origen no es 0 se pone pm=madrid y lon_0=
3445
        // +datum
3446
        
3447
        // Funciones privadas necesarias para el proceso
3448
        
3449
        private String getName(Identifier name) {
3450
                String[] correctName = name.toString().split(":");
3451
                if (correctName.length<2) 
3452
                        return correctName[0];
3453
                
3454
                else
3455
                        return correctName[1];
3456
        }
3457
        
3458
        private String[] Spheroid (Ellipsoid ellips) {
3459
                String[] spheroid = new String[3];
3460
                Unit u = ellips.getAxisUnit();
3461
                double semi_major = convert( ellips.getSemiMajorAxis(), u.toString());
3462
                //double inv_f = convert( ellips.getInverseFlattening(), u.toString());
3463
                double inv_f = ellips.getInverseFlattening();
3464
                String[] val =        ellips.getName().toString().split(":");
3465
                if (val.length<2)
3466
                        spheroid[0] = ellips.getName().toString().split(":")[0];
3467
                else
3468
                        spheroid[0] = ellips.getName().toString().split(":")[1];
3469
                spheroid[1] = String.valueOf(semi_major);
3470
                spheroid[2] = String.valueOf(inv_f);
3471
                return spheroid;
3472
        }
3473
        
3474
        private String[] Primem (PrimeMeridian prim) {
3475
                String[] primem = new String[2];
3476
                DefaultPrimeMeridian pm = (DefaultPrimeMeridian) prim;
3477
                Unit u = pm.getAngularUnit();
3478
                double value = convert( pm.getGreenwichLongitude(), u.toString());
3479
                String[] val = pm.getName().toString().split(":");
3480
                if (val.length<2)
3481
                        primem[0] = pm.getName().toString().split(":")[0];
3482
                else
3483
                        primem[0] = pm.getName().toString().split(":")[1];
3484
                primem[1] = String.valueOf(value);
3485
                return primem;
3486
        }
3487
        
3488
        public double convert(double value, String measure) throws ConversionException {
3489
                if (measure.equals("D.MS")) {                
3490
                        value *= this.divider;
3491
                int deg,min;
3492
                deg = (int) (value/10000); value -= 10000*deg;
3493
                min = (int) (value/  100); value -=   100*min;
3494
                if (min<=-60 || min>=60) {  // Accepts NaN
3495
                    if (Math.abs(Math.abs(min) - 100) <= EPS) {
3496
                        if (min >= 0) deg++; else deg--;
3497
                        min = 0;
3498
                    } else {
3499
                        throw new ConversionException("Invalid minutes: "+min);
3500
                    }
3501
                }
3502
                if (value<=-60 || value>=60) { // Accepts NaN
3503
                    if (Math.abs(Math.abs(value) - 100) <= EPS) {
3504
                        if (value >= 0) min++; else min--;
3505
                        value = 0;
3506
                    } else {
3507
                        throw new ConversionException("Invalid secondes: "+value);
3508
                    }
3509
                }
3510
                value = ((value/60) + min)/60 + deg;
3511
                return value;
3512
                }
3513
                if (measure.equals("grad") || measure.equals("grade")) 
3514
                        return ((value * 180.0) / 200.0);                        
3515
                if (measure.equals(""+(char)176)) 
3516
                        return value;                
3517
                if (measure.equals("DMS") ) 
3518
                        return value;                
3519
                if (measure.equals("m") || measure.startsWith("[m")) 
3520
                        return value;        
3521
                if (measure.equals("")) 
3522
                        return value;
3523
                if (measure.equalsIgnoreCase("ft")||measure.equalsIgnoreCase("foot")||measure.equalsIgnoreCase("feet")) 
3524
                        return (value*0.3048/1.0);
3525
                
3526
                throw new ConversionException("Conversion no contemplada: "+measure);
3527
    }
3528
        
3529
        public ArrayList getProjectionNameList(){
3530
                return projectionNameList;
3531
        }
3532
}