Statistics
| Revision:

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

History | View | Annotate | Download (120 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
                // Laborde_Oblique_Mercator - Similar a hotine_oblique_mercator
894

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

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

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

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

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

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

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

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

    
951
                        String[] parameterAcronym={"lat_1"};
952
                        projectionParameterAcronymList.add(count,parameterAcronym);
953
                        addProjectionParameterAcronymList(count,"lat_0");
954
                        addProjectionParameterAcronymList(count,"lon_0");
955
                        addProjectionParameterAcronymList(count,"k_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,"1.0");
964
                        addProjectionParameterDefaultValue(count,"0.0");
965
                        addProjectionParameterDefaultValue(count,"0.0");
966

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1104
                        String[] parameterAcronym={"lon_0"};
1105
                        projectionParameterAcronymList.add(count,parameterAcronym);
1106
                        addProjectionParameterAcronymList(count,"lat_ts"); // o lat_ts
1107
                        addProjectionParameterAcronymList(count,"k"); // o lat_ts
1108
                        addProjectionParameterAcronymList(count,"x_0");
1109
                        addProjectionParameterAcronymList(count,"y_0");
1110

    
1111
                        String[] parameterDefaultValue={"0.0"};
1112
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1113
                        addProjectionParameterDefaultValue(count,"0.0"); // o 0.0
1114
                        addProjectionParameterDefaultValue(count,"1.0"); // o 0.0
1115
                        addProjectionParameterDefaultValue(count,"0.0");
1116
                        addProjectionParameterDefaultValue(count,"0.0");
1117

    
1118
                        String[] parameterMaxValue={"360.0"};
1119
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1120
                        addProjectionParameterMaxValue(count,"90.0");
1121
                        addProjectionParameterMaxValue(count,"10.0");
1122
                        addProjectionParameterMaxValue(count,"100000000.0");
1123
                        addProjectionParameterMaxValue(count,"100000000.0");
1124

    
1125
                        String[] parameterMinValue={"-360.0"};
1126
                        projectionParameterMinValueList.add(count,parameterMinValue);
1127
                        addProjectionParameterMinValue(count,"-90.0");
1128
                        addProjectionParameterMinValue(count,"0.0");
1129
                        addProjectionParameterMinValue(count,"-100000000.0");
1130
                        addProjectionParameterMinValue(count,"-100000000.0");
1131

    
1132
                        String[] projectionAcronym={"merc"};
1133
                        projectionAcronymList.add(count,projectionAcronym);
1134
                }
1135
                
1136
                count++;
1137
                {// Mercator_2SP
1138
                        String[] projectionName={"Mercator_2SP"};
1139
                        projectionNameList.add(count,projectionName);
1140
                        addProjectionName(count,"Mercator");
1141
                        addProjectionName(count,"9805");
1142
                        addProjectionName(count, "Mercator (2SP)");
1143

    
1144
                        String[] parameterName={"central_meridian"};
1145
                        projectionParameterList.add(count,parameterName);
1146
                        addProjectionParameter(count,"standard_parallel_1");
1147
                        addProjectionParameter(count,"false_easting");
1148
                        addProjectionParameter(count,"false_northing");
1149

    
1150
                        String[] parameterAcronym={"lon_0"};
1151
                        projectionParameterAcronymList.add(count,parameterAcronym);
1152
                        addProjectionParameterAcronymList(count,"lat_ts");
1153
                        addProjectionParameterAcronymList(count,"x_0");
1154
                        addProjectionParameterAcronymList(count,"y_0");
1155

    
1156
                        String[] parameterDefaultValue={"0.0"};
1157
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1158
                        addProjectionParameterDefaultValue(count,"0.0"); // o 0.0
1159
                        addProjectionParameterDefaultValue(count,"0.0");
1160
                        addProjectionParameterDefaultValue(count,"0.0");
1161

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

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

    
1174
                        String[] projectionAcronym={"merc"};
1175
                        projectionAcronymList.add(count,projectionAcronym);
1176
                }
1177

    
1178
                count++;
1179
                {// Miller_Cylindrical
1180
                        String[] projectionName={"Miller_Cylindrical"};
1181
                        projectionNameList.add(count,projectionName);
1182
                        addProjectionName(count,"Miller Cylindrical");
1183

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

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

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

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

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

    
1214
                        String[] projectionAcronym={"mill"};
1215
                        projectionAcronymList.add(count,projectionAcronym);
1216
                }
1217
                
1218
                count++;
1219
                {// Mollweide
1220
                        String[] projectionName={"Mollweide"};
1221
                        projectionNameList.add(count,projectionName);
1222
                        addProjectionName(count,"Hornolographic");
1223
                        addProjectionName(count,"Babinet");
1224
                        addProjectionName(count,"Elliptical");
1225

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

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

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

    
1241
                        String[] parameterMaxValue={"360.0"};
1242
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1243
                        addProjectionParameterMaxValue(count,"100000000.0");
1244
                        addProjectionParameterMaxValue(count,"100000000.0");
1245

    
1246
                        String[] parameterMinValue={"-360.0"};
1247
                        projectionParameterMinValueList.add(count,parameterMinValue);
1248
                        addProjectionParameterMinValue(count,"-100000000.0");
1249
                        addProjectionParameterMinValue(count,"-100000000.0");
1250

    
1251
                        String[] projectionAcronym={"moll"};
1252
                        projectionAcronymList.add(count,projectionAcronym);
1253
                }
1254

    
1255
                count++;
1256
                {// New_Zealand_Map_Grid
1257
                        String[] projectionName={"New_Zealand_Map_Grid"};
1258
                        projectionNameList.add(count,projectionName);
1259
                        addProjectionName(count,"New Zealand Map Grid");
1260
                        addProjectionName(count,"9811");
1261

    
1262
                        String[] parameterName={"latitude_of_origin"};
1263
                        projectionParameterList.add(count,parameterName);
1264
                        addProjectionParameter(count,"central_meridian");
1265
                        addProjectionParameter(count,"false_easting");
1266
                        addProjectionParameter(count,"false_northing");
1267

    
1268
                        String[] parameterAcronym={"lat_0"};
1269
                        projectionParameterAcronymList.add(count,parameterAcronym);
1270
                        addProjectionParameterAcronymList(count,"lon_0");
1271
                        addProjectionParameterAcronymList(count,"x_0");
1272
                        addProjectionParameterAcronymList(count,"y_0");
1273

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

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

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

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

    
1296
                count++;
1297
                {// Oblique_Mercator
1298
                        String[] projectionName={"Oblique_Mercator"};
1299
                        projectionNameList.add(count,projectionName);
1300
                        addProjectionName(count,"Oblique Mercator");
1301
                        addProjectionName(count,"9815");
1302
                        addProjectionName(count,"CT_ObliqueMercator");
1303
                        addProjectionName(count,"Hotine_Oblique_Mercator_Azimuth_Center");
1304
                        addProjectionName(count,"Rectified_Skew_Orthomorphic_Center");
1305
                        addProjectionName(count,"Hotine Oblique Mercator");
1306

    
1307
                        String[] parameterName={"latitude_of_center"};
1308
                        projectionParameterList.add(count,parameterName);
1309
                        addProjectionParameter(count,"longitude_of_center");
1310
                        addProjectionParameter(count,"azimuth");
1311
                        addProjectionParameter(count,"rectified_grid_angle");
1312
                        addProjectionParameter(count,"scale_factor");
1313
                        addProjectionParameter(count,"false_easting");
1314
                        addProjectionParameter(count,"false_northing");
1315

    
1316
                        String[] parameterAcronym={"lat_0"};
1317
                        projectionParameterAcronymList.add(count,parameterAcronym);
1318
                        addProjectionParameterAcronymList(count,"lonc");
1319
                        addProjectionParameterAcronymList(count,"alpha");
1320
                        addProjectionParameterAcronymList(count,"alpha");
1321
                        addProjectionParameterAcronymList(count,"k");
1322
                        addProjectionParameterAcronymList(count,"x_0");
1323
                        addProjectionParameterAcronymList(count,"y_0");
1324

    
1325
                        String[] parameterDefaultValue={"0.0"};
1326
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1327
                        addProjectionParameterDefaultValue(count,"0.0");
1328
                        addProjectionParameterDefaultValue(count,"0.0");
1329
                        addProjectionParameterDefaultValue(count,"0.0");
1330
                        addProjectionParameterDefaultValue(count,"1.0");
1331
                        addProjectionParameterDefaultValue(count,"0.0");
1332
                        addProjectionParameterDefaultValue(count,"0.0");
1333

    
1334
                        String[] parameterMaxValue={"90.0"};
1335
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1336
                        addProjectionParameterMaxValue(count,"360.0");
1337
                        addProjectionParameterMaxValue(count,"360.0");
1338
                        addProjectionParameterMaxValue(count,"360.0");
1339
                        addProjectionParameterMaxValue(count,"10.0");
1340
                        addProjectionParameterMaxValue(count,"100000000.0");
1341
                        addProjectionParameterMaxValue(count,"100000000.0");
1342

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

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

    
1356
                count++;
1357
                {// Oblique_Mercator
1358
                        String[] projectionName={"Hotine_Oblique_Mercator_Two_Point_Center"};
1359
                        projectionNameList.add(count,projectionName);
1360
                        addProjectionName(count,"Hotine_Oblique_Mercator_Two_Point_Natural_Origin");
1361

    
1362
            /*SEMI_MAJOR,          SEMI_MINOR,
1363
            LAT_OF_1ST_POINT,    LONG_OF_1ST_POINT,
1364
            LAT_OF_2ND_POINT,    LONG_OF_2ND_POINT,
1365
                    LAT_OF_CENTRE,       SCALE_FACTOR_LOCAL,
1366
            FALSE_EASTING_LOCAL,       FALSE_NORTHING_LOCAL*/
1367

    
1368
            String[] parameterName={"Latitude_Of_2nd_Point"};
1369
                        projectionParameterList.add(count,parameterName);
1370
                        addProjectionParameter(count,"Longitude_Of_1st_Point");
1371
                        addProjectionParameter(count,"Latitude_Of_2nd_Point");
1372
                        addProjectionParameter(count,"Longitude_Of_2nd_Point");
1373
                        addProjectionParameter(count,"scale_factor");
1374
                        addProjectionParameter(count,"false_easting");
1375
                        addProjectionParameter(count,"false_northing");
1376

    
1377
                        String[] parameterAcronym={"lat_1"};
1378
                        projectionParameterAcronymList.add(count,parameterAcronym);
1379
                        addProjectionParameterAcronymList(count,"lon_1");
1380
                        addProjectionParameterAcronymList(count,"lat_2");
1381
                        addProjectionParameterAcronymList(count,"lon_2");
1382
                        addProjectionParameterAcronymList(count,"k");
1383
                        addProjectionParameterAcronymList(count,"x_0");
1384
                        addProjectionParameterAcronymList(count,"y_0");
1385

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

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

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

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

    
1417
                count++;
1418
                {// Oblique_Stereographic
1419
                        String[] projectionName={"Oblique_Stereographic"};
1420
                        projectionNameList.add(count,projectionName);
1421
                        addProjectionName(count,"Oblique Stereographic");
1422
                        addProjectionName(count,"9809");
1423

    
1424
                        String[] parameterName={"latitude_of_origin"};
1425
                        projectionParameterList.add(count,parameterName);
1426
                        addProjectionParameter(count,"central_meridian");
1427
                        addProjectionParameter(count,"scale_factor");
1428
                        addProjectionParameter(count,"false_easting");
1429
                        addProjectionParameter(count,"false_northing");
1430

    
1431
                        String[] parameterAcronym={"lat_0"};
1432
                        projectionParameterAcronymList.add(count,parameterAcronym);
1433
                        addProjectionParameterAcronymList(count,"lon_0");
1434
                        addProjectionParameterAcronymList(count,"k");
1435
                        addProjectionParameterAcronymList(count,"x_0");
1436
                        addProjectionParameterAcronymList(count,"y_0");
1437

    
1438
                        String[] parameterDefaultValue={"0.0"};
1439
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1440
                        addProjectionParameterDefaultValue(count,"0.0");
1441
                        addProjectionParameterDefaultValue(count,"1.0");
1442
                        addProjectionParameterDefaultValue(count,"0.0");
1443
                        addProjectionParameterDefaultValue(count,"0.0");
1444

    
1445
                        String[] parameterMaxValue={"90.0"};
1446
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1447
                        addProjectionParameterMaxValue(count,"360.0");
1448
                        addProjectionParameterMaxValue(count,"10.0");
1449
                        addProjectionParameterMaxValue(count,"100000000.0");
1450
                        addProjectionParameterMaxValue(count,"100000000.0");
1451

    
1452
                        String[] parameterMinValue={"-90.0"};
1453
                        projectionParameterMinValueList.add(count,parameterMinValue);
1454
                        addProjectionParameterMinValue(count,"-360.0");
1455
                        addProjectionParameterMinValue(count,"0.0");
1456
                        addProjectionParameterMinValue(count,"-100000000.0");
1457
                        addProjectionParameterMinValue(count,"-100000000.0");
1458

    
1459
                        String[] projectionAcronym={"sterea"};
1460
                        projectionAcronymList.add(count,projectionAcronym);
1461
                }
1462

    
1463
                count++;
1464
                {// Orthographic
1465
                        String[] projectionName={"Orthographic"};
1466
                        projectionNameList.add(count,projectionName);
1467

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

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

    
1480
                        String[] parameterDefaultValue={"0.0"};
1481
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1482
                        addProjectionParameterDefaultValue(count,"0.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,"100000000.0");
1490
                        addProjectionParameterMaxValue(count,"100000000.0");
1491

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

    
1498
                        String[] projectionAcronym={"ortho"};
1499
                        projectionAcronymList.add(count,projectionAcronym);
1500
                }
1501

    
1502
                count++;
1503
                {// Polar_Stereographic
1504
                        String[] projectionName={"Polar_Stereographic"};
1505
                        projectionNameList.add(count,projectionName);
1506
                        addProjectionName(count,"Polar Stereographic");
1507
                        addProjectionName(count,"9810");
1508

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

    
1517
                        String[] parameterAcronym={"lat_0"};
1518
                        //lat_0=90 o lat_0=-90
1519
                        projectionParameterAcronymList.add(count,parameterAcronym);
1520
                        addProjectionParameterAcronymList(count,"lat_ts");
1521
                        addProjectionParameterAcronymList(count,"lon_0");
1522
                        addProjectionParameterAcronymList(count,"k");
1523
                        addProjectionParameterAcronymList(count,"x_0");
1524
                        addProjectionParameterAcronymList(count,"y_0");
1525

    
1526
                        String[] parameterDefaultValue={"90.0"};
1527
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1528
                        addProjectionParameterDefaultValue(count,"90.0");
1529
                        addProjectionParameterDefaultValue(count,"0.0");
1530
                        addProjectionParameterDefaultValue(count,"1.0");
1531
                        addProjectionParameterDefaultValue(count,"0.0");
1532
                        addProjectionParameterDefaultValue(count,"0.0");
1533

    
1534
                        String[] parameterMaxValue={"90.0"};
1535
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1536
                        addProjectionParameterMaxValue(count,"90.0");
1537
                        addProjectionParameterMaxValue(count,"360.0");
1538
                        addProjectionParameterMaxValue(count,"10.0");
1539
                        addProjectionParameterMaxValue(count,"100000000.0");
1540
                        addProjectionParameterMaxValue(count,"100000000.0");
1541

    
1542
                        String[] parameterMinValue={"-90.0"};
1543
                        projectionParameterMinValueList.add(count,parameterMinValue);
1544
                        addProjectionParameterMinValue(count,"-90.0");
1545
                        addProjectionParameterMinValue(count,"-360.0");
1546
                        addProjectionParameterMinValue(count,"0.0");
1547
                        addProjectionParameterMinValue(count,"-100000000.0");
1548
                        addProjectionParameterMinValue(count,"-100000000.0");
1549

    
1550
                        String[] projectionAcronym={"stere"};
1551
                        projectionAcronymList.add(count,projectionAcronym);
1552
                }
1553

    
1554
                count++;
1555
                {// Polyconic
1556
                        String[] projectionName={"Polyconic"};
1557
                        projectionNameList.add(count,projectionName);
1558

    
1559
                        String[] parameterName={"latitude_of_origin"};
1560
                        projectionParameterList.add(count,parameterName);
1561
                        addProjectionParameter(count,"central_meridian");
1562
                        addProjectionParameter(count,"false_easting");
1563
                        addProjectionParameter(count,"false_northing");
1564

    
1565
                        String[] parameterAcronym={"lat_0"};
1566
                        projectionParameterAcronymList.add(count,parameterAcronym);
1567
                        addProjectionParameterAcronymList(count,"lon_0");
1568
                        addProjectionParameterAcronymList(count,"x_0");
1569
                        addProjectionParameterAcronymList(count,"y_0");
1570

    
1571
                        String[] parameterDefaultValue={"0.0"};
1572
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1573
                        addProjectionParameterDefaultValue(count,"0.0");
1574
                        addProjectionParameterDefaultValue(count,"0.0");
1575
                        addProjectionParameterDefaultValue(count,"0.0");
1576

    
1577
                        String[] parameterMaxValue={"90.0"};
1578
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1579
                        addProjectionParameterMaxValue(count,"360.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,"-360.0");
1586
                        addProjectionParameterMinValue(count,"-100000000.0");
1587
                        addProjectionParameterMinValue(count,"-100000000.0");
1588

    
1589
                        String[] projectionAcronym={"poly"};
1590
                        projectionAcronymList.add(count,projectionAcronym);
1591
                }
1592

    
1593
                count++;
1594
                {// Robinson
1595
                        String[] projectionName={"Robinson"};
1596
                        projectionNameList.add(count,projectionName);
1597

    
1598
                        String[] parameterName={"longitude_of_center"};
1599
                        projectionParameterList.add(count,parameterName);
1600
                        addProjectionParameter(count,"false_easting");
1601
                        addProjectionParameter(count,"false_northing");
1602

    
1603
                        String[] parameterAcronym={"lon_0"};
1604
                        projectionParameterAcronymList.add(count,parameterAcronym);
1605
                        addProjectionParameterAcronymList(count,"x_0");
1606
                        addProjectionParameterAcronymList(count,"y_0");
1607

    
1608
                        String[] parameterDefaultValue={"0.0"};
1609
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1610
                        addProjectionParameterDefaultValue(count,"0.0");
1611
                        addProjectionParameterDefaultValue(count,"0.0");
1612

    
1613
                        String[] parameterMaxValue={"360.0"};
1614
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1615
                        addProjectionParameterMaxValue(count,"100000000.0");
1616
                        addProjectionParameterMaxValue(count,"100000000.0");
1617

    
1618
                        String[] parameterMinValue={"-360.0"};
1619
                        projectionParameterMinValueList.add(count,parameterMinValue);
1620
                        addProjectionParameterMinValue(count,"-100000000.0");
1621
                        addProjectionParameterMinValue(count,"-100000000.0");
1622

    
1623
                        String[] projectionAcronym={"robin"};
1624
                        projectionAcronymList.add(count,projectionAcronym);
1625
                }
1626

    
1627
                //         Rosenmund Oblique Mercator - No en EPSG
1628

    
1629
                count++;
1630
                {// Sinusoidal
1631
                        String[] projectionName={"Sinusoidal"};
1632
                        projectionNameList.add(count,projectionName);
1633

    
1634
                        String[] parameterName={"longitude_of_center"};
1635
                        projectionParameterList.add(count,parameterName);
1636
                        addProjectionParameter(count,"false_easting");
1637
                        addProjectionParameter(count,"false_northing");
1638

    
1639
                        String[] parameterAcronym={"lon_0"};
1640
                        projectionParameterAcronymList.add(count,parameterAcronym);
1641
                        addProjectionParameterAcronymList(count,"x_0");
1642
                        addProjectionParameterAcronymList(count,"y_0");
1643

    
1644
                        String[] parameterDefaultValue={"0.0"};
1645
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1646
                        addProjectionParameterDefaultValue(count,"0.0");
1647
                        addProjectionParameterDefaultValue(count,"0.0");
1648

    
1649
                        String[] parameterMaxValue={"360.0"};
1650
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1651
                        addProjectionParameterMaxValue(count,"100000000.0");
1652
                        addProjectionParameterMaxValue(count,"100000000.0");
1653

    
1654
                        String[] parameterMinValue={"-360.0"};
1655
                        projectionParameterMinValueList.add(count,parameterMinValue);
1656
                        addProjectionParameterMinValue(count,"-100000000.0");
1657
                        addProjectionParameterMinValue(count,"-100000000.0");
1658

    
1659
                        String[] projectionAcronym={"sinu"};
1660
                        projectionAcronymList.add(count,projectionAcronym);
1661
                }
1662

    
1663
                count++;
1664
                {// Swiss_Oblique_Cylindrical
1665
                        String[] projectionName={"Swiss_Oblique_Cylindrical"};
1666
                        projectionNameList.add(count,projectionName);
1667
                        addProjectionName(count,"Swiss Oblique Cylindrical");
1668
                        addProjectionName(count,"Swiss Oblique Mercator");
1669
                        addProjectionName(count,"9814");
1670

    
1671
                        String[] parameterName={"latitude_of_origin"};
1672
                        projectionParameterList.add(count,parameterName);
1673
                        addProjectionParameter(count,"central_meridian");
1674
                        addProjectionParameter(count,"false_easting");
1675
                        addProjectionParameter(count,"false_northing");
1676

    
1677
                        String[] parameterAcronym={"lat_0"};
1678
                        projectionParameterAcronymList.add(count,parameterAcronym);
1679
                        addProjectionParameterAcronymList(count,"lon_0");
1680
                        addProjectionParameterAcronymList(count,"x_0");
1681
                        addProjectionParameterAcronymList(count,"y_0");
1682

    
1683
                        String[] parameterDefaultValue={"0.0"};
1684
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1685
                        addProjectionParameterDefaultValue(count,"0.0");
1686
                        addProjectionParameterDefaultValue(count,"0.0");
1687
                        addProjectionParameterDefaultValue(count,"0.0");
1688

    
1689
                        String[] parameterMaxValue={"90.0"};
1690
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1691
                        addProjectionParameterMaxValue(count,"360.0");
1692
                        addProjectionParameterMaxValue(count,"100000000.0");
1693
                        addProjectionParameterMaxValue(count,"100000000.0");
1694

    
1695
                        String[] parameterMinValue={"-90.0"};
1696
                        projectionParameterMinValueList.add(count,parameterMinValue);
1697
                        addProjectionParameterMinValue(count,"-360.0");
1698
                        addProjectionParameterMinValue(count,"-100000000.0");
1699
                        addProjectionParameterMinValue(count,"-100000000.0");
1700

    
1701
                        String[] projectionAcronym={"somerc"};
1702
                        projectionAcronymList.add(count,projectionAcronym);
1703
                }
1704

    
1705
                count++;
1706
                {// Stereographic
1707
                        String[] projectionName={"Stereographic"};
1708
                        projectionNameList.add(count,projectionName);
1709

    
1710
                        String[] parameterName={"latitude_of_origin"};
1711
                        projectionParameterList.add(count,parameterName);
1712
                        addProjectionParameter(count,"central_meridian");
1713
                        addProjectionParameter(count,"scale_factor");
1714
                        addProjectionParameter(count,"false_easting");
1715
                        addProjectionParameter(count,"false_northing");
1716

    
1717
                        String[] parameterAcronym={"lat_0"};
1718
                        projectionParameterAcronymList.add(count,parameterAcronym);
1719
                        addProjectionParameterAcronymList(count,"lon_0");
1720
                        addProjectionParameterAcronymList(count,"k");
1721
                        addProjectionParameterAcronymList(count,"x_0");
1722
                        addProjectionParameterAcronymList(count,"y_0");
1723

    
1724
                        String[] parameterDefaultValue={"0.0"};
1725
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1726
                        addProjectionParameterDefaultValue(count,"0.0");
1727
                        addProjectionParameterDefaultValue(count,"1.0");
1728
                        addProjectionParameterDefaultValue(count,"0.0");
1729
                        addProjectionParameterDefaultValue(count,"0.0");
1730

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

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

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

    
1749
                count++;
1750
                {// Transverse_Mercator
1751
                        String[] projectionName={"Transverse_Mercator"};
1752
                        projectionNameList.add(count,projectionName);
1753
                        addProjectionName(count,"Transverse Mercator");
1754
                        addProjectionName(count,"Gauss-Kruger");
1755
                        addProjectionName(count,"9807");
1756

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

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

    
1771
                        String[] parameterDefaultValue={"0.0"};
1772
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1773
                        addProjectionParameterDefaultValue(count,"0.0");
1774
                        addProjectionParameterDefaultValue(count,"1.0");
1775
                        addProjectionParameterDefaultValue(count,"0.0");
1776
                        addProjectionParameterDefaultValue(count,"0.0");
1777

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

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

    
1792
                        String[] projectionAcronym={"tmerc"};
1793
                        projectionAcronymList.add(count,projectionAcronym);
1794
                }
1795

    
1796

    
1797
                /*
1798
                count++;
1799
                {// Tunisia_Mining_Grid
1800
                        String[] projectionName={"Tunisia_Mining_Grid"};
1801
                        projectionNameList.add(count,projectionName);
1802
                        addProjectionName(count,"Tunisia Mining Grid");
1803
                        addProjectionName(count,"9816");
1804

1805
                        String[] parameterName={"latitude_of_origin"};
1806
                        projectionParameterList.add(count,parameterName);
1807
                        addProjectionParameter(count,"central_meridian");
1808
                        addProjectionParameter(count,"false_easting");
1809
                        addProjectionParameter(count,"false_northing");
1810
                }
1811
                */
1812

    
1813
                count++;
1814
                {// VanDerGrinten
1815
                        String[] projectionName={"VanDerGrinten"};
1816
                        projectionNameList.add(count,projectionName);
1817
                        addProjectionName(count,"VanDerGrinten I");
1818

    
1819
                        String[] parameterName={"central_meridian"};
1820
                        projectionParameterList.add(count,parameterName);
1821
                        addProjectionParameter(count,"false_easting");
1822
                        addProjectionParameter(count,"false_northing");
1823

    
1824
                        String[] parameterAcronym={"lon_0"};
1825
                        projectionParameterAcronymList.add(count,parameterAcronym);
1826
                        addProjectionParameterAcronymList(count,"x_0");
1827
                        addProjectionParameterAcronymList(count,"y_0");
1828

    
1829
                        String[] parameterDefaultValue={"0.0"};
1830
                        projectionParameterDefaultValueList.add(count,parameterDefaultValue);
1831
                        addProjectionParameterDefaultValue(count,"0.0");
1832
                        addProjectionParameterDefaultValue(count,"0.0");
1833

    
1834
                        String[] parameterMaxValue={"360.0"};
1835
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1836
                        addProjectionParameterMaxValue(count,"100000000.0");
1837
                        addProjectionParameterMaxValue(count,"100000000.0");
1838

    
1839
                        String[] parameterMinValue={"-360.0"};
1840
                        projectionParameterMinValueList.add(count,parameterMinValue);
1841
                        addProjectionParameterMinValue(count,"-100000000.0");
1842
                        addProjectionParameterMinValue(count,"-100000000.0");
1843

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

    
2149
        public String exportToProj4(Crs crs) throws CrsException
2150
        {
2151
                String strProj4="+proj=";
2152
                String strDatumName="";
2153
                String strDatumCode="";
2154
                String strProj4Datum="";
2155
                String[] primeMeridian=crs.getCrsWkt().getPrimen();
2156
                String primeMeridianName=primeMeridian[0];
2157
                double primeMeridianValue=Double.parseDouble(primeMeridian[1]); // -> hacer el cambio de unidades
2158
                String[] strPrimeMeridianProj4=primeMeridianToProj4(primeMeridianName,primeMeridianValue);
2159
                primeMeridianValue=Double.parseDouble(strPrimeMeridianProj4[1]);
2160
                primeMeridianName=strPrimeMeridianProj4[0];
2161
                String primeMeridianAcronym=strPrimeMeridianProj4[2]; // Puede ser cadena vacia->Analizar
2162

    
2163
                // Extracción del código de Datum
2164
                String codDatum="0";
2165
                strDatumName=crs.getCrsWkt().getDatumName();
2166
        int intCodDatum=0;//Integer.parseInt(codDatum);
2167
        strProj4Datum=datumToProj4(strDatumName,intCodDatum);
2168
        
2169
        String parameter_unit = crs.getCrsWkt().getUnit_p()[1];
2170

    
2171

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

    
2495
                }
2496
                else if (crs instanceof DefaultGeographicCRS) {
2497
                        DefaultGeographicCRS crsGeographic = (DefaultGeographicCRS) crs;
2498
                        primeMeridian = Primem(((DefaultGeodeticDatum) crsGeographic.getDatum()).getPrimeMeridian());
2499
                        spheroid = Spheroid(((DefaultGeodeticDatum) crsGeographic.getDatum()).getEllipsoid());
2500
                        elipName=spheroid[0];
2501
                        a=Double.parseDouble(spheroid[1]);
2502
                        inv_f=Double.parseDouble(spheroid[2]);
2503
                        // Extracción del código de Datum
2504
                        String codDatum="0";
2505
                        String[] val=((DefaultGeographicCRS)crs).getDatum().getName().toString().split(":");
2506
                        if (val.length<2)
2507
                                strDatumName=val[0];
2508
                        else
2509
                                strDatumName=val[1];
2510
                for (Iterator iter =((DefaultGeographicCRS)crs).getDatum().getIdentifiers().iterator();iter.hasNext();) {
2511
                    Identifier element = (Identifier) iter.next();
2512
                    codDatum = element.getCode();          
2513
                }
2514
                int intCodDatum=Integer.parseInt(codDatum);
2515
                strProj4Datum=datumToProj4(strDatumName,intCodDatum);
2516
                }
2517
                
2518
                String primeMeridianName=primeMeridian[0];
2519
                double primeMeridianValue=Double.parseDouble(primeMeridian[1]); // -> hacer el cambio de unidades
2520
                String[] strPrimeMeridianProj4=primeMeridianToProj4(primeMeridianName,primeMeridianValue);
2521
                primeMeridianValue=Double.parseDouble(strPrimeMeridianProj4[1]);
2522
                primeMeridianName=strPrimeMeridianProj4[0];
2523
                String primeMeridianAcronym=strPrimeMeridianProj4[2]; // Puede ser cadena vacia->Analizar
2524

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

    
2790
        private String[] primeMeridianToProj4(String pmName,double pmValue) throws CrsException
2791
        {
2792
            String[] primeMeridian=new String[3];
2793
                String pszPM="";
2794
                String acronym="";
2795
            double dfFromGreenwich = 0.0;
2796
            double tolerance=0.002/3600.0;
2797
            int    nPMCode = -1;
2798

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

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

    
3107
        private String datumToProj4(String datumName,int epsgCode)
3108
        {
3109
            String datumProj4="";
3110
            String SRS_DN_NAD27="North_American_Datum_1927";
3111
            String SRS_DN_NAD83="North_American_Datum_1983";
3112
            String SRS_DN_WGS72="WGS_1972";
3113
            String SRS_DN_WGS84="WGS_1984";
3114
            if(datumName.equals(""))
3115
                    datumProj4="";
3116
                else if(datumName.equalsIgnoreCase(SRS_DN_NAD27) || epsgCode == 6267 )
3117
                        datumProj4 = "+datum=NAD27 ";
3118

    
3119
            else if(datumName.equalsIgnoreCase(SRS_DN_NAD83) || epsgCode == 6269 )
3120
                    datumProj4 = "+datum=NAD83 ";
3121

    
3122
            else if(datumName.equalsIgnoreCase(SRS_DN_WGS84) || epsgCode == 6326 )
3123
                    datumProj4 = "+datum=WGS84 ";
3124

    
3125
            else if( epsgCode == 6314 )
3126
                    datumProj4 = "+datum=potsdam ";
3127

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