root / trunk / libraries / libCq_CMS_praster / src / org / cresques / cts / gt2 / CSDatum.java @ 8026
History | View | Annotate | Download (6 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.gt2; |
25 |
|
26 |
import org.cresques.cts.IDatum; |
27 |
|
28 |
import org.geotools.cs.CoordinateSystemFactory; |
29 |
import org.geotools.cs.GeographicCoordinateSystem; |
30 |
import org.geotools.cs.HorizontalDatum; |
31 |
|
32 |
import org.opengis.referencing.FactoryException; |
33 |
|
34 |
import java.util.Locale; |
35 |
|
36 |
|
37 |
/**
|
38 |
* Datum (y Ellipsoid) de GeoTools2.
|
39 |
*
|
40 |
* @author "Luis W. Sevilla" <sevilla_lui@gva.es>
|
41 |
*/
|
42 |
public class CSDatum implements IDatum { |
43 |
private static String line1 = "DATUM[\"WGS_1984\"," + |
44 |
"SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]]," +
|
45 |
"TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6326\"]]";
|
46 |
private static String line2 = "DATUM[\"European_Datum_1950\"," + |
47 |
"SPHEROID[\"International 1924\",6378388,297,AUTHORITY[\"EPSG\",\"7022\"]]," +
|
48 |
"TOWGS84[-84,-107,-120,0,0,0,0],AUTHORITY[\"EPSG\",\"6230\"]]";
|
49 |
private static String line3 = "DATUM[\"Nouvelle_Triangulation_Francaise\"," + |
50 |
"SPHEROID[\"Clarke 1880 (IGN)\",6378249.2,293.466021293627, AUTHORITY[\"EPSG\",\"7011\"]]," +
|
51 |
"TOWGS84[-168,-60,320,0,0,0,0],AUTHORITY[\"EPSG\",\"6275\"]]";
|
52 |
private static String line4 = "DATUM[\"Datum 73\"," + |
53 |
"SPHEROID[\"International 1924\",6378388,297,AUTHORITY[\"EPSG\",\"7022\"]]," +
|
54 |
"TOWGS84[-87,-98,-121,0,0,0,0],AUTHORITY[\"EPSG\",\"4274\"]]";
|
55 |
private static String line5 = "DATUM[\"North_American_Datum_1927\"," + |
56 |
"SPHEROID[\"Clarke 1866\",6378206.4,294.978698213901,AUTHORITY[\"EPSG\",\"7008\"]]," +
|
57 |
"TOWGS84[-3,142,183,0,0,0,0],AUTHORITY[\"EPSG\",\"6267\"]]";
|
58 |
private static String line6 = "DATUM[\"North_American_Datum_1983\"," + |
59 |
"SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]]," +
|
60 |
"TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6269\"]]";
|
61 |
|
62 |
/*
|
63 |
* INSERT INTO epsg_coordinatereferencesystem VALUES (
|
64 |
* 4288, 'Loma Quintana', 1313, 'geographic 2D', 6422, 6288,
|
65 |
* Null, Null, Null, Null, 'Geodetic survey.',
|
66 |
* 'Superseded by La Canoa (code 4247).', '',
|
67 |
* 'EPSG', '2004/01/06', '2003.37', 1, 0 );
|
68 |
*
|
69 |
* DX (m) = -270.933
|
70 |
DY (m) = 115.599
|
71 |
DZ (m) = -360.226
|
72 |
|
73 |
EX (") = -5.266
|
74 |
EY (") = -1.238
|
75 |
EZ (") = 2.381
|
76 |
FE (ppm) = -5.109
|
77 |
*/
|
78 |
private static String line7 = "DATUM[\"Loma Quintana\"," + |
79 |
"SPHEROID[\"International 1924\",6378388,297,AUTHORITY[\"EPSG\",\"7022\"]]," +
|
80 |
"TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6288\"]]";
|
81 |
|
82 |
/*
|
83 |
# La Canoa
|
84 |
<4247> +proj=longlat +ellps=intl +towgs84=-273.5,110.6,-357.9,0,0,0,0
|
85 |
no_defs <>
|
86 |
# PSAD56
|
87 |
<4248> +proj=longlat +ellps=intl +towgs84=-288,175,-376,0,0,0,0 no_defs <>
|
88 |
*/
|
89 |
private static String line8 = "DATUM[\"La Canoa\"," + |
90 |
"SPHEROID[\"International 1924\",6378388,297,AUTHORITY[\"EPSG\",\"7022\"]]," +
|
91 |
"TOWGS84[-270.933,115.599,-360.226,-5.266,-1.238,2.381,-5.109],AUTHORITY[\"EPSG\",\"6288\"]]";
|
92 |
public final static CSDatum wgs84 = new CSDatum(line1); |
93 |
public final static CSDatum ed50 = new CSDatum(line2); |
94 |
public final static CSDatum ntf = new CSDatum(line3); |
95 |
public final static CSDatum d73 = new CSDatum(line4); |
96 |
public final static CSDatum nad27 = new CSDatum(line5); |
97 |
public final static CSDatum nad83 = new CSDatum(line6); |
98 |
public final static CSDatum lomaQuintana = new CSDatum(line7); |
99 |
public final static CSDatum laCanoa = new CSDatum(line8); |
100 |
private String sGeo1 = "GEOGCS[\"WGS 84\","; |
101 |
private String sGeo2 = |
102 |
",PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]]," +
|
103 |
"UNIT[\"DMSH\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9108\"]]," +
|
104 |
"AXIS[\"Lat\",NORTH],AXIS[\"Long\",EAST]," +
|
105 |
"AUTHORITY[\"EPSG\",\"4326\"]]";
|
106 |
private HorizontalDatum datum = null; |
107 |
|
108 |
public CSDatum(String sDatum) { |
109 |
try {
|
110 |
datum = ((GeographicCoordinateSystem) CoordinateSystemFactory.getDefault() |
111 |
.createFromWKT(sGeo1 + |
112 |
sDatum + |
113 |
sGeo2)).getHorizontalDatum(); |
114 |
} catch (FactoryException e) {
|
115 |
// TODO Bloque catch generado autom?ticamente
|
116 |
e.printStackTrace(); |
117 |
} |
118 |
} |
119 |
|
120 |
public String getName(Locale loc) { |
121 |
return datum.getName().toString();
|
122 |
} |
123 |
|
124 |
HorizontalDatum getDatum() { |
125 |
return datum;
|
126 |
} |
127 |
|
128 |
public double getESemiMajorAxis() { |
129 |
return datum.getEllipsoid().getSemiMajorAxis();
|
130 |
} |
131 |
|
132 |
public double getEIFlattening() { |
133 |
return datum.getEllipsoid().getInverseFlattening();
|
134 |
} |
135 |
|
136 |
public String toString() { |
137 |
return datum.toString();
|
138 |
} |
139 |
} |