Statistics
| Revision:

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

History | View | Annotate | Download (125 KB)

1
package org.gvsig.crs;
2

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

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

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

    
18
public class Proj4 {        
19

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
439
                        String[] projectionAcronym={"bonne"};
440
                        projectionAcronymList.add(count,projectionAcronym);
441
                }
442

    
443
                count++;
444
                {// Cassini_Soldner
445
                        String[] projectionName={"Cassini_Soldner"};
446
                        projectionNameList.add(count,projectionName);
447
                        addProjectionName(count,"Cassini-Soldner");
448
                        addProjectionName(count,"9806");
449

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
889
                        String[] projectionAcronym={"krovak"};
890
                        projectionAcronymList.add(count,projectionAcronym);
891
                }
892
                
893
                
894
                count++;
895
                {// Laborde Madagascar
896
                        String[] projectionName={"Laborde_Madagascar"};
897
                        projectionNameList.add(count,projectionName);
898
                        addProjectionName(count,"Laborde Madagascar");
899
                        addProjectionName(count,"Laborde");
900
                        addProjectionName(count,"9813");
901

    
902
                        String[] parameterName={};
903
                        projectionParameterList.add(count,parameterName);
904

    
905
                        String[] parameterAcronym={};
906
                        projectionParameterAcronymList.add(count,parameterAcronym);
907

    
908
                        String[] parameterDefaultValue={};
909
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
910

    
911
                        String[] parameterMaxValue={};
912
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
913

    
914
                        String[] parameterMinValue={};
915
                        projectionParameterMinValueList.add(count,parameterMinValue);
916

    
917
                        String[] projectionAcronym={"labrd"};
918
                        projectionAcronymList.add(count,projectionAcronym);
919
                        
920
                        /*String[] parameterName={"azimuth"};
921
                        projectionParameterList.add(count,parameterName);
922

923
                        String[] parameterAcronym={"azi"};
924
                        projectionParameterAcronymList.add(count,parameterAcronym);
925

926
                        String[] parameterDefaultValue={"18.9"};
927
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
928

929
                        String[] parameterMaxValue={"19"};
930
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
931

932
                        String[] parameterMinValue={"18"};
933
                        projectionParameterMinValueList.add(count,parameterMinValue);
934

935
                        String[] projectionAcronym={"labrd"};
936
                        projectionAcronymList.add(count,projectionAcronym);*/
937
                }
938

    
939
                count++;
940
                {// Lambert_Azimuthal_Equal_Area
941
                        String[] projectionName={"Lambert_Azimuthal_Equal_Area"};
942
                        projectionNameList.add(count,projectionName);
943
                        addProjectionName(count,"Lambert Azimuthal Equal Area");
944
                        addProjectionName(count,"Lambert Azimuthal Equal Area (Spherical)");
945
                        addProjectionName(count,"9820");
946

    
947
                        String[] parameterName={"latitude_of_center"};
948
                        projectionParameterList.add(count,parameterName);
949
                        addProjectionParameter(count,"longitude_of_center");
950
                        addProjectionParameter(count,"false_easting");
951
                        addProjectionParameter(count,"false_northing");
952

    
953
                        String[] parameterAcronym={"lat_0"};
954
                        projectionParameterAcronymList.add(count,parameterAcronym);
955
                        addProjectionParameterAcronymList(count,"lon_0");
956
                        addProjectionParameterAcronymList(count,"x_0");
957
                        addProjectionParameterAcronymList(count,"y_0");
958

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

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

    
971
                        String[] parameterMinValue={"-90.0"};
972
                        projectionParameterMinValueList.add(count,parameterMinValue);
973
                        addProjectionParameterMinValue(count,"-360.0");
974
                        addProjectionParameterMinValue(count,"-100000000.0");
975
                        addProjectionParameterMinValue(count,"-100000000.0");
976

    
977
                        String[] projectionAcronym={"laea"};
978
                        projectionAcronymList.add(count,projectionAcronym);
979
                }
980
                
981
                count++;
982
                {// Lambert_Conformal_Conic_1SP
983
                        String[] projectionName={"Lambert_Conformal_Conic_1SP"};
984
                        projectionNameList.add(count,projectionName);
985
                        addProjectionName(count,"Lambert Conic Conformal (1SP)");
986
                        addProjectionName(count,"9801");
987

    
988
                        String[] parameterName={"latitude_of_origin"};
989
                        projectionParameterList.add(count,parameterName);
990
                        addProjectionParameter(count,"central_meridian");
991
                        addProjectionParameter(count,"scale_factor");
992
                        addProjectionParameter(count,"false_easting");
993
                        addProjectionParameter(count,"false_northing");
994

    
995
                        String[] parameterAcronym={"lat_0"};
996
                        projectionParameterAcronymList.add(count,parameterAcronym);
997
                        addProjectionParameterAcronymList(count,"lon_0");
998
                        addProjectionParameterAcronymList(count,"k_0");
999
                        addProjectionParameterAcronymList(count,"x_0");
1000
                        addProjectionParameterAcronymList(count,"y_0");
1001

    
1002
                        String[] parameterDefaultValue={"0.0"};
1003
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1004
                        addProjectionParameterDefaultValue(count,"0.0");
1005
                        addProjectionParameterDefaultValue(count,"1.0");
1006
                        addProjectionParameterDefaultValue(count,"0.0");
1007
                        addProjectionParameterDefaultValue(count,"0.0");
1008

    
1009
                        String[] parameterMaxValue={"90.0"};
1010
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1011
                        addProjectionParameterMaxValue(count,"360.0");
1012
                        addProjectionParameterMaxValue(count,"10.0");
1013
                        addProjectionParameterMaxValue(count,"100000000.0");
1014
                        addProjectionParameterMaxValue(count,"100000000.0");
1015

    
1016
                        String[] parameterMinValue={"-90.0"};
1017
                        projectionParameterMinValueList.add(count,parameterMinValue);
1018
                        addProjectionParameterMinValue(count,"-360.0");
1019
                        addProjectionParameterMinValue(count,"0.0");
1020
                        addProjectionParameterMinValue(count,"-100000000.0");
1021
                        addProjectionParameterMinValue(count,"-100000000.0");
1022

    
1023
                        String[] projectionAcronym={"lcca"};
1024
                        projectionAcronymList.add(count,projectionAcronym);
1025
                }
1026
                
1027
                count++;
1028
                {// Lambert_Conformal_Conic_2SP
1029
                        String[] projectionName={"Lambert_Conformal_Conic_2SP"};
1030
                        projectionNameList.add(count,projectionName);
1031
                        addProjectionName(count,"Lambert Conic Conformal (2SP)");
1032
                        addProjectionName(count,"9802");
1033

    
1034
                        String[] parameterName={"standard_parallel_1"};
1035
                        projectionParameterList.add(count,parameterName);
1036
                        addProjectionParameter(count,"standard_parallel_2");
1037
                        addProjectionParameter(count,"latitude_of_origin");
1038
                        addProjectionParameter(count,"central_meridian");
1039
                        addProjectionParameter(count,"false_easting");
1040
                        addProjectionParameter(count,"false_northing");
1041

    
1042
                        String[] parameterAcronym={"lat_1"};
1043
                        projectionParameterAcronymList.add(count,parameterAcronym);
1044
                        addProjectionParameterAcronymList(count,"lat_2");
1045
                        addProjectionParameterAcronymList(count,"lat_0");
1046
                        addProjectionParameterAcronymList(count,"lon_0");
1047
                        addProjectionParameterAcronymList(count,"x_0");
1048
                        addProjectionParameterAcronymList(count,"y_0");
1049

    
1050
                        String[] parameterDefaultValue={"0.0"};
1051
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1052
                        addProjectionParameterDefaultValue(count,"0.0");
1053
                        addProjectionParameterDefaultValue(count,"0.0");
1054
                        addProjectionParameterDefaultValue(count,"0.0");
1055
                        addProjectionParameterDefaultValue(count,"0.0");
1056
                        addProjectionParameterDefaultValue(count,"0.0");
1057

    
1058
                        String[] parameterMaxValue={"90.0"};
1059
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1060
                        addProjectionParameterMaxValue(count,"90.0");
1061
                        addProjectionParameterMaxValue(count,"90.0");
1062
                        addProjectionParameterMaxValue(count,"360.0");
1063
                        addProjectionParameterMaxValue(count,"100000000.0");
1064
                        addProjectionParameterMaxValue(count,"100000000.0");
1065

    
1066
                        String[] parameterMinValue={"-90.0"};
1067
                        projectionParameterMinValueList.add(count,parameterMinValue);
1068
                        addProjectionParameterMinValue(count,"-90.0");
1069
                        addProjectionParameterMinValue(count,"-90.0");
1070
                        addProjectionParameterMinValue(count,"-360.0");
1071
                        addProjectionParameterMinValue(count,"-100000000.0");
1072
                        addProjectionParameterMinValue(count,"-100000000.0");
1073

    
1074
                        String[] projectionAcronym={"lcc"};
1075
                        projectionAcronymList.add(count,projectionAcronym);
1076
                }
1077
                
1078
                count++;
1079
                {// Lambert_Conformal_Conic_2SP_Belgium
1080
                        String[] projectionName={"Lambert_Conformal_Conic_2SP_Belgium"};
1081
                        projectionNameList.add(count,projectionName);
1082
                        addProjectionName(count,"Lambert Conic Conformal (2SP Belgium)");
1083
                        addProjectionName(count,"9803");
1084

    
1085
                        String[] parameterName={"standard_parallel_1"};
1086
                        projectionParameterList.add(count,parameterName);
1087
                        addProjectionParameter(count,"standard_parallel_2");
1088
                        addProjectionParameter(count,"latitude_of_origin");
1089
                        addProjectionParameter(count,"central_meridian");
1090
                        addProjectionParameter(count,"false_easting");
1091
                        addProjectionParameter(count,"false_northing");
1092

    
1093
                        String[] parameterAcronym={"lat_1"};
1094
                        projectionParameterAcronymList.add(count,parameterAcronym);
1095
                        addProjectionParameterAcronymList(count,"lat_2");
1096
                        addProjectionParameterAcronymList(count,"lat_0");
1097
                        addProjectionParameterAcronymList(count,"lon_0");
1098
                        addProjectionParameterAcronymList(count,"x_0");
1099
                        addProjectionParameterAcronymList(count,"y_0");
1100

    
1101
                        String[] parameterDefaultValue={"0.0"};
1102
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1103
                        addProjectionParameterDefaultValue(count,"0.0");
1104
                        addProjectionParameterDefaultValue(count,"0.0");
1105
                        addProjectionParameterDefaultValue(count,"0.0");
1106
                        addProjectionParameterDefaultValue(count,"0.0");
1107
                        addProjectionParameterDefaultValue(count,"0.0");
1108

    
1109
                        String[] parameterMaxValue={"90.0"};
1110
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1111
                        addProjectionParameterMaxValue(count,"90.0");
1112
                        addProjectionParameterMaxValue(count,"90.0");
1113
                        addProjectionParameterMaxValue(count,"360.0");
1114
                        addProjectionParameterMaxValue(count,"100000000.0");
1115
                        addProjectionParameterMaxValue(count,"100000000.0");
1116

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

    
1125
                        String[] projectionAcronym={"lcc"};
1126
                        projectionAcronymList.add(count,projectionAcronym);
1127
                }
