Statistics
| Revision:

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

History | View | Annotate | Download (124 KB)

1
package org.gvsig.crs;
2

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

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

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

    
18
public class Proj4 {        
19

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1190
                        String[] parameterAcronym={"lon_0"};
1191
                        projectionParameterAcronymList.add(count,parameterAcronym);
1192
                        addProjectionParameterAcronymList(count,"lat_ts");
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"); // o 0.0
1199
                        addProjectionParameterDefaultValue(count,"0.0");
1200
                        addProjectionParameterDefaultValue(count,"0.0");
1201

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

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

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

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

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

    
1230
                        String[] parameterAcronym={"lat_0"};
1231
                        projectionParameterAcronymList.add(count,parameterAcronym);
1232
                        addProjectionParameterAcronymList(count,"lon_0");
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
                        addProjectionParameterDefaultValue(count,"0.0");
1241

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1485
                        String[] parameterMaxValue={"90.0"};
1486
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1487
                        addProjectionParameterMaxValue(count,"360.0");
1488
                        addProjectionParameterMaxValue(count,"10.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,"0.0");
1496
                        addProjectionParameterMinValue(count,"-100000000.0");
1497
                        addProjectionParameterMinValue(count,"-100000000.0");
1498

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1670
                //         Rosenmund Oblique Mercator - No en EPSG
1671

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

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

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

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

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

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

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

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

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

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

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

    
1732
                        String[] parameterMaxValue={"90.0"};
1733
                        projectionParameterMaxValueList.add(count,parameterMaxValue);
1734
                        addProjectionParameterMaxValue(count,"360.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,"-100000000.0");
1742
                        addProjectionParameterMinValue(count,"-100000000.0");
1743

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
2232
                // Extracción del código de Datum
2233
                String codDatum="0";
2234
                strDatumName=crs.getCrsWkt().getDatumName();
2235
        int intCodDatum=0;//Integer.parseInt(codDatum);
2236
        strProj4Datum=datumToProj4(strDatumName,intCodDatum);
2237
        
2238
        String parameter_unit = crs.getCrsWkt().getUnit_p()[1];
2239

    
2240

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

    
2619
                }
2620
                else if (crs instanceof DefaultGeographicCRS) {
2621
                        DefaultGeographicCRS crsGeographic = (DefaultGeographicCRS) crs;
2622
                        primeMeridian = Primem(((DefaultGeodeticDatum) crsGeographic.getDatum()).getPrimeMeridian());
2623
                        spheroid = Spheroid(((DefaultGeodeticDatum) crsGeographic.getDatum()).getEllipsoid());
2624
                        elipName=spheroid[0];
2625
                        a=Double.parseDouble(spheroid[1]);
2626
                        inv_f=Double.parseDouble(spheroid[2]);
2627
                        // Extracción del código de Datum
2628
                        String codDatum="0";
2629
                        String[] val=((DefaultGeographicCRS)crs).getDatum().getName().toString().split(":");
2630
                        if (val.length<2)
2631
                                strDatumName=val[0];
2632
                        else
2633
                                strDatumName=val[1];
2634
                for (Iterator iter =((DefaultGeographicCRS)crs).getDatum().getIdentifiers().iterator();iter.hasNext();) {
2635
                    Identifier element = (Identifier) iter.next();
2636
                    codDatum = element.getCode();          
2637
                }
2638
                int intCodDatum=Integer.parseInt(codDatum);
2639
                strProj4Datum=datumToProj4(strDatumName,intCodDatum);
2640
                }
2641
                
2642
                String primeMeridianName=primeMeridian[0];
2643
                double primeMeridianValue=Double.parseDouble(primeMeridian[1]); // -> hacer el cambio de unidades
2644
                String[] strPrimeMeridianProj4=primeMeridianToProj4(primeMeridianName,primeMeridianValue);
2645
                primeMeridianValue=Double.parseDouble(strPrimeMeridianProj4[1]);
2646
                primeMeridianName=strPrimeMeridianProj4[0];
2647
                String primeMeridianAcronym=strPrimeMeridianProj4[2]; // Puede ser cadena vacia->Analizar
2648

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

    
2929
        private String[] primeMeridianToProj4(String pmName,double pmValue) throws CrsException
2930
        {
2931
            String[] primeMeridian=new String[3];
2932
                String pszPM="";
2933
                String acronym="";
2934
            double dfFromGreenwich = 0.0;
2935
            double tolerance=0.002/3600.0;
2936
            int    nPMCode = -1;
2937

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

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

    
3246
        private String datumToProj4(String datumName,int epsgCode)
3247
        {
3248
            String datumProj4="";
3249
            String SRS_DN_NAD27="North_American_Datum_1927";
3250
            String SRS_DN_NAD83="North_American_Datum_1983";
3251
            String SRS_DN_WGS72="WGS_1972";
3252
            String SRS_DN_WGS84="WGS_1984";
3253
            if(datumName.equals(""))
3254
                    datumProj4="";
3255
                else if(datumName.equalsIgnoreCase(SRS_DN_NAD27) || epsgCode == 6267 )
3256
                        datumProj4 = "+datum=NAD27 ";
3257

    
3258
            else if(datumName.equalsIgnoreCase(SRS_DN_NAD83) || epsgCode == 6269 )
3259
                    datumProj4 = "+datum=NAD83 ";
3260

    
3261
            else if(datumName.equalsIgnoreCase(SRS_DN_WGS84) || epsgCode == 6326 )
3262
                    datumProj4 = "+datum=WGS84 ";
3263

    
3264
            else if( epsgCode == 6314 )
3265
                    datumProj4 = "+datum=potsdam ";
3266

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