Statistics
| Revision:

root / branches / v10+Piloto / libraries / libCq_CMS_praster / src / org / cresques / cts / ProjectionPool.java @ 9087

History | View | Annotate | Download (16.7 KB)

1
/*
2
 * Cresques Mapping Suite. Graphic Library for constructing mapping applications.
3
 *
4
 * Copyright (C) 2004-5.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
 *
20
 * For more information, contact:
21
 *
22
 * cresques@gmail.com
23
 */
24
package org.cresques.cts;
25

    
26
import java.util.ArrayList;
27
import java.util.Iterator;
28
import java.util.Map;
29
import java.util.TreeMap;
30

    
31
import org.cresques.cts.gt2.CSDatum;
32
import org.cresques.cts.gt2.CSGaussPt;
33
import org.cresques.cts.gt2.CSLambertCC;
34
import org.cresques.cts.gt2.CSMercator;
35
import org.cresques.cts.gt2.CSUTM;
36
import org.cresques.cts.gt2.CoordSys;
37

    
38

    
39
/**
40
 * Pool de proyeccions (cs+datum) conocidas.
41
 * @author "Luis W. Sevilla" <sevilla_lui@gva.es>
42
 */
43
public class ProjectionPool implements ICRSFactory {
44
    static TreeMap data = null;
45

    
46
    static {
47
        CoordSys cs = null;
48
        data = new TreeMap();
49

    
50
        cs = (new CSUTM(CSDatum.wgs84, 30)).toGeo();
51
        cs.setAbrev("EPSG:4326"); // WGS84 (World Geodesic Datum)
52
        data.put(cs.getAbrev(), cs);
53
        data.put("CRS:84", cs); // CRS:84 = EPSG:4326
54

    
55
        cs = (new CSUTM(CSDatum.ed50, 30)).toGeo();
56
        cs.setAbrev("EPSG:4230"); // Datum Europeu Internacional ED50
57
        data.put(cs.getAbrev(), cs);
58

    
59
        cs = (new CSUTM(CSDatum.d73, 30)).toGeo();
60
        cs.setAbrev("EPSG:4274"); // Datum 73 de Lisboa
61
        data.put(cs.getAbrev(), cs);
62

    
63
        cs = (new CSUTM(CSDatum.nad27, 30)).toGeo();
64
        cs.setAbrev("EPSG:4267"); // NAD 27
65
        data.put(cs.getAbrev(), cs);
66

    
67
        cs = (new CSUTM(CSDatum.nad83, 30)).toGeo();
68
        cs.setAbrev("EPSG:4269"); // NAD 83
69
        data.put(cs.getAbrev(), cs);
70

    
71
        cs = (new CSUTM(CSDatum.lomaQuintana, 30)).toGeo();
72
        cs.setAbrev("EPSG:4288"); // PSAD 56 'Loma Quintana'
73
        data.put(cs.getAbrev(), cs);
74

    
75
        cs = (new CSUTM(CSDatum.laCanoa, 30)).toGeo();
76
        cs.setAbrev("EPSG:4247"); // PSAD 56 'Loma Quintana'
77
        data.put(cs.getAbrev(), cs);
78

    
79
        cs = (new CSUTM(CSDatum.ntfParis, 30)).toGeo();
80
        cs.setAbrev("EPSG:4807"); // NTF Paris
81
        data.put(cs.getAbrev(), cs);
82

    
83
        cs = (new CSUTM(CSDatum.etrs89, 30)).toGeo();
84
        cs.setAbrev("EPSG:4258"); // ETRS 89
85
        data.put(cs.getAbrev(), cs);
86
        for (int i = 1; i <= 60; i++) {
87
            String huso = Integer.toString(i);
88

    
89
            if (i < 10) {
90
                huso = "0" + huso;
91
            }
92

    
93
            cs = new CSUTM(CSDatum.wgs84, i);
94
            cs.setAbrev("EPSG:326" + huso);
95
            data.put(cs.getAbrev(), cs);
96

    
97
            cs = new CSUTM(CSDatum.ed50, i);
98
            cs.setAbrev("EPSG:230" + huso);
99
            data.put(cs.getAbrev(), cs);
100
            if (i>2 && i<=23) {
101
                cs = new CSUTM(CSDatum.nad27, i);
102
                cs.setAbrev("EPSG:267" + huso);
103
                data.put(cs.getAbrev(), cs);
104

    
105
                cs = new CSUTM(CSDatum.nad83, i);
106
                cs.setAbrev("EPSG:269" + huso);
107
                data.put(cs.getAbrev(), cs);
108
            }
109
            if (i>27 && i<39) {
110
                cs = new CSUTM(CSDatum.etrs89, i);
111
                cs.setAbrev("EPSG:258" + huso);
112
                data.put(cs.getAbrev(), cs);
113
            }
114
        }
115

    
116
        cs = CSGaussPt.hgd73;
117
        cs.setAbrev("EPSG:27492"); // Projec??o Gauss do Datum 73 de Lisboa (no EPSG found)
118
        data.put(cs.getAbrev(), cs);
119

    
120
        cs = new CSUTM(CSDatum.d73, 29);
121
        cs.setAbrev("EPSG:27429"); // Projec??o Gauss do Datum 73 de Lisboa (no EPSG found)
122
        data.put(cs.getAbrev(), cs);
123

    
124
        for (int i = 18; i <= 21; i++) {
125
            String huso = Integer.toString(i);
126

    
127
            if (i < 10) {
128
                huso = "0" + huso;
129
            }
130

    
131
            cs = new CSUTM(CSDatum.laCanoa, i);
132
            cs.setAbrev("EPSG:247" + huso);
133
            data.put(cs.getAbrev(), cs);
134
        }
135

    
136
        for (int i = 16; i <= 22; i++) {
137
            String huso = Integer.toString(i);
138
            // Psad56 Ecuador
139
            cs = new CSUTM(CSDatum.lomaQuintana, i);
140
            cs.setAbrev("EPSG:288" + huso);
141
            data.put(cs.getAbrev(), cs);
142
            cs = new CSUTM(CSDatum.lomaQuintana, i, "S");
143
            cs.setAbrev("EPSG:288" + (i+60) );
144
            data.put(cs.getAbrev(), cs);
145
        }
146

    
147
        //                cs = new CSLambertCC(CSDatum.nad27, -105D, 49D, 49D, 77D, 0, 0);
148
        //                cs.setAbrev("LCCCan");
149
        //                data.put(cs.getAbrev(), cs);
150
        /* Para el server WMS de canad?:
151
         * EPSG:42101
152
         * EPSG:42304
153
         * EPSG:4269
154
         */
155
        /*
156
         * 42101,PROJCS["WGS 84 / LCC Canada",
157
         * GEOGCS["WGS 84",DATUM["WGS_1984",
158
         * SPHEROID["WGS_1984",6378137,298.257223563]],
159
         * PRIMEM["Greenwich",0],UNIT["Decimal_Degree",0.0174532925199433]],
160
         *
161
         * PROJECTION["Lambert_Conformal_Conic_2SP"],
162
         * PARAMETER["central_meridian",-95.0],
163
         * PARAMETER["latitude_of_origin",0],
164
         * PARAMETER["standard_parallel_1",49.0],
165
         * PARAMETER["standard_parallel_2",77.0],
166
         * PARAMETER["false_easting",0.0],
167
         * PARAMETER["false_northing",-8000000.0],
168
         * UNIT["Meter",1],AUTHORITY["EPSG","42101"]]
169
         */
170
        cs = new CSLambertCC(CSDatum.wgs84, -95, 0, 49, 77, 0, -8000000.0);
171
        cs.setAbrev("EPSG:42101");
172
        data.put(cs.getAbrev(), cs);
173

    
174
        /* 42304,PROJCS["NAD83 / NRCan LCC Canada",
175
         * GEOGCS["NAD83",DATUM["North_American_Datum_1983",
176
         * SPHEROID["GRS_1980",6378137,298.257222101]],
177
         * PRIMEM["Greenwich",0],
178
         * UNIT["Decimal_Degree",0.0174532925199433]],
179
         *
180
         * PROJECTION["Lambert_Conformal_Conic_2SP"],
181
         * PARAMETER["central_meridian",-95.0],
182
         * PARAMETER["latitude_of_origin",49.0],
183
         * PARAMETER["standard_parallel_1",49.0],
184
         * PARAMETER["standard_parallel_2",77.0],
185
         * PARAMETER["false_easting",0.0],
186
         * PARAMETER["false_northing",0.0],
187
         * UNIT["Meter",1],AUTHORITY["EPSG","42304"]]
188
         */
189
        cs = new CSLambertCC(CSDatum.nad83, -95, 49, 49, 77, 0, 0);
190
        cs.setAbrev("EPSG:42304");
191
        data.put(cs.getAbrev(), cs);
192

    
193
        /*
194
         * EPSG:26915 - NAD83 / UTM zone 15N
195
         * EPSG:31466 - Gau?-Kr?ger band 2
196
         * EPSG:31467 - Gau?-Kr?ger band 3
197
         * EPSG:4314  - DHDN
198
         */
199
        /*
200
         * 27572=PROJCS["NTF (Paris) / Lambert zone II",
201
             GEOGCS["NTF (Paris)",
202
                    DATUM["Nouvelle_Triangulation_Francaise_Paris",
203
                          SPHEROID["Clarke 1880 (IGN)",6378249.2,293.4660212936269,
204
                                   AUTHORITY["EPSG","7011"]],
205
                          TOWGS84[-168,-60,320,0,0,0,0],
206
                          AUTHORITY["EPSG","6807"]],
207
                    PRIMEM["Paris",2.33722917,AUTHORITY["EPSG","8903"]],
208
                    UNIT["grad",0.01570796326794897,AUTHORITY["EPSG","9105"]],
209
                    AUTHORITY["EPSG","4807"]],
210
             PROJECTION["Lambert_Conformal_Conic_1SP"],
211
                        PARAMETER["latitude_of_origin",52],
212
                        PARAMETER["central_meridian",0],
213
                        PARAMETER["scale_factor",0.99987742],
214
                        PARAMETER["false_easting",600000],
215
                        PARAMETER["false_northing",2200000],
216
                        UNIT["metre",1,AUTHORITY["EPSG","9001"]],
217
                        AUTHORITY["EPSG","27572"]]
218
         */
219

    
220
        cs = new CSLambertCC(CSDatum.ntfParis, 0, 46.79999999999995, 0.99987742, 600000, 2200000);
221
        cs.setAbrev("EPSG:27572");
222
        data.put(cs.getAbrev(), cs);
223
        
224
        cs = new CSLambertCC(CSDatum.ntfParis, 0, 52, 0.99987742, 600000, 2200000);
225
        cs.setAbrev("EPSG:27582");
226
        data.put(cs.getAbrev(), cs);
227
        /*
228
         * # RGF93
229
         * <4171> +proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs  <>
230
         * # RGF93 / Lambert-93
231
         */
232
        cs = (new CSUTM(CSDatum.rgf93, 30)).toGeo();
233
        cs.setAbrev("EPSG:4171"); // NTF Paris
234
        data.put(cs.getAbrev(), cs);
235
        /*
236
         *  <2154> +proj=lcc +lat_1=49 +lat_2=44 +lat_0=46.5 +lon_0=3
237
         *  +x_0=700000 +y_0=6600000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0
238
         *  +units=m +no_defs  <>
239
         */
240
        cs = new CSLambertCC(CSDatum.rgf93, 3.0, 46.5, 49.0, 44.0, 700000.0, 6600000.0);
241
        cs.setAbrev("EPSG:2154");
242
        data.put(cs.getAbrev(), cs);
243

    
244
        cs = new CSMercator(CSDatum.wgs84);
245
        cs.setAbrev("EPSG:54004");
246
        data.put(cs.getAbrev(), cs);
247
        cs.setAbrev("EPSG:9804");
248
        data.put(cs.getAbrev(), cs);
249
        
250
        // Lo que faltaba: ?planetas!
251
        cs = (new CSUTM(CSDatum.moon, 30)).toGeo();
252
        cs.setAbrev("IAU2000:30100"); // Moon
253
        data.put(cs.getAbrev(), cs);
254

    
255
        cs = (new CSUTM(CSDatum.mars, 30)).toGeo();
256
        cs.setAbrev("IAU2000:49900"); // Mars
257
        data.put(cs.getAbrev(), cs);
258
        
259
        /*
260
         * CRSs argentinos.
261
         * coordenadas geograficas
262
                        PosGAr 4172 
263
                        PosGAr98 4190
264
                        
265
                        coordenadas proyectadas
266
                        POSGAR 94/Argentina 1 22191 
267
                        POSGAR 94/Argentina 2 22192
268
                        POSGAR 94/Argentina 3 22193
269
                        POSGAR 94/Argentina 4 22194
270
                        POSGAR 94/Argentina 5 22195
271
                        POSGAR 94/Argentina 6 22196
272
                        POSGAR 94/Argentina 7 22197
273
                        
274
                        POSGAR 98/Argentina 1 22181
275
                        POSGAR 98/Argentina 2 22182
276
                        POSGAR 98/Argentina 3 22183
277
                        POSGAR 98/Argentina 4 22184
278
                        POSGAR 98/Argentina 5 22185
279
                        POSGAR 98/Argentina 6 22186
280
                        POSGAR 98/Argentina 7 22187
281
                        
282
                        4221 GEOGCS["GCS_Campo_Inchauspe",DATUM["D_Campo_Inchauspe",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
283
                        
284
                        22191        EPSG        22191        PROJCS["Argentina_Zone_1",GEOGCS["GCS_Campo_Inchauspe",DATUM["D_Campo_Inchauspe",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",1500000],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",-72],PARAMETER["Scale_Factor",1],PARAMETER["Latitude_Of_Origin",-90],UNIT["Meter",1]]        +proj=tmerc +lat_0=-90 +lon_0=-72 +k=1.000000 +x_0=1500000 +y_0=0 +ellps=intl +units=m
285
                        22192        EPSG        22192        PROJCS["Argentina_Zone_2",GEOGCS["GCS_Campo_Inchauspe",DATUM["D_Campo_Inchauspe",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",2500000],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",-69],PARAMETER["Scale_Factor",1],PARAMETER["Latitude_Of_Origin",-90],UNIT["Meter",1]]        +proj=tmerc +lat_0=-90 +lon_0=-69 +k=1.000000 +x_0=2500000 +y_0=0 +ellps=intl +units=m
286
                        22193        EPSG        22193        PROJCS["Argentina_Zone_3",GEOGCS["GCS_Campo_Inchauspe",DATUM["D_Campo_Inchauspe",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",3500000],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",-66],PARAMETER["Scale_Factor",1],PARAMETER["Latitude_Of_Origin",-90],UNIT["Meter",1]]        +proj=tmerc +lat_0=-90 +lon_0=-66 +k=1.000000 +x_0=3500000 +y_0=0 +ellps=intl +units=m
287
                        22194        EPSG        22194        PROJCS["Argentina_Zone_4",GEOGCS["GCS_Campo_Inchauspe",DATUM["D_Campo_Inchauspe",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",4500000],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",-63],PARAMETER["Scale_Factor",1],PARAMETER["Latitude_Of_Origin",-90],UNIT["Meter",1]]        +proj=tmerc +lat_0=-90 +lon_0=-63 +k=1.000000 +x_0=4500000 +y_0=0 +ellps=intl +units=m
288
                        22195        EPSG        22195        PROJCS["Argentina_Zone_5",GEOGCS["GCS_Campo_Inchauspe",DATUM["D_Campo_Inchauspe",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",5500000],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",-60],PARAMETER["Scale_Factor",1],PARAMETER["Latitude_Of_Origin",-90],UNIT["Meter",1]]        +proj=tmerc +lat_0=-90 +lon_0=-60 +k=1.000000 +x_0=5500000 +y_0=0 +ellps=intl +units=m
289
                        22196        EPSG        22196        PROJCS["Argentina_Zone_6",GEOGCS["GCS_Campo_Inchauspe",DATUM["D_Campo_Inchauspe",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",6500000],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",-57],PARAMETER["Scale_Factor",1],PARAMETER["Latitude_Of_Origin",-90],UNIT["Meter",1]]        +proj=tmerc +lat_0=-90 +lon_0=-57 +k=1.000000 +x_0=6500000 +y_0=0 +ellps=intl +units=m
290
                        22197        EPSG        22197        PROJCS["Argentina_Zone_7",GEOGCS["GCS_Campo_Inchauspe",DATUM["D_Campo_Inchauspe",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",7500000],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",-54],PARAMETER["Scale_Factor",1],PARAMETER["Latitude_Of_Origin",-90],UNIT["Meter",1]]        +proj=tmerc +lat_0=-90 +lon_0=-54 +k=1.000000 +x_0=7500000 +y_0=0 +ellps=intl +units=m
291

292
         */
293
        cs = new CoordSys(CSDatum.posgar);
294
        cs.setAbrev("EPSG:4172"); // Posgar
295
        data.put(cs.getAbrev(), cs);
296
        
297
        cs = new CoordSys(
298
                        "GEOGCS[\"GCS_Campo_Inchauspe\"," +
299
                                "DATUM[\"D_Campo_Inchauspe\"," +
300
                                        "SPHEROID[\"International_1924\",6378388,297],"+
301
                                        "TOWGS84[0,0,0,0,0,0,0]]," +
302
                                "PRIMEM[\"Greenwich\",0]," +
303
                                "UNIT[\"Degree\",0.017453292519943295]]");
304
        cs.setAbrev("EPSG:4221"); // Campo Inchauspe
305
        data.put(cs.getAbrev(), cs);
306
        
307
       for (int i=1; i<=7; i++) {
308
                cs = new CoordSys(
309
                        "PROJCS[\"Argentina_Zone_"+i+"\"," +
310
                                "GEOGCS[\"GCS_Campo_Inchauspe\"," +
311
                                        "DATUM[\"D_Campo_Inchauspe\"," +
312
                                                "SPHEROID[\"International_1924\",6378388,297],"+
313
                                                "TOWGS84[0,0,0,0,0,0,0]]," +
314
                                        "PRIMEM[\"Greenwich\",0]," +
315
                                        "UNIT[\"Degree\",0.017453292519943295]]," +
316
                                "PROJECTION[\"Transverse_Mercator\"]," +
317
                                "PARAMETER[\"False_Easting\",1500000]," +
318
                                "PARAMETER[\"False_Northing\",0]," +
319
                                "PARAMETER[\"Central_Meridian\","+(-75+3*i)+"]," +
320
                                "PARAMETER[\"Scale_Factor\",1]," +
321
                                "PARAMETER[\"Latitude_Of_Origin\",-90]," +
322
                                "UNIT[\"Meter\",1]]");
323
                cs.setAbrev("EPSG:2219"+i); // Posgar
324
                data.put(cs.getAbrev(), cs);
325
        }
326
       
327
       /*
328
        * pendiente de a?adir:
329
        * 
330
        * EPSG 3003: Montemario / Italy Zone 1 - Pendiente de a?adir
331
              * EPSG 4149: CH1903 - Pendiente de a?adir
332
              * Ecuador:
333
              *   PSAD56, Geo, UTM 16/17S,16/17N
334
              */
335
    }
336

    
337
    /**
338
     * Mete una nueva proyeccion en la Pool.
339
     * @param name abreviatura de la proyecccion (i.e. EPSG:23030)
340
     * @param proj Proyeccion
341
     */
342
    public static void add(String name, IProjection proj) {
343
        data.put(name, proj);
344
    }
345

    
346
    /**
347
     * Devuelve una proyeccion a partir de una cadena.
348
     * @param name abreviatura de la proyecccion (i.e. EPSG:23030)
349
     * @return Proyeccion si existe
350
     */
351
    public IProjection get(String name) {
352
        IProjection proj = null;
353

    
354
        if (ProjectionPool.data.containsKey(name)) {
355
            proj = (IProjection) ProjectionPool.data.get(name);
356
        } else {
357
                // Consultation to remote EPSG database
358
                // if (right)
359
                //    buil new IProjection from GML
360
                // else
361
            System.err.println("ProjectionPool: Key '" + name + "' not set.");
362
        }
363

    
364
        return proj;
365
    }
366

    
367
    public static Iterator iterator() {
368
        ArrayList projs = new ArrayList();
369

    
370
        Iterator iter = data.entrySet().iterator();
371

    
372
        while (iter.hasNext()) {
373
            projs.add(((Map.Entry) iter.next()).getValue());
374
        }
375

    
376
        return projs.iterator();
377
    }
378

    
379
        public boolean doesRigurousTransformations() {
380
                return false;
381
        }
382

    
383
    /**
384
     * LWS ?obsoleto?
385
     * Devuelve una proyeccion a partir de un codig epsg.
386
     * @param name codigo de la proyecccion (i.e. 23030)
387
     * @return Proyeccion si existe
388
     * /
389
    private static IProjection getByEpsg(String code) {
390
        IProjection proj = get("EPSG:" + code);
391

392
        return proj;
393
    }*/
394
}