1128
                
1129
                count++;
1130
                {// Mercator_1SP
1131
                        String[] projectionName={"Mercator_1SP"};
1132
                        projectionNameList.add(count,projectionName);
1133
                        addProjectionName(count,"Mercator");
1134
                        addProjectionName(count,"9804");
1135
                        addProjectionName(count, "Mercator (1SP)");
1136
                        addProjectionName(count, "Mercator_(1SP)");
1137

    
1138
                        String[] parameterName={"central_meridian"};
1139
                        projectionParameterList.add(count,parameterName);
1140
                        addProjectionParameter(count,"latitude_of_origin");  // o latitude_origin
1141
                        addProjectionParameter(count,"scale_factor");  // o latitude_origin
1142
                        addProjectionParameter(count,"false_easting");
1143
                        addProjectionParameter(count,"false_northing");
1144

    
1145
                        String[] parameterAcronym={"lon_0"};
1146
                        projectionParameterAcronymList.add(count,parameterAcronym);
1147
                        addProjectionParameterAcronymList(count,"lat_ts"); // o lat_ts
1148
                        addProjectionParameterAcronymList(count,"k"); // o lat_ts
1149
                        addProjectionParameterAcronymList(count,"x_0");
1150
                        addProjectionParameterAcronymList(count,"y_0");
1151

    
1152
                        String[] parameterDefaultValue={"0.0"};
1153
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1154
                        addProjectionParameterDefaultValue(count,"0.0"); // o 0.0
1155
                        addProjectionParameterDefaultValue(count,"1.0"); // o 0.0
1156
                        addProjectionParameterDefaultValue(count,"0.0");
1157
                        addProjectionParameterDefaultValue(count,"0.0");
1158

    
1159
                        String[] parameterMaxValue={"360.0"};
1160
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1161
                        addProjectionParameterMaxValue(count,"90.0");
1162
                        addProjectionParameterMaxValue(count,"10.0");
1163
                        addProjectionParameterMaxValue(count,"100000000.0");
1164
                        addProjectionParameterMaxValue(count,"100000000.0");
1165

    
1166
                        String[] parameterMinValue={"-360.0"};
1167
                        projectionParameterMinValueList.add(count,parameterMinValue);
1168
                        addProjectionParameterMinValue(count,"-90.0");
1169
                        addProjectionParameterMinValue(count,"0.0");
1170
                        addProjectionParameterMinValue(count,"-100000000.0");
1171
                        addProjectionParameterMinValue(count,"-100000000.0");
1172

    
1173
                        String[] projectionAcronym={"merc"};
1174
                        projectionAcronymList.add(count,projectionAcronym);
1175
                }
1176
                
1177
                count++;
1178
                {// Mercator_2SP
1179
                        String[] projectionName={"Mercator_2SP"};
1180
                        projectionNameList.add(count,projectionName);
1181
                        addProjectionName(count,"Mercator");
1182
                        addProjectionName(count,"9805");
1183
                        addProjectionName(count, "Mercator (2SP)");
1184

    
1185
                        String[] parameterName={"central_meridian"};
1186
                        projectionParameterList.add(count,parameterName);
1187
                        addProjectionParameter(count,"standard_parallel_1");
1188
                        addProjectionParameter(count,"false_easting");
1189
                        addProjectionParameter(count,"false_northing");
1190

    
1191
                        String[] parameterAcronym={"lon_0"};
1192
                        projectionParameterAcronymList.add(count,parameterAcronym);
1193
                        addProjectionParameterAcronymList(count,"lat_ts");
1194
                        addProjectionParameterAcronymList(count,"x_0");
1195
                        addProjectionParameterAcronymList(count,"y_0");
1196

    
1197
                        String[] parameterDefaultValue={"0.0"};
1198
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1199
                        addProjectionParameterDefaultValue(count,"0.0"); // o 0.0
1200
                        addProjectionParameterDefaultValue(count,"0.0");
1201
                        addProjectionParameterDefaultValue(count,"0.0");
1202

    
1203
                        String[] parameterMaxValue={"360.0"};
1204
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1205
                        addProjectionParameterMaxValue(count,"90.0");
1206
                        addProjectionParameterMaxValue(count,"100000000.0");
1207
                        addProjectionParameterMaxValue(count,"100000000.0");
1208

    
1209
                        String[] parameterMinValue={"-360.0"};
1210
                        projectionParameterMinValueList.add(count,parameterMinValue);
1211
                        addProjectionParameterMinValue(count,"-90.0");
1212
                        addProjectionParameterMinValue(count,"-100000000.0");
1213
                        addProjectionParameterMinValue(count,"-100000000.0");
1214

    
1215
                        String[] projectionAcronym={"merc"};
1216
                        projectionAcronymList.add(count,projectionAcronym);
1217
                }
1218

    
1219
                count++;
1220
                {// Miller_Cylindrical
1221
                        String[] projectionName={"Miller_Cylindrical"};
1222
                        projectionNameList.add(count,projectionName);
1223
                        addProjectionName(count,"Miller Cylindrical");
1224

    
1225
                        String[] parameterName={"latitude_of_center"};
1226
                        projectionParameterList.add(count,parameterName);
1227
                        addProjectionParameter(count,"longitude_of_center");
1228
                        addProjectionParameter(count,"false_easting");
1229
                        addProjectionParameter(count,"false_northing");
1230

    
1231
                        String[] parameterAcronym={"lat_0"};
1232
                        projectionParameterAcronymList.add(count,parameterAcronym);
1233
                        addProjectionParameterAcronymList(count,"lon_0");
1234
                        addProjectionParameterAcronymList(count,"x_0");
1235
                        addProjectionParameterAcronymList(count,"y_0");
1236

    
1237
                        String[] parameterDefaultValue={"0.0"};
1238
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1239
                        addProjectionParameterDefaultValue(count,"0.0");
1240
                        addProjectionParameterDefaultValue(count,"0.0");
1241
                        addProjectionParameterDefaultValue(count,"0.0");
1242

    
1243
                        String[] parameterMaxValue={"90.0"};
1244
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1245
                        addProjectionParameterMaxValue(count,"360.0");
1246
                        addProjectionParameterMaxValue(count,"100000000.0");
1247
                        addProjectionParameterMaxValue(count,"100000000.0");
1248

    
1249
                        String[] parameterMinValue={"-90.0"};
1250
                        projectionParameterMinValueList.add(count,parameterMinValue);
1251
                        addProjectionParameterMinValue(count,"-360.0");
1252
                        addProjectionParameterMinValue(count,"-100000000.0");
1253
                        addProjectionParameterMinValue(count,"-100000000.0");
1254

    
1255
                        String[] projectionAcronym={"mill"};
1256
                        projectionAcronymList.add(count,projectionAcronym);
1257
                }
1258
                
1259
                count++;
1260
                {// Mollweide
1261
                        String[] projectionName={"Mollweide"};
1262
                        projectionNameList.add(count,projectionName);
1263
                        addProjectionName(count,"Hornolographic");
1264
                        addProjectionName(count,"Babinet");
1265
                        addProjectionName(count,"Elliptical");
1266

    
1267
                        String[] parameterName={"central_meridian"};
1268
                        projectionParameterList.add(count,parameterName);
1269
                        addProjectionParameter(count,"false_easting");
1270
                        addProjectionParameter(count,"false_northing");
1271

    
1272
                        String[] parameterAcronym={"lon_0"};
1273
                        projectionParameterAcronymList.add(count,parameterAcronym);
1274
                        addProjectionParameterAcronymList(count,"x_0");
1275
                        addProjectionParameterAcronymList(count,"y_0");
1276

    
1277
                        String[] parameterDefaultValue={"0.0"};
1278
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1279
                        addProjectionParameterDefaultValue(count,"0.0");
1280
                        addProjectionParameterDefaultValue(count,"0.0");
1281

    
1282
                        String[] parameterMaxValue={"360.0"};
1283
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1284
                        addProjectionParameterMaxValue(count,"100000000.0");
1285
                        addProjectionParameterMaxValue(count,"100000000.0");
1286

    
1287
                        String[] parameterMinValue={"-360.0"};
1288
                        projectionParameterMinValueList.add(count,parameterMinValue);
1289
                        addProjectionParameterMinValue(count,"-100000000.0");
1290
                        addProjectionParameterMinValue(count,"-100000000.0");
1291

    
1292
                        String[] projectionAcronym={"moll"};
1293
                        projectionAcronymList.add(count,projectionAcronym);
1294
                }
1295

    
1296
                count++;
1297
                {// New_Zealand_Map_Grid
1298
                        String[] projectionName={"New_Zealand_Map_Grid"};
1299
                        projectionNameList.add(count,projectionName);
1300
                        addProjectionName(count,"New Zealand Map Grid");
1301
                        addProjectionName(count,"9811");
1302

    
1303
                        String[] parameterName={"latitude_of_origin"};
1304
                        projectionParameterList.add(count,parameterName);
1305
                        addProjectionParameter(count,"central_meridian");
1306
                        addProjectionParameter(count,"false_easting");
1307
                        addProjectionParameter(count,"false_northing");
1308

    
1309
                        String[] parameterAcronym={"lat_0"};
1310
                        projectionParameterAcronymList.add(count,parameterAcronym);
1311
                        addProjectionParameterAcronymList(count,"lon_0");
1312
                        addProjectionParameterAcronymList(count,"x_0");
1313
                        addProjectionParameterAcronymList(count,"y_0");
1314

    
1315
                        String[] parameterDefaultValue={"0.0"};
1316
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1317
                        addProjectionParameterDefaultValue(count,"0.0");
1318
                        addProjectionParameterDefaultValue(count,"0.0");
1319
                        addProjectionParameterDefaultValue(count,"0.0");
1320

    
1321
                        String[] parameterMaxValue={"90.0"};
1322
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1323
                        addProjectionParameterMaxValue(count,"360.0");
1324
                        addProjectionParameterMaxValue(count,"100000000.0");
1325
                        addProjectionParameterMaxValue(count,"100000000.0");
1326

    
1327
                        String[] parameterMinValue={"-90.0"};
1328
                        projectionParameterMinValueList.add(count,parameterMinValue);
1329
                        addProjectionParameterMinValue(count,"-360.0");
1330
                        addProjectionParameterMinValue(count,"-100000000.0");
1331
                        addProjectionParameterMinValue(count,"-100000000.0");
1332

    
1333
                        String[] projectionAcronym={"nzmg"};
1334
                        projectionAcronymList.add(count,projectionAcronym);
1335
                }
1336

    
1337
                count++;
1338
                {// Oblique_Mercator
1339
                        String[] projectionName={"Oblique_Mercator"};
1340
                        projectionNameList.add(count,projectionName);
1341
                        addProjectionName(count,"Oblique Mercator");
1342
                        addProjectionName(count,"9815");
1343
                        addProjectionName(count,"CT_ObliqueMercator");
1344
                        addProjectionName(count,"Hotine_Oblique_Mercator_Azimuth_Center");
1345
                        addProjectionName(count,"Rectified_Skew_Orthomorphic_Center");
1346
                        addProjectionName(count,"Hotine Oblique Mercator");
1347

    
1348
                        String[] parameterName={"latitude_of_center"};
1349
                        projectionParameterList.add(count,parameterName);
1350
                        addProjectionParameter(count,"longitude_of_center");
1351
                        addProjectionParameter(count,"azimuth");
1352
                        addProjectionParameter(count,"rectified_grid_angle");
1353
                        addProjectionParameter(count,"scale_factor");
1354
                        addProjectionParameter(count,"false_easting");
1355
                        addProjectionParameter(count,"false_northing");
1356

    
1357
                        String[] parameterAcronym={"lat_0"};
1358
                        projectionParameterAcronymList.add(count,parameterAcronym);
1359
                        addProjectionParameterAcronymList(count,"lonc");
1360
                        addProjectionParameterAcronymList(count,"alpha");
1361
                        addProjectionParameterAcronymList(count,"alpha");
1362
                        addProjectionParameterAcronymList(count,"k");
1363
                        addProjectionParameterAcronymList(count,"x_0");
1364
                        addProjectionParameterAcronymList(count,"y_0");
1365

    
1366
                        String[] parameterDefaultValue={"0.0"};
1367
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1368
                        addProjectionParameterDefaultValue(count,"0.0");
1369
                        addProjectionParameterDefaultValue(count,"0.0");
1370
                        addProjectionParameterDefaultValue(count,"0.0");
1371
                        addProjectionParameterDefaultValue(count,"1.0");
1372
                        addProjectionParameterDefaultValue(count,"0.0");
1373
                        addProjectionParameterDefaultValue(count,"0.0");
1374

    
1375
                        String[] parameterMaxValue={"90.0"};
1376
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1377
                        addProjectionParameterMaxValue(count,"360.0");
1378
                        addProjectionParameterMaxValue(count,"360.0");
1379
                        addProjectionParameterMaxValue(count,"360.0");
1380
                        addProjectionParameterMaxValue(count,"10.0");
1381
                        addProjectionParameterMaxValue(count,"100000000.0");
1382
                        addProjectionParameterMaxValue(count,"100000000.0");
1383

    
1384
                        String[] parameterMinValue={"-90.0"};
1385
                        projectionParameterMinValueList.add(count,parameterMinValue);
1386
                        addProjectionParameterMinValue(count,"-360.0");
1387
                        addProjectionParameterMinValue(count,"-360.0");
1388
                        addProjectionParameterMinValue(count,"-360.0");
1389
                        addProjectionParameterMinValue(count,"0.0");
1390
                        addProjectionParameterMinValue(count,"-100000000.0");
1391
                        addProjectionParameterMinValue(count,"-100000000.0");
1392

    
1393
                        String[] projectionAcronym={"omerc"};
1394
                        projectionAcronymList.add(count,projectionAcronym);
1395
                }
1396

    
1397
                count++;
1398
                {// Oblique_Mercator
1399
                        String[] projectionName={"Hotine_Oblique_Mercator_Two_Point_Center"};
1400
                        projectionNameList.add(count,projectionName);
1401
                        addProjectionName(count,"Hotine_Oblique_Mercator_Two_Point_Natural_Origin");
1402

    
1403
            /*SEMI_MAJOR,          SEMI_MINOR,
1404
            LAT_OF_1ST_POINT,    LONG_OF_1ST_POINT,
1405
            LAT_OF_2ND_POINT,    LONG_OF_2ND_POINT,
1406
                    LAT_OF_CENTRE,       SCALE_FACTOR_LOCAL,
1407
            FALSE_EASTING_LOCAL,       FALSE_NORTHING_LOCAL*/
1408

    
1409
            String[] parameterName={"Latitude_Of_2nd_Point"};
1410
                        projectionParameterList.add(count,parameterName);
1411
                        addProjectionParameter(count,"Longitude_Of_1st_Point");
1412
                        addProjectionParameter(count,"Latitude_Of_2nd_Point");
1413
                        addProjectionParameter(count,"Longitude_Of_2nd_Point");
1414
                        addProjectionParameter(count,"scale_factor");
1415
                        addProjectionParameter(count,"false_easting");
1416
                        addProjectionParameter(count,"false_northing");
1417

    
1418
                        String[] parameterAcronym={"lat_1"};
1419
                        projectionParameterAcronymList.add(count,parameterAcronym);
1420
                        addProjectionParameterAcronymList(count,"lon_1");
1421
                        addProjectionParameterAcronymList(count,"lat_2");
1422
                        addProjectionParameterAcronymList(count,"lon_2");
1423
                        addProjectionParameterAcronymList(count,"k");
1424
                        addProjectionParameterAcronymList(count,"x_0");
1425
                        addProjectionParameterAcronymList(count,"y_0");
1426

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

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

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

    
1454
                        String[] projectionAcronym={"omerc"};
1455
                        projectionAcronymList.add(count,projectionAcronym);
1456
                }
1457

    
1458
                count++;
1459
                {// Oblique_Stereographic
1460
                        String[] projectionName={"Oblique_Stereographic"};
1461
                        projectionNameList.add(count,projectionName);
1462
                        addProjectionName(count,"Oblique Stereographic");
1463
                        addProjectionName(count,"9809");
1464

    
1465
                        String[] parameterName={"latitude_of_origin"};
1466
                        projectionParameterList.add(count,parameterName);
1467
                        addProjectionParameter(count,"central_meridian");
1468
                        addProjectionParameter(count,"scale_factor");
1469
                        addProjectionParameter(count,"false_easting");
1470
                        addProjectionParameter(count,"false_northing");
1471

    
1472
                        String[] parameterAcronym={"lat_0"};
1473
                        projectionParameterAcronymList.add(count,parameterAcronym);
1474
                        addProjectionParameterAcronymList(count,"lon_0");
1475
                        addProjectionParameterAcronymList(count,"k");
1476
                        addProjectionParameterAcronymList(count,"x_0");
1477
                        addProjectionParameterAcronymList(count,"y_0");
1478

    
1479
                        String[] parameterDefaultValue={"0.0"};
1480
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1481
                        addProjectionParameterDefaultValue(count,"0.0");
1482
                        addProjectionParameterDefaultValue(count,"1.0");
1483
                        addProjectionParameterDefaultValue(count,"0.0");
1484
                        addProjectionParameterDefaultValue(count,"0.0");
1485

    
1486
                        String[] parameterMaxValue={"90.0"};
1487
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1488
                        addProjectionParameterMaxValue(count,"360.0");
1489
                        addProjectionParameterMaxValue(count,"10.0");
1490
                        addProjectionParameterMaxValue(count,"100000000.0");
1491
                        addProjectionParameterMaxValue(count,"100000000.0");
1492

    
1493
                        String[] parameterMinValue={"-90.0"};
1494
                        projectionParameterMinValueList.add(count,parameterMinValue);
1495
                        addProjectionParameterMinValue(count,"-360.0");
1496
                        addProjectionParameterMinValue(count,"0.0");
1497
                        addProjectionParameterMinValue(count,"-100000000.0");
1498
                        addProjectionParameterMinValue(count,"-100000000.0");
1499

    
1500
                        String[] projectionAcronym={"sterea"};
1501
                        projectionAcronymList.add(count,projectionAcronym);
1502
                }
1503

    
1504
                count++;
1505
                {// Orthographic
1506
                        String[] projectionName={"Orthographic"};
1507
                        projectionNameList.add(count,projectionName);
1508

    
1509
                        String[] parameterName={"latitude_of_origin"};
1510
                        projectionParameterList.add(count,parameterName);
1511
                        addProjectionParameter(count,"central_meridian");
1512
                        addProjectionParameter(count,"false_easting");
1513
                        addProjectionParameter(count,"false_northing");
1514

    
1515
                        String[] parameterAcronym={"lat_0"};
1516
                        projectionParameterAcronymList.add(count,parameterAcronym);
1517
                        addProjectionParameterAcronymList(count,"lon_0");
1518
                        addProjectionParameterAcronymList(count,"x_0");
1519
                        addProjectionParameterAcronymList(count,"y_0");
1520

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

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

    
1533
                        String[] parameterMinValue={"-90.0"};
1534
                        projectionParameterMinValueList.add(count,parameterMinValue);
1535
                        addProjectionParameterMinValue(count,"-360.0");
1536
                        addProjectionParameterMinValue(count,"-100000000.0");
1537
                        addProjectionParameterMinValue(count,"-100000000.0");
1538

    
1539
                        String[] projectionAcronym={"ortho"};
1540
                        projectionAcronymList.add(count,projectionAcronym);
1541
                }
1542

    
1543
                count++;
1544
                {// Polar_Stereographic
1545
                        String[] projectionName={"Polar_Stereographic"};
1546
                        projectionNameList.add(count,projectionName);
1547
                        addProjectionName(count,"Polar Stereographic");
1548
                        addProjectionName(count,"9810");
1549

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

    
1558
                        String[] parameterAcronym={"lat_0"};
1559
                        //lat_0=90 o lat_0=-90
1560
                        projectionParameterAcronymList.add(count,parameterAcronym);
1561
                        addProjectionParameterAcronymList(count,"lat_ts");
1562
                        addProjectionParameterAcronymList(count,"lon_0");
1563
                        addProjectionParameterAcronymList(count,"k");
1564
                        addProjectionParameterAcronymList(count,"x_0");
1565
                        addProjectionParameterAcronymList(count,"y_0");
1566

    
1567
                        String[] parameterDefaultValue={"90.0"};
1568
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1569
                        addProjectionParameterDefaultValue(count,"90.0");
1570
                        addProjectionParameterDefaultValue(count,"0.0");
1571
                        addProjectionParameterDefaultValue(count,"1.0");
1572
                        addProjectionParameterDefaultValue(count,"0.0");
1573
                        addProjectionParameterDefaultValue(count,"0.0");
1574

    
1575
                        String[] parameterMaxValue={"90.0"};
1576
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1577
                        addProjectionParameterMaxValue(count,"90.0");
1578
                        addProjectionParameterMaxValue(count,"360.0");
1579
                        addProjectionParameterMaxValue(count,"10.0");
1580
                        addProjectionParameterMaxValue(count,"100000000.0");
1581
                        addProjectionParameterMaxValue(count,"100000000.0");
1582

    
1583
                        String[] parameterMinValue={"-90.0"};
1584
                        projectionParameterMinValueList.add(count,parameterMinValue);
1585
                        addProjectionParameterMinValue(count,"-90.0");
1586
                        addProjectionParameterMinValue(count,"-360.0");
1587
                        addProjectionParameterMinValue(count,"0.0");
1588
                        addProjectionParameterMinValue(count,"-100000000.0");
1589
                        addProjectionParameterMinValue(count,"-100000000.0");
1590

    
1591
                        String[] projectionAcronym={"stere"};
1592
                        projectionAcronymList.add(count,projectionAcronym);
1593
                }
1594

    
1595
                count++;
1596
                {// Polyconic
1597
                        String[] projectionName={"Polyconic"};
1598
                        projectionNameList.add(count,projectionName);
1599
                        addProjectionName(count,"American_Polyconic");
1600
                        addProjectionName(count,"American Polyconic");
1601
                        addProjectionName(count,"9818");
1602

    
1603
                        String[] parameterName={"latitude_of_origin"};
1604
                        projectionParameterList.add(count,parameterName);
1605
                        addProjectionParameter(count,"central_meridian");
1606
                        addProjectionParameter(count,"false_easting");
1607
                        addProjectionParameter(count,"false_northing");
1608

    
1609
                        String[] parameterAcronym={"lat_0"};
1610
                        projectionParameterAcronymList.add(count,parameterAcronym);
1611
                        addProjectionParameterAcronymList(count,"lon_0");
1612
                        addProjectionParameterAcronymList(count,"x_0");
1613
                        addProjectionParameterAcronymList(count,"y_0");
1614

    
1615
                        String[] parameterDefaultValue={"0.0"};
1616
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1617
                        addProjectionParameterDefaultValue(count,"0.0");
1618
                        addProjectionParameterDefaultValue(count,"0.0");
1619
                        addProjectionParameterDefaultValue(count,"0.0");
1620

    
1621
                        String[] parameterMaxValue={"90.0"};
1622
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1623
                        addProjectionParameterMaxValue(count,"360.0");
1624
                        addProjectionParameterMaxValue(count,"100000000.0");
1625
                        addProjectionParameterMaxValue(count,"100000000.0");
1626

    
1627
                        String[] parameterMinValue={"-90.0"};
1628
                        projectionParameterMinValueList.add(count,parameterMinValue);
1629
                        addProjectionParameterMinValue(count,"-360.0");
1630
                        addProjectionParameterMinValue(count,"-100000000.0");
1631
                        addProjectionParameterMinValue(count,"-100000000.0");
1632

    
1633
                        String[] projectionAcronym={"poly"};
1634
                        projectionAcronymList.add(count,projectionAcronym);
1635
                }
1636

    
1637
                count++;
1638
                {// Robinson
1639
                        String[] projectionName={"Robinson"};
1640
                        projectionNameList.add(count,projectionName);
1641

    
1642
                        String[] parameterName={"longitude_of_center"};
1643
                        projectionParameterList.add(count,parameterName);
1644
                        addProjectionParameter(count,"false_easting");
1645
                        addProjectionParameter(count,"false_northing");
1646

    
1647
                        String[] parameterAcronym={"lon_0"};
1648
                        projectionParameterAcronymList.add(count,parameterAcronym);
1649
                        addProjectionParameterAcronymList(count,"x_0");
1650
                        addProjectionParameterAcronymList(count,"y_0");
1651

    
1652
                        String[] parameterDefaultValue={"0.0"};
1653
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1654
                        addProjectionParameterDefaultValue(count,"0.0");
1655
                        addProjectionParameterDefaultValue(count,"0.0");
1656

    
1657
                        String[] parameterMaxValue={"360.0"};
1658
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1659
                        addProjectionParameterMaxValue(count,"100000000.0");
1660
                        addProjectionParameterMaxValue(count,"100000000.0");
1661

    
1662
                        String[] parameterMinValue={"-360.0"};
1663
                        projectionParameterMinValueList.add(count,parameterMinValue);
1664
                        addProjectionParameterMinValue(count,"-100000000.0");
1665
                        addProjectionParameterMinValue(count,"-100000000.0");
1666

    
1667
                        String[] projectionAcronym={"robin"};
1668
                        projectionAcronymList.add(count,projectionAcronym);
1669
                }
1670

    
1671
                //         Rosenmund Oblique Mercator - No en EPSG
1672

    
1673
                count++;
1674
                {// Sinusoidal
1675
                        String[] projectionName={"Sinusoidal"};
1676
                        projectionNameList.add(count,projectionName);
1677

    
1678
                        String[] parameterName={"longitude_of_center"};
1679
                        projectionParameterList.add(count,parameterName);
1680
                        addProjectionParameter(count,"false_easting");
1681
                        addProjectionParameter(count,"false_northing");
1682

    
1683
                        String[] parameterAcronym={"lon_0"};
1684
                        projectionParameterAcronymList.add(count,parameterAcronym);
1685
                        addProjectionParameterAcronymList(count,"x_0");
1686
                        addProjectionParameterAcronymList(count,"y_0");
1687

    
1688
                        String[] parameterDefaultValue={"0.0"};
1689
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1690
                        addProjectionParameterDefaultValue(count,"0.0");
1691
                        addProjectionParameterDefaultValue(count,"0.0");
1692

    
1693
                        String[] parameterMaxValue={"360.0"};
1694
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1695
                        addProjectionParameterMaxValue(count,"100000000.0");
1696
                        addProjectionParameterMaxValue(count,"100000000.0");
1697

    
1698
                        String[] parameterMinValue={"-360.0"};
1699
                        projectionParameterMinValueList.add(count,parameterMinValue);
1700
                        addProjectionParameterMinValue(count,"-100000000.0");
1701
                        addProjectionParameterMinValue(count,"-100000000.0");
1702

    
1703
                        String[] projectionAcronym={"sinu"};
1704
                        projectionAcronymList.add(count,projectionAcronym);
1705
                }
1706

    
1707
                count++;
1708
                {// Swiss_Oblique_Cylindrical
1709
                        String[] projectionName={"Swiss_Oblique_Cylindrical"};
1710
                        projectionNameList.add(count,projectionName);
1711
                        addProjectionName(count,"Swiss Oblique Cylindrical");
1712
                        addProjectionName(count,"Swiss Oblique Mercator");
1713
                        addProjectionName(count,"9814");
1714

    
1715
                        String[] parameterName={"latitude_of_origin"};
1716
                        projectionParameterList.add(count,parameterName);
1717
                        addProjectionParameter(count,"central_meridian");
1718
                        addProjectionParameter(count,"false_easting");
1719
                        addProjectionParameter(count,"false_northing");
1720

    
1721
                        String[] parameterAcronym={"lat_0"};
1722
                        projectionParameterAcronymList.add(count,parameterAcronym);
1723
                        addProjectionParameterAcronymList(count,"lon_0");
1724
                        addProjectionParameterAcronymList(count,"x_0");
1725
                        addProjectionParameterAcronymList(count,"y_0");
1726

    
1727
                        String[] parameterDefaultValue={"0.0"};
1728
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1729
                        addProjectionParameterDefaultValue(count,"0.0");
1730
                        addProjectionParameterDefaultValue(count,"0.0");
1731
                        addProjectionParameterDefaultValue(count,"0.0");
1732

    
1733
                        String[] parameterMaxValue={"90.0"};
1734
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1735
                        addProjectionParameterMaxValue(count,"360.0");
1736
                        addProjectionParameterMaxValue(count,"100000000.0");
1737
                        addProjectionParameterMaxValue(count,"100000000.0");
1738

    
1739
                        String[] parameterMinValue={"-90.0"};
1740
                        projectionParameterMinValueList.add(count,parameterMinValue);
1741
                        addProjectionParameterMinValue(count,"-360.0");
1742
                        addProjectionParameterMinValue(count,"-100000000.0");
1743
                        addProjectionParameterMinValue(count,"-100000000.0");
1744

    
1745
                        String[] projectionAcronym={"somerc"};
1746
                        projectionAcronymList.add(count,projectionAcronym);
1747
                }
1748

    
1749
                count++;
1750
                {// Stereographic
1751
                        String[] projectionName={"Stereographic"};
1752
                        projectionNameList.add(count,projectionName);
1753

    
1754
                        String[] parameterName={"latitude_of_origin"};
1755
                        projectionParameterList.add(count,parameterName);
1756
                        addProjectionParameter(count,"central_meridian");
1757
                        addProjectionParameter(count,"scale_factor");
1758
                        addProjectionParameter(count,"false_easting");
1759
                        addProjectionParameter(count,"false_northing");
1760

    
1761
                        String[] parameterAcronym={"lat_0"};
1762
                        projectionParameterAcronymList.add(count,parameterAcronym);
1763
                        addProjectionParameterAcronymList(count,"lon_0");
1764
                        addProjectionParameterAcronymList(count,"k");
1765
                        addProjectionParameterAcronymList(count,"x_0");
1766
                        addProjectionParameterAcronymList(count,"y_0");
1767

    
1768
                        String[] parameterDefaultValue={"0.0"};
1769
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1770
                        addProjectionParameterDefaultValue(count,"0.0");
1771
                        addProjectionParameterDefaultValue(count,"1.0");
1772
                        addProjectionParameterDefaultValue(count,"0.0");
1773
                        addProjectionParameterDefaultValue(count,"0.0");
1774

    
1775
                        String[] parameterMaxValue={"90.0"};
1776
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1777
                        addProjectionParameterMaxValue(count,"360.0");
1778
                        addProjectionParameterMaxValue(count,"10.0");
1779
                        addProjectionParameterMaxValue(count,"100000000.0");
1780
                        addProjectionParameterMaxValue(count,"100000000.0");
1781

    
1782
                        String[] parameterMinValue={"-90.0"};
1783
                        projectionParameterMinValueList.add(count,parameterMinValue);
1784
                        addProjectionParameterMinValue(count,"-360.0");
1785
                        addProjectionParameterMinValue(count,"0.0");
1786
                        addProjectionParameterMinValue(count,"-100000000.0");
1787
                        addProjectionParameterMinValue(count,"-100000000.0");
1788

    
1789
                        String[] projectionAcronym={"stere"};
1790
                        projectionAcronymList.add(count,projectionAcronym);
1791
                }
1792

    
1793
                count++;
1794
                {// Transverse_Mercator
1795
                        String[] projectionName={"Transverse_Mercator"};
1796
                        projectionNameList.add(count,projectionName);
1797
                        addProjectionName(count,"Transverse Mercator");
1798
                        addProjectionName(count,"Gauss-Kruger");
1799
                        addProjectionName(count,"9807");
1800

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

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

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

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

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

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

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

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

1854
                        String[] parameterAcronym={"lat_0"};
1855
                        projectionParameterAcronymList.add(count,parameterAcronym);
1856
                        addProjectionParameterAcronymList(count,"lon_0");
1857
                        addProjectionParameterAcronymList(count,"x_0");
1858
                        addProjectionParameterAcronymList(count,"y_0");
1859

1860
                        String[] parameterDefaultValue={"0.0"};
1861
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1862
                        addProjectionParameterDefaultValue(count,"0.0");
1863
                        addProjectionParameterDefaultValue(count,"0.0");
1864
                        addProjectionParameterDefaultValue(count,"0.0");
1865

1866
                        String[] parameterMaxValue={"90.0"};
1867
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1868
                        addProjectionParameterMaxValue(count,"360.0");
1869
                        addProjectionParameterMaxValue(count,"100000000.0");
1870
                        addProjectionParameterMaxValue(count,"100000000.0");
1871

1872
                        String[] parameterMinValue={"-90.0"};
1873
                        projectionParameterMinValueList.add(count,parameterMinValue);
1874
                        addProjectionParameterMinValue(count,"-360.0");
1875
                        addProjectionParameterMinValue(count,"-100000000.0");
1876
                        addProjectionParameterMinValue(count,"-100000000.0");
1877

1878
                        String[] projectionAcronym={"cass"};
1879
                        projectionAcronymList.add(count,projectionAcronym);
1880
                }
1881
                */
1882

    
1883
                count++;
1884
                {// VanDerGrinten
1885
                        String[] projectionName={"VanDerGrinten"};
1886
                        projectionNameList.add(count,projectionName);
1887
                        addProjectionName(count,"VanDerGrinten I");
1888

    
1889
                        String[] parameterName={"central_meridian"};
1890
                        projectionParameterList.add(count,parameterName);
1891
                        addProjectionParameter(count,"false_easting");
1892
                        addProjectionParameter(count,"false_northing");
1893

    
1894
                        String[] parameterAcronym={"lon_0"};
1895
                        projectionParameterAcronymList.add(count,parameterAcronym);
1896
                        addProjectionParameterAcronymList(count,"x_0");
1897
                        addProjectionParameterAcronymList(count,"y_0");
1898

    
1899
                        String[] parameterDefaultValue={"0.0"};
1900
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1901
                        addProjectionParameterDefaultValue(count,"0.0");
1902
                        addProjectionParameterDefaultValue(count,"0.0");
1903

    
1904
                        String[] parameterMaxValue={"360.0"};
1905
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1906
                        addProjectionParameterMaxValue(count,"100000000.0");
1907
                        addProjectionParameterMaxValue(count,"100000000.0");
1908

    
1909
                        String[] parameterMinValue={"-360.0"};
1910
                        projectionParameterMinValueList.add(count,parameterMinValue);
1911
                        addProjectionParameterMinValue(count,"-100000000.0");
1912
                        addProjectionParameterMinValue(count,"-100000000.0");
1913

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

    
2224
        public String exportToProj4(Crs crs) throws CrsException
2225
        {
2226
                String strProj4="+proj=";
2227
                String strDatumName="";
2228
                String strDatumCode="";
2229
                String strProj4Datum="";
2230
                String[] primeMeridian=crs.getCrsWkt().getPrimen();
2231
                String primeMeridianName=primeMeridian[0];
2232
                double primeMeridianValue=Double.parseDouble(primeMeridian[1]); // -> hacer el cambio de unidades
2233
                String[] strPrimeMeridianProj4=primeMeridianToProj4(primeMeridianName,primeMeridianValue);
2234
                primeMeridianValue=Double.parseDouble(strPrimeMeridianProj4[1]);
2235
                primeMeridianName=strPrimeMeridianProj4[0];
2236
                String primeMeridianAcronym=strPrimeMeridianProj4[2]; // Puede ser cadena vacia->Analizar
2237

    
2238
                // Extracci?n del c?digo de Datum
2239
                String codDatum="0";
2240
                strDatumName=crs.getCrsWkt().getDatumName();
2241
        int intCodDatum=0;//Integer.parseInt(codDatum);
2242
        strProj4Datum=datumToProj4(strDatumName,intCodDatum);
2243
        
2244
        String parameter_unit = crs.getCrsWkt().getUnit_p()[1];
2245

    
2246

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

    
2625
                }
2626
                else if (crs instanceof DefaultGeographicCRS) {
2627
                        DefaultGeographicCRS crsGeographic = (DefaultGeographicCRS) crs;
2628
                        primeMeridian = Primem(((DefaultGeodeticDatum) crsGeographic.getDatum()).getPrimeMeridian());
2629
                        spheroid = Spheroid(((DefaultGeodeticDatum) crsGeographic.getDatum()).getEllipsoid());
2630
                        elipName=spheroid[0];
2631
                        a=Double.parseDouble(spheroid[1]);
2632
                        inv_f=Double.parseDouble(spheroid[2]);
2633
                        // Extracci?n del c?digo de Datum
2634
                        String codDatum="0";
2635
                        String[] val=((DefaultGeographicCRS)crs).getDatum().getName().toString().split(":");
2636
                        if (val.length<2)
2637
                                strDatumName=val[0];
2638
                        else
2639
                                strDatumName=val[1];
2640
                for (Iterator iter =((DefaultGeographicCRS)crs).getDatum().getIdentifiers().iterator();iter.hasNext();) {
2641
                    Identifier element = (Identifier) iter.next();
2642
                    codDatum = element.getCode();          
2643
                }
2644
                int intCodDatum=Integer.parseInt(codDatum);
2645
                strProj4Datum=datumToProj4(strDatumName,intCodDatum);
2646
                }
2647
                else {
2648
                        throw(new CrsException(new Exception("El CRS no es ni geogr?fico ni proyectado")));
2649
                }
2650
                
2651
                String primeMeridianName=primeMeridian[0];
2652
                double primeMeridianValue = -1;
2653
                if (primeMeridian[1] == null) {
2654
                        throw(new CrsException(new Exception("Falla algun parametro del prime meridian")));
2655
                } else {
2656
                        primeMeridianValue=Double.parseDouble(primeMeridian[1]); // -> hacer el cambio de unidades
2657
                }                
2658
                String[] strPrimeMeridianProj4=primeMeridianToProj4(primeMeridianName,primeMeridianValue);
2659
                primeMeridianValue=Double.parseDouble(strPrimeMeridianProj4[1]);
2660
                primeMeridianName=strPrimeMeridianProj4[0];
2661
                String primeMeridianAcronym=strPrimeMeridianProj4[2]; // Puede ser cadena vacia->Analizar
2662

    
2663
                if(strProj.equals(""))
2664
                {
2665
                        //System.out.println("Projection Name = "+"Geodetic");
2666
                        strProj4+="longlat ";
2667
                }
2668
                else
2669
                {
2670
                        int indexProj=findProjection(strProjName);
2671
                        if(indexProj==-1)
2672
                        {
2673
                                System.out.println("La proyeccion "+strProjName+" no figura en Proj4");
2674
                                throw(new CrsException(new Exception("La proyeccion "+strProjName+" no figura en Proj4")));
2675
                        }
2676
                        String projectionName=(getProj4ProjectionName(indexProj)).trim();
2677
                        ArrayList parameterNames=getProj4ProjectionParameters(indexProj);
2678
                        ArrayList parameterAcronyms=getProj4ProjectionParameterAcronyms(indexProj);
2679
                        ArrayList parameterValues=getProj4ProjectionParameterDefaultValues(indexProj);
2680
                        ArrayList parameterMaxValues=getProj4ProjectionParameterMaxValues(indexProj);
2681
                        ArrayList parameterMinValues=getProj4ProjectionParameterMinValues(indexProj);
2682
                        for(int i=0;i<parameterNames.size();i++)
2683
                        {
2684
                                boolean existsParameter=false;
2685
                                String parameterValue="";
2686
                                for(int j=0;j<gtParameterNames.length;j++)
2687
                                {
2688
                                        String gtParameterName=gtParameterNames[j].trim();
2689
                                        //System.out.println( gtParameterName);
2690
                                        //int posGtParameter=findProjectionParameter(gtParameterName);
2691
                                        int posGtParameter=findProjectionParameters(gtParameterName,(String)parameterNames.get(i));
2692
                                        //int posParameter=findProjectionParameter((String)parameterNames.get(i));
2693
                                        //if(((String)parameterNames.get(i)).trim().equals(gtParameterNames[j].trim()))
2694
                                        if(posGtParameter!=-1)
2695
                                        {
2696
                                                gtParameterName=getProj4ProjectionParameterName(posGtParameter);
2697
                                                gtParameterNames[j]=gtParameterName;
2698
                                                existsParameter=true;
2699
                                                double maxValue=Double.parseDouble((String)parameterMaxValues.get(i));
2700
                                                double minValue=Double.parseDouble((String)parameterMinValues.get(i));
2701
                                                //parameterValue=Double.parseDouble(gtParameterValues[j]);
2702
                                                parameterValue=gtParameterValues[j]; // Ojo unidades -> analizar
2703
                                                double auxValue=Double.parseDouble(parameterValue);
2704
                                                if((auxValue<minValue)||(auxValue>maxValue))
2705
                                                {
2706
                                                        String strError="El parametro ";
2707
                                                        strError+=gtParameterName;
2708
                                                        strError+=" esta fuera de dominio";
2709
                                                        System.out.println(strError);
2710
                                                        throw new CrsException(new Exception());
2711
                                                }
2712
                                                else if (((String)parameterNames.get(i)).trim().equals("scale_factor") && (auxValue==minValue)) {
2713
                                                        String strError="El parametro ";
2714
                                                        strError+=gtParameterName;
2715
                                                        strError+=" esta fuera de dominio";
2716
                                                        System.out.println(strError);
2717
                                                        throw new CrsException(new Exception());
2718
                                                }
2719
                                                break;
2720
                                        }
2721
                                        /*else
2722
                                        {
2723
                                                String strError="El parametro recibido de GeoTools ";
2724
                                                strError+=gtParameterName;
2725
                                                strError+=" no esta contemplado en la proyeccion";
2726
                                                System.out.println(strError);
2727
                                                throw new CrsException(new Exception());
2728
                                        }*/
2729
                                }
2730
                                if(existsParameter)
2731
                                {
2732
                                        parameterValues.set(i,parameterValue);
2733
                                }                        
2734
                        }
2735
                        boolean isSomerc=false;
2736
                        boolean isOmerc=false;
2737
                        String[] projectionAcronym=(String[])projectionAcronymList.get(indexProj);
2738
                        if(projectionName.equals("Oblique_Mercator"))
2739
                        {
2740
                                isOmerc=true;
2741
                                /*
2742
                                boolean azimuthSwiss=false;
2743
                                boolean rectifiedGridAngleSwiss=false;
2744
                                for(int j=0;j<gtParameterNames.length;j++)
2745
                                {
2746
                                        String gtParameterName=gtParameterNames[j].trim();
2747
                                        if(gtParameterName.equalsIgnoreCase("azimuth"))
2748
                                        {
2749
                                                double dif=Double.parseDouble(gtParameterValues[j])-90.0;
2750
                                                if(Math.abs(dif)<0.0001)
2751
                                                        azimuthSwiss=true;
2752
                                        }
2753
                                        if(gtParameterName.equalsIgnoreCase("rectified_grid_angle"))
2754
                                        {
2755
                                                double dif=Double.parseDouble(gtParameterValues[j])-90.0;
2756
                                                if(Math.abs(dif)<0.0001)
2757
                                                                rectifiedGridAngleSwiss=true;
2758
                                        }
2759
                                        if(azimuthSwiss&&rectifiedGridAngleSwiss)
2760
                                        {
2761
                                                String[] prjAc={"somerc"};
2762
                                                projectionAcronym=prjAc;
2763
                                                isSomerc=true;
2764
                                                isOmerc=false;
2765
                                        }
2766
                                }
2767
                                */
2768
                                
2769
                                // Necesito buscar un caso de ejemplo
2770
                        }
2771
                        strProj4=strProj4+projectionAcronym[0]+" ";
2772
                        String strExtraProj4="";
2773
                        // Control de casos especiales
2774
                        boolean isLaborde=false;
2775
                        boolean isMerc=false;
2776
                        boolean exists_sf=false;
2777
                        boolean exists_lo=false;
2778
                        if(projectionAcronym[0].equals("merc")) // 1 - Mercator
2779
                        {
2780
                                isMerc=true;
2781
                                double value_sf=0.0;
2782
                                double value_lo=0.0;
2783
                                for(int j=0;j<gtParameterNames.length;j++)
2784
                                {
2785
                                        String gtParameterName=gtParameterNames[j].trim();
2786
                                        if(gtParameterName.equalsIgnoreCase("latitude_of_origin")
2787
                                                        ||gtParameterName.equalsIgnoreCase("standard_parallel_1")
2788
                                                        ||gtParameterName.equalsIgnoreCase("latitude_of_center"))
2789
                                        {
2790
                                                exists_lo=true;
2791
                                                value_lo=Double.parseDouble(gtParameterValues[j]);
2792
                                        }
2793
                                        if(gtParameterName.equalsIgnoreCase("scale_factor"))
2794
                                        {
2795
                                                exists_sf=true;
2796
                                                value_sf=Double.parseDouble(gtParameterValues[j]);
2797
                                        }
2798
                                }
2799
                                if(exists_sf&&exists_lo)
2800
                                {
2801
                                        if(value_sf!=1.0&&value_lo!=0.0)
2802
                                        {
2803
                                                String strError="La proyeccion mercator no admite scale_factor!=1.0 y latittude_of_origin!=0.0";
2804
                                                System.out.println(strError);
2805
                                                throw new CrsException(new Exception());
2806
                                        }
2807
                                        else if(projectionName.equals("Mercator_1SP"))
2808
                                                exists_lo=false;
2809
                                        else if(projectionName.equals("Mercator_2SP"))
2810
                                                exists_sf=false;
2811
                                        /*
2812
                                        else if(value_sf!=1.0)
2813
                                                exists_lo=false;
2814
                                        else if(value_sf==1.0)
2815
                                                exists_sf=false;
2816
                                        */
2817
                                }
2818
                        }
2819
                        else if(projectionAcronym[0].equals("stere"))
2820
                        {
2821
                                if(projectionName.equalsIgnoreCase("Polar_Stereographic")) // lat_ts=lat_0={90 o -90)
2822
                                {
2823
                                        boolean isNorthPole=true;
2824
                                        for(int j=0;j<gtParameterNames.length;j++)
2825
                                        {
2826
                                                String gtParameterName=gtParameterNames[j].trim();
2827
                                                if(gtParameterName.equalsIgnoreCase("latitude_of_origin"))
2828
                                                {
2829
                                                        double gtParameterValue=Double.parseDouble(gtParameterValues[j]);
2830
                                                        if(gtParameterValue==90.0) isNorthPole=true;
2831
                                                        else if(gtParameterValue==-90.0)  isNorthPole=false;
2832
                                                        else
2833
                                                        {
2834
                                                                String strError="La proyeccin estereogrfica polar debe tener latitud origen 90 o -90";
2835
                                                                System.out.println(strError);
2836
                                                                throw new CrsException(new Exception());
2837
                                                        }
2838
                                                        break;
2839
                                                }
2840
                                        }
2841
                                        String strLatitudeOrigin="90.0";
2842
                                        if(!isNorthPole) strLatitudeOrigin="-90.0";
2843
                                        for(int k=0;k<parameterNames.size();k++)
2844
                                        {
2845
                                                String parameterName=(String)parameterNames.get(k);
2846
                                                if(parameterName.equalsIgnoreCase("latitude_of_origin"))
2847
                                                {
2848
                                                        parameterValues.set(k,strLatitudeOrigin);
2849
                                                }
2850
                                        }
2851
                                }
2852
                        }
2853
                        else if(projectionAcronym[0].equals("mill"))
2854
                        {
2855
                                strExtraProj4="+R_A ";
2856
                        }
2857
                        else if(projectionAcronym[0].equals("vandg"))
2858
                        {
2859
                                strExtraProj4="+R_A ";
2860
                        }
2861
                        else if(projectionAcronym[0].equals("labrd"))
2862
                        {
2863
                                isLaborde=true;
2864
                        }
2865
                        
2866
                        
2867
                        for(int i=0;i<parameterNames.size();i++)
2868
                        {
2869
                                boolean control=true;
2870
                                String parameterName=((String)parameterNames.get(i)).trim();
2871
                                String parameterAcronym=((String)parameterAcronyms.get(i)).trim();
2872
                                String strParameterValue=((String)parameterValues.get(i)).trim();
2873
                                if(isMerc)
2874
                                {
2875
                                        if(parameterName.equalsIgnoreCase("latitude_of_origin")
2876
                                                        ||parameterName.equalsIgnoreCase("standard_parallel_1")
2877
                                                        ||parameterName.equalsIgnoreCase("latitude_of_center"))
2878
                                        {
2879
                                                if(!exists_lo)
2880
                                                        control=false;
2881
                                        }
2882
                                        if(parameterName.equalsIgnoreCase("scale_factor"))
2883
                                        {
2884
                                                if(!exists_sf)
2885
                                                        control=false;
2886
                                        }
2887
                                }
2888
                                if(isSomerc)
2889
                                {
2890
                                        if(parameterName.equals("rectified_grid_angle"))
2891
                                                control=false;
2892
                                        if(parameterName.equals("azimuth"))
2893
                                                control=false;
2894
                                }
2895
                                if(isOmerc)
2896
                                {
2897
                                        if(parameterName.equals("rectified_grid_angle"))
2898
                                                control=false;
2899
                                }
2900
                                if(parameterAcronym.equals("lon_0")
2901
                                                ||parameterAcronym.equals("lonc"))
2902
                                {
2903
                                        double parameterValue=Double.parseDouble(strParameterValue);
2904
                                        parameterValue=parameterValue-primeMeridianValue;
2905
                                        strParameterValue=Double.toString(parameterValue);
2906
                                }
2907
                                if(control)
2908
                                        strProj4=strProj4+"+"+parameterAcronym+"="+strParameterValue+" ";
2909
                        }
2910
                        if(isLaborde)
2911
                                strProj4+="+azi=18.9 +lat_0=-18.9 +lon_0=44.1 +k_0=0.9995 +x_0=400000 +y_0=800000 +ellps=intl ";
2912
                        strProj4+=strExtraProj4;
2913
                        //getProj4ProjectionName();
2914
                }
2915
                
2916
                // Que pasa si no hay elipsoide? -> OGR por defecto pone WGS84
2917
                String strEllipseAcronym=ellipseToProj4(a,inv_f);
2918
                String strEllipse="";
2919
                if(strEllipseAcronym.equals(""))
2920
                {
2921
                        if (!Double.isInfinite(inv_f))
2922
                                strEllipse="+a="+a+" +rf="+inv_f+" ";
2923
                        else
2924
                                strEllipse="+R="+a+" ";
2925
                }
2926
                else
2927
                {
2928
                        strEllipse="+ellps="+strEllipseAcronym+" ";
2929
                }
2930
                strProj4+=strEllipse;
2931
                //System.out.println("Elipsoide["+elipName+"]=("+a+","+inv_f+")");
2932
                strProj4+=primeMeridianAcronym;
2933
                if(!strProj4Datum.equals(""))
2934
                        strProj4+=strProj4Datum;
2935
                if(!strProj4ToMeter.equals(""))
2936
                        strProj4+=strProj4ToMeter;
2937
                String strWkt=crs.toWKT();
2938
                
2939
                //System.out.println("- Cadena proj4: "+strProj4);
2940
                return strProj4;                
2941
        }
2942

    
2943
        private String[] primeMeridianToProj4(String pmName,double pmValue) throws CrsException
2944
        {
2945
            String[] primeMeridian=new String[3];
2946
                String pszPM="";
2947
                String acronym="";
2948
            double dfFromGreenwich = 0.0;
2949
            double tolerance=0.002/3600.0;
2950
            int    nPMCode = -1;
2951

    
2952
            dfFromGreenwich=-(9+7/60.0+54.862/3600.0);
2953
        if(pmName.equalsIgnoreCase("lisbon")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
2954
        {
2955
            pszPM="lisbon";
2956
            nPMCode = 8902;
2957
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
2958
            {
2959
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
2960
                                System.out.println(strError);
2961
                                //throw new CrsException(new Exception());
2962
            }
2963
            pmValue=dfFromGreenwich;
2964
            acronym="+pm="+pszPM+" ";
2965
        }
2966
        
2967
        dfFromGreenwich=(2+20/60.0+14.025/3600.0); 
2968
        if(pmName.equalsIgnoreCase("paris")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
2969
        {
2970
            pszPM="paris";
2971
            nPMCode = 8903;
2972
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
2973
            {
2974
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
2975
                                System.out.println(strError);
2976
                                //throw new CrsException(new Exception());
2977
            }
2978
            pmValue=dfFromGreenwich;
2979
            acronym="+pm="+pszPM+" ";
2980
        }
2981
        
2982
        dfFromGreenwich=-(74+4/60.0+51.3/3600.0);
2983
        if(pmName.equalsIgnoreCase("bogota")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
2984
        {
2985
            pszPM="bogota";
2986
            nPMCode = 8904;
2987
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
2988
            {
2989
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
2990
                                System.out.println(strError);
2991
                                //throw new CrsException(new Exception());
2992
            }
2993
            pmValue=dfFromGreenwich;
2994
            acronym="+pm="+pszPM+" ";
2995
        }
2996
        
2997
        dfFromGreenwich=-(3+41/60.0+16.58/3600.0);  // mal en ogr los segundos pone 16.48
2998
        if(pmName.equalsIgnoreCase("madrid")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
2999
        {
3000
            pszPM="madrid";
3001
            nPMCode = 8905;
3002
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
3003
            {
3004
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
3005
                                System.out.println(strError);
3006
                                //throw new CrsException(new Exception());
3007
            }
3008
            pmValue=dfFromGreenwich;
3009
            acronym="+pm="+pszPM+" ";
3010
        }
3011
        
3012
        dfFromGreenwich=(12+27/60.0+8.4/3600.0);
3013
        if(pmName.equalsIgnoreCase("rome")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
3014
        {
3015
            pszPM="rome";
3016
            nPMCode = 8906;
3017
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
3018
            {
3019
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
3020
                                System.out.println(strError);
3021
                                //throw new CrsException(new Exception());
3022
            }
3023
            pmValue=dfFromGreenwich;
3024
            acronym="+pm="+pszPM+" ";
3025
        }
3026
        
3027
        dfFromGreenwich=(7+26/60.0+22.5/3600.0);
3028
        if(pmName.equalsIgnoreCase("bern")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
3029
        {
3030
            pszPM="bern";
3031
            nPMCode = 8907;
3032
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
3033
            {
3034
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
3035
                                System.out.println(strError);
3036
                                //throw new CrsException(new Exception());
3037
            }
3038
            pmValue=dfFromGreenwich;
3039
            acronym="+pm="+pszPM+" ";
3040
        }
3041
        
3042
        dfFromGreenwich=(106+48/60.0+27.79/3600.0);
3043
        if(pmName.equalsIgnoreCase("jakarta")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
3044
        {
3045
            pszPM="jakarta";
3046
            nPMCode = 8908;
3047
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
3048
            {
3049
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
3050
                                System.out.println(strError);
3051
                                //throw new CrsException(new Exception());
3052
            }
3053
            pmValue=dfFromGreenwich;
3054
            acronym="+pm="+pszPM+" ";
3055
        }
3056
        
3057
        dfFromGreenwich=-(17+40/60.0+0.0/3600.0);
3058
        if(pmName.equalsIgnoreCase("ferro")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
3059
        {
3060
            pszPM="ferro";
3061
            nPMCode = 8909;
3062
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
3063
            {
3064
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
3065
                                System.out.println(strError);
3066
                                //throw new CrsException(new Exception());
3067
            }
3068
            pmValue=dfFromGreenwich;
3069
            acronym="+pm="+pszPM+" ";
3070
        }
3071
        
3072
        dfFromGreenwich=(4+22/60.0+4.71/3600.0);
3073
        if(pmName.equalsIgnoreCase("brussels")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
3074
        {
3075
            pszPM="brussels";
3076
            nPMCode = 8910;
3077
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
3078
            {
3079
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
3080
                                System.out.println(strError);
3081
                                //throw new CrsException(new Exception());
3082
            }
3083
            pmValue=dfFromGreenwich;
3084
            acronym="+pm="+pszPM+" ";
3085
        }
3086
        
3087
        dfFromGreenwich=(18+3/60.0+29.8/3600.0);
3088
        if(pmName.equalsIgnoreCase("stockholm")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
3089
        {
3090
            pszPM="stockholm";
3091
            nPMCode = 8911;
3092
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
3093
            {
3094
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
3095
                                System.out.println(strError);
3096
                                //throw new CrsException(new Exception());
3097
            }
3098
            pmValue=dfFromGreenwich;
3099
            acronym="+pm="+pszPM+" ";
3100
        }
3101
        
3102
        dfFromGreenwich=(23+42/60.0+58.815/3600.0);
3103
        if(pmName.equalsIgnoreCase("athens")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
3104
        {
3105
            pszPM="athens";
3106
            nPMCode = 8912;
3107
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
3108
            {
3109
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
3110
                                System.out.println(strError);
3111
                                //throw new CrsException(new Exception());
3112
            }
3113
            pmValue=dfFromGreenwich;
3114
            acronym="+pm="+pszPM+" ";
3115
        }
3116
        
3117
        dfFromGreenwich=(10+43/60.0+22.5/3600.0);
3118
        if(pmName.equalsIgnoreCase("oslo")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
3119
        {
3120
            pszPM="oslo";
3121
            nPMCode = 8913;
3122
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
3123
            {
3124
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
3125
                                System.out.println(strError);
3126
                                //throw new CrsException(new Exception());
3127
            }
3128
            pmValue=dfFromGreenwich;
3129
            acronym="+pm="+pszPM+" ";
3130
        }
3131
        
3132
        dfFromGreenwich=(0.0);
3133
        if(pmName.equalsIgnoreCase("Greenwich")||(Math.abs(dfFromGreenwich-pmValue)<tolerance))
3134
        {
3135
            pszPM="Greenwich";
3136
            nPMCode = 0;
3137
            if(Math.abs(dfFromGreenwich-pmValue)>tolerance)
3138
            {
3139
                                String strError="No concuerdan el nombre del meridiano origen y su valor";
3140
                                System.out.println(strError);
3141
                                //throw new CrsException(new Exception());
3142
            }
3143
            pmValue=dfFromGreenwich;
3144
        }
3145
        primeMeridian[0]=pszPM;
3146
        primeMeridian[1]=Double.toString(pmValue);
3147
        primeMeridian[2]=acronym;
3148
                return primeMeridian;
3149
        }
3150

    
3151
        private String ellipseToProj4(double dfSemiMajor, double dfInvFlattening)
3152
        {
3153
                double yo=Math.abs(4.5);
3154
                String pszPROJ4Ellipse="";
3155
            if( Math.abs(dfSemiMajor-6378249.145) < 0.01
3156
                && Math.abs(dfInvFlattening-293.465) < 0.0001 )
3157
            {
3158
                pszPROJ4Ellipse = "clrk80";     /* Clark 1880 */
3159
            }
3160
            else if( Math.abs(dfSemiMajor-6378245.0) < 0.01
3161
                     && Math.abs(dfInvFlattening-298.3) < 0.0001 )
3162
            {
3163
                pszPROJ4Ellipse = "krass";      /* Krassovsky */
3164
            }
3165
            else if( Math.abs(dfSemiMajor-6378388.0) < 0.01
3166
                     && Math.abs(dfInvFlattening-297.0) < 0.0001 )
3167
            {
3168
                pszPROJ4Ellipse = "intl";       /* International 1924 */
3169
            }
3170
            else if( Math.abs(dfSemiMajor-6378160.0) < 0.01
3171
                     && Math.abs(dfInvFlattening-298.25) < 0.0001 )
3172
            {
3173
                pszPROJ4Ellipse = "aust_SA";    /* Australian */
3174
            }
3175
            else if( Math.abs(dfSemiMajor-6377397.155) < 0.01
3176
                     && Math.abs(dfInvFlattening-299.1528128) < 0.0001 )
3177
            {
3178
                pszPROJ4Ellipse = "bessel";     /* Bessel 1841 */
3179
            }
3180
            else if( Math.abs(dfSemiMajor-6377483.865) < 0.01
3181
                     && Math.abs(dfInvFlattening-299.1528128) < 0.0001 )
3182
            {
3183
                pszPROJ4Ellipse = "bess_nam";   /* Bessel 1841 (Namibia / Schwarzeck)*/
3184
            }
3185
            else if( Math.abs(dfSemiMajor-6378160.0) < 0.01
3186
                     && Math.abs(dfInvFlattening-298.247167427) < 0.0001 )
3187
            {
3188
                pszPROJ4Ellipse = "GRS67";      /* GRS 1967 */
3189
            }
3190
            else if( Math.abs(dfSemiMajor-6378137) < 0.01
3191
                     && Math.abs(dfInvFlattening-298.257222101) < 0.000001 )
3192
            {
3193
                pszPROJ4Ellipse = "GRS80";      /* GRS 1980 */
3194
            }
3195
            else if( Math.abs(dfSemiMajor-6378206.4) < 0.01
3196
                     && Math.abs(dfInvFlattening-294.9786982) < 0.0001 )
3197
            {
3198
                pszPROJ4Ellipse = "clrk66";     /* Clarke 1866 */
3199
            }
3200
            else if( Math.abs(dfSemiMajor-6378206.4) < 0.01
3201
                     && Math.abs(dfInvFlattening-294.9786982) < 0.0001 )
3202
            {
3203
                pszPROJ4Ellipse = "mod_airy";   /* Modified Airy */
3204
            }
3205
            else if( Math.abs(dfSemiMajor-6377563.396) < 0.01
3206
                     && Math.abs(dfInvFlattening-299.3249646) < 0.0001 )
3207
            {
3208
                pszPROJ4Ellipse = "airy";       /* Modified Airy */
3209
            }
3210
            else if( Math.abs(dfSemiMajor-6378200) < 0.01
3211
                     && Math.abs(dfInvFlattening-298.3) < 0.0001 )
3212
            {
3213
                pszPROJ4Ellipse = "helmert";    /* Helmert 1906 */
3214
            }
3215
            else if( Math.abs(dfSemiMajor-6378155) < 0.01
3216
                     && Math.abs(dfInvFlattening-298.3) < 0.0001 )
3217
            {
3218
                pszPROJ4Ellipse = "fschr60m";   /* Modified Fischer 1960 */
3219
            }
3220
            else if( Math.abs(dfSemiMajor-6377298.556) < 0.01
3221
                     && Math.abs(dfInvFlattening-300.8017) < 0.0001 )
3222
            {
3223
                pszPROJ4Ellipse = "evrstSS";    /* Everest (Sabah & Sarawak) */
3224
            }
3225
            else if( Math.abs(dfSemiMajor-6378165.0) < 0.01
3226
                     && Math.abs(dfInvFlattening-298.3) < 0.0001 )
3227
            {
3228
                pszPROJ4Ellipse = "WGS60";      
3229
            }
3230
            else if( Math.abs(dfSemiMajor-6378145.0) < 0.01
3231
                     && Math.abs(dfInvFlattening-298.25) < 0.0001 )
3232
            {
3233
                pszPROJ4Ellipse = "WGS66";      
3234
            }
3235
            else if( Math.abs(dfSemiMajor-6378135.0) < 0.01
3236
                     && Math.abs(dfInvFlattening-298.26) < 0.0001 )
3237
            {
3238
                pszPROJ4Ellipse = "WGS72";      
3239
            }
3240
            else if( Math.abs(dfSemiMajor-6378137.0) < 0.01
3241
                     && Math.abs(dfInvFlattening-298.257223563) < 0.000001 )
3242
            {
3243
                pszPROJ4Ellipse = "WGS84";
3244
            }
3245
            /*
3246
            else if( EQUAL(pszDatum,"North_American_Datum_1927") )
3247
            {
3248
//                pszPROJ4Ellipse = "clrk66:+datum=nad27"; // NAD 27 
3249
                pszPROJ4Ellipse = "clrk66";
3250
            }
3251
            else if( EQUAL(pszDatum,"North_American_Datum_1983") )
3252
            {
3253
//                pszPROJ4Ellipse = "GRS80:+datum=nad83";       // NAD 83 
3254
                pszPROJ4Ellipse = "GRS80";
3255
            }
3256
            */
3257
            return pszPROJ4Ellipse;
3258
        }
3259

    
3260
        private String datumToProj4(String datumName,int epsgCode)
3261
        {
3262
            String datumProj4="";
3263
            String SRS_DN_NAD27="North_American_Datum_1927";
3264
            String SRS_DN_NAD83="North_American_Datum_1983";
3265
            String SRS_DN_WGS72="WGS_1972";
3266
            String SRS_DN_WGS84="WGS_1984";
3267
            if(datumName.equals(""))
3268
                    datumProj4="";
3269
                else if(datumName.equalsIgnoreCase(SRS_DN_NAD27) || epsgCode == 6267 )
3270
                        datumProj4 = "+datum=NAD27 ";
3271

    
3272
            else if(datumName.equalsIgnoreCase(SRS_DN_NAD83) || epsgCode == 6269 )
3273
                    datumProj4 = "+datum=NAD83 ";
3274

    
3275
            else if(datumName.equalsIgnoreCase(SRS_DN_WGS84) || epsgCode == 6326 )
3276
                    datumProj4 = "+datum=WGS84 ";
3277

    
3278
            else if( epsgCode == 6314 )
3279
                    datumProj4 = "+datum=potsdam ";
3280

    
3281
            else if( epsgCode == 6272 )
3282
                    datumProj4 = "+datum=nzgd49 ";
3283
                return datumProj4;
3284
        }
3285
        // Casos especiales
3286
        // - MERCATOR_1SP
3287
        // - HOTINE
3288
        // - MILLER
3289
        // - Polar_Stereographic
3290
        // - Polar_Stereographic
3291
        // - VanDerGrinten
3292
        // - Transverse Mercator
3293
        // - Cuando el meridiano origen no es 0 se pone pm=madrid y lon_0=
3294
        // +datum
3295
        
3296
        // Funciones privadas necesarias para el proceso
3297
        
3298
        private String getName(Identifier name) {
3299
                String[] correctName = name.toString().split(":");
3300
                if (correctName.length<2) 
3301
                        return correctName[0];
3302
                
3303
                else
3304
                        return correctName[1];
3305
        }
3306
        
3307
        private String[] Spheroid (Ellipsoid ellips) {
3308
                String[] spheroid = new String[3];
3309
                Unit u = ellips.getAxisUnit();
3310
                double semi_major = convert( ellips.getSemiMajorAxis(), u.toString());
3311
                //double inv_f = convert( ellips.getInverseFlattening(), u.toString());
3312
                double inv_f = ellips.getInverseFlattening();
3313
                String[] val =        ellips.getName().toString().split(":");
3314
                if (val.length<2)
3315
                        spheroid[0] = ellips.getName().toString().split(":")[0];
3316
                else
3317
                        spheroid[0] = ellips.getName().toString().split(":")[1];
3318
                spheroid[1] = String.valueOf(semi_major);
3319
                spheroid[2] = String.valueOf(inv_f);
3320
                return spheroid;
3321
        }
3322
        
3323
        private String[] Primem (PrimeMeridian prim) {
3324
                String[] primem = new String[2];
3325
                DefaultPrimeMeridian pm = (DefaultPrimeMeridian) prim;
3326
                Unit u = pm.getAngularUnit();
3327
                double value = convert( pm.getGreenwichLongitude(), u.toString());
3328
                String[] val = pm.getName().toString().split(":");
3329
                if (val.length<2)
3330
                        primem[0] = pm.getName().toString().split(":")[0];
3331
                else
3332
                        primem[0] = pm.getName().toString().split(":")[1];
3333
                primem[1] = String.valueOf(value);
3334
                return primem;
3335
        }
3336
        
3337
        public double convert(double value, String measure) throws ConversionException {
3338
                if (measure.equals("D.MS")) {                
3339
                        value *= this.divider;
3340
                int deg,min;
3341
                deg = (int) (value/10000); value -= 10000*deg;
3342
                min = (int) (value/  100); value -=   100*min;
3343
                if (min<=-60 || min>=60) {  // Accepts NaN
3344
                    if (Math.abs(Math.abs(min) - 100) <= EPS) {
3345
                        if (min >= 0) deg++; else deg--;
3346
                        min = 0;
3347
                    } else {
3348
                        throw new ConversionException("Invalid minutes: "+min);
3349
                    }
3350
                }
3351
                if (value<=-60 || value>=60) { // Accepts NaN
3352
                    if (Math.abs(Math.abs(value) - 100) <= EPS) {
3353
                        if (value >= 0) min++; else min--;
3354
                        value = 0;
3355
                    } else {
3356
                        throw new ConversionException("Invalid secondes: "+value);
3357
                    }
3358
                }
3359
                value = ((value/60) + min)/60 + deg;
3360
                return value;
3361
                }
3362
                if (measure.equals("grad") || measure.equals("grade")) 
3363
                        return ((value * 180.0) / 200.0);                        
3364
                if (measure.equals(""+(char)176)) 
3365
                        return value;                
3366
                if (measure.equals("DMS") ) 
3367
                        return value;                
3368
                if (measure.equals("m") || measure.startsWith("[m")) 
3369
                        return value;        
3370
                if (measure.equals("")) 
3371
                        return value;
3372
                if (measure.equalsIgnoreCase("ft")||measure.equalsIgnoreCase("foot")||measure.equalsIgnoreCase("feet")) 
3373
                        return (value*0.3048/1.0);
3374
                
3375
                throw new ConversionException("Conversion no contemplada: "+measure);
3376
    }
3377
        
3378
        public ArrayList getProjectionNameList(){
3379
                return projectionNameList;
3380
        }
3381
}