Revision 1969
org.gvsig.raster.gdal/trunk/org.gvsig.raster.gdal/org.gvsig.raster.gdal.app/pom.xml | ||
---|---|---|
40 | 40 |
<scope>runtime</scope> |
41 | 41 |
</dependency> |
42 | 42 |
</dependencies> |
43 |
|
|
43 | 44 |
<profiles> |
44 |
<profile> |
|
45 |
<id>gvsig-install</id> |
|
46 |
<activation> |
|
47 |
<activeByDefault>true</activeByDefault> |
|
48 |
</activation> |
|
49 |
</profile> |
|
50 |
</profiles> |
|
45 |
|
|
46 |
<!-- *************** --> |
|
47 |
<!-- LINUX PROFILE --> |
|
48 |
<!-- *************** --> |
|
49 |
|
|
50 |
<profile> |
|
51 |
<id>linux-profile</id> |
|
52 |
<activation> |
|
53 |
<property> |
|
54 |
<name>native-platform</name> |
|
55 |
<value>linux</value> |
|
56 |
</property> |
|
57 |
</activation> |
|
58 |
<properties> |
|
59 |
<gvsig.package.info.operatingSystem>lin</gvsig.package.info.operatingSystem> |
|
60 |
<gvsig.package.info.architecture>x86</gvsig.package.info.architecture> |
|
61 |
<gvsig.package.info.baseDownloadURL>http://devel.gvsig.org/download/projects/Raster/pool/org.gvsig.raster.gdal.app</gvsig.package.info.baseDownloadURL> |
|
62 |
</properties> |
|
63 |
<build> |
|
64 |
<plugins> |
|
65 |
<plugin> |
|
66 |
<artifactId>maven-assembly-plugin</artifactId> |
|
67 |
<configuration> |
|
68 |
<ignoreDirFormatExtensions>true</ignoreDirFormatExtensions> |
|
69 |
<appendAssemblyId>false</appendAssemblyId> |
|
70 |
</configuration> |
|
71 |
<executions> |
|
72 |
<execution> |
|
73 |
<id>gvsig-plugin-package</id> |
|
74 |
<phase>package</phase> |
|
75 |
<goals> |
|
76 |
<goal>single</goal> |
|
77 |
</goals> |
|
78 |
<configuration> |
|
79 |
<finalName>gvSIG-desktop-${gvsig.package.info.gvSIGVersion}-${project.artifactId}-${gvsig.package.info.version}-${buildNumber}-${gvsig.package.info.state}-${gvsig.package.info.operatingSystem}-${gvsig.package.info.architecture}-${gvsig.package.info.javaVM}.gvspkg</finalName> |
|
80 |
<descriptors> |
|
81 |
<descriptor>src/main/assembly/gvsig-plugin-package-lin.xml</descriptor> |
|
82 |
</descriptors> |
|
83 |
</configuration> |
|
84 |
</execution> |
|
85 |
</executions> |
|
86 |
</plugin> |
|
87 |
</plugins> |
|
88 |
</build> |
|
89 |
</profile> |
|
90 |
|
|
91 |
<!-- *************** --> |
|
92 |
<!-- FEDORA PROFILE --> |
|
93 |
<!-- *************** --> |
|
94 |
|
|
95 |
<profile> |
|
96 |
<id>fedora11-profile</id> |
|
97 |
<activation> |
|
98 |
<property> |
|
99 |
<name>native-platform</name> |
|
100 |
<value>fedora11</value> |
|
101 |
</property> |
|
102 |
</activation> |
|
103 |
<properties> |
|
104 |
<gvsig.package.info.categories>Raster</gvsig.package.info.categories> |
|
105 |
<gvsig.package.info.operatingSystem>fedora11</gvsig.package.info.operatingSystem> |
|
106 |
<gvsig.package.info.architecture>x86</gvsig.package.info.architecture> |
|
107 |
</properties> |
|
108 |
<build> |
|
109 |
<plugins> |
|
110 |
<plugin> |
|
111 |
<artifactId>maven-assembly-plugin</artifactId> |
|
112 |
<configuration> |
|
113 |
<ignoreDirFormatExtensions>true</ignoreDirFormatExtensions> |
|
114 |
<appendAssemblyId>false</appendAssemblyId> |
|
115 |
</configuration> |
|
116 |
<executions> |
|
117 |
<execution> |
|
118 |
<id>gvsig-plugin-package</id> |
|
119 |
<phase>package</phase> |
|
120 |
<goals> |
|
121 |
<goal>single</goal> |
|
122 |
</goals> |
|
123 |
<configuration> |
|
124 |
<finalName>gvSIG-desktop-${gvsig.package.info.gvSIGVersion}-${project.artifactId}-${gvsig.package.info.version}-${buildNumber}-${gvsig.package.info.state}-${gvsig.package.info.operatingSystem}-${gvsig.package.info.architecture}-${gvsig.package.info.javaVM}.gvspkg</finalName> |
|
125 |
<descriptors> |
|
126 |
<descriptor>src/main/assembly/gvsig-plugin-package-fedora11.xml</descriptor> |
|
127 |
</descriptors> |
|
128 |
</configuration> |
|
129 |
</execution> |
|
130 |
</executions> |
|
131 |
</plugin> |
|
132 |
</plugins> |
|
133 |
</build> |
|
134 |
</profile> |
|
135 |
|
|
136 |
<!-- *************** --> |
|
137 |
<!-- WINDOWS PROFILE --> |
|
138 |
<!-- *************** --> |
|
139 |
|
|
140 |
<profile> |
|
141 |
<id>windows-profile</id> |
|
142 |
<activation> |
|
143 |
<property> |
|
144 |
<name>native-platform</name> |
|
145 |
<value>win</value> |
|
146 |
</property> |
|
147 |
</activation> |
|
148 |
<properties> |
|
149 |
<gvsig.package.info.operatingSystem>win</gvsig.package.info.operatingSystem> |
|
150 |
<gvsig.package.info.architecture>x86</gvsig.package.info.architecture> |
|
151 |
<gvsig.package.info.baseDownloadURL>http://devel.gvsig.org/download/projects/Raster/pool/org.gvsig.raster.gdal.app</gvsig.package.info.baseDownloadURL> |
|
152 |
</properties> |
|
153 |
<build> |
|
154 |
<plugins> |
|
155 |
<plugin> |
|
156 |
<artifactId>maven-assembly-plugin</artifactId> |
|
157 |
<configuration> |
|
158 |
<ignoreDirFormatExtensions>true</ignoreDirFormatExtensions> |
|
159 |
<appendAssemblyId>false</appendAssemblyId> |
|
160 |
</configuration> |
|
161 |
<executions> |
|
162 |
<execution> |
|
163 |
<id>gvsig-plugin-package</id> |
|
164 |
<phase>package</phase> |
|
165 |
<goals> |
|
166 |
<goal>single</goal> |
|
167 |
</goals> |
|
168 |
<configuration> |
|
169 |
<finalName>gvSIG-desktop-${gvsig.package.info.gvSIGVersion}-${project.artifactId}-${gvsig.package.info.version}-${buildNumber}-${gvsig.package.info.state}-${gvsig.package.info.operatingSystem}-${gvsig.package.info.architecture}-${gvsig.package.info.javaVM}.gvspkg</finalName> |
|
170 |
<descriptors> |
|
171 |
<descriptor>src/main/assembly/gvsig-plugin-package-win.xml</descriptor> |
|
172 |
</descriptors> |
|
173 |
</configuration> |
|
174 |
</execution> |
|
175 |
</executions> |
|
176 |
</plugin> |
|
177 |
</plugins> |
|
178 |
</build> |
|
179 |
</profile> |
|
180 |
</profiles> |
|
181 |
|
|
51 | 182 |
<properties> |
52 | 183 |
<gvsig.package.info.categories>Raster, Formats</gvsig.package.info.categories> |
53 | 184 |
<gvsig.package.info.state>testing</gvsig.package.info.state> |
54 | 185 |
<gvsig.package.info.baseDownloadURL>http://devel.gvsig.org/download/projects/Raster/pool/org.gvsig.raster.gdal.app</gvsig.package.info.baseDownloadURL> |
55 |
<gvsig.install.dir>${basedir}/../../build/product</gvsig.install.dir> |
|
56 | 186 |
<gvsig.package.info.dependencies>required: org.gvsig.raster.tilecache.app -ge 2</gvsig.package.info.dependencies> |
57 | 187 |
</properties> |
58 | 188 |
</project> |
org.gvsig.raster.gdal/trunk/org.gvsig.raster.gdal/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/DefaultGdalIOLibrary.java | ||
---|---|---|
24 | 24 |
import org.gvsig.fmap.dal.DALFileLibrary; |
25 | 25 |
import org.gvsig.fmap.dal.DALLibrary; |
26 | 26 |
import org.gvsig.fmap.dal.coverage.RasterLocator; |
27 |
import org.gvsig.fmap.dal.coverage.process.overview.OverviewBuilder; |
|
28 | 27 |
import org.gvsig.raster.gdal.overview.GdalOverviewBuilder; |
28 |
import org.gvsig.raster.gdal.util.DefaultCRSUtils; |
|
29 | 29 |
import org.gvsig.raster.impl.store.AbstractNewRasterStoreParameters; |
30 | 30 |
import org.gvsig.raster.impl.store.AbstractRasterFileDataParameters; |
31 | 31 |
import org.gvsig.tools.ToolsLibrary; |
... | ... | |
68 | 68 |
RasterLocator.getManager().getProviderServices().registerOverviewBuilderImplementation( |
69 | 69 |
"GDAL", |
70 | 70 |
new GdalOverviewBuilder()); |
71 |
|
|
72 |
//Register CRSUtils |
|
73 |
RasterLocator.getManager().getProviderServices().registerCRSUtilImplementation( |
|
74 |
new DefaultCRSUtils()); |
|
71 | 75 |
} |
72 | 76 |
} |
org.gvsig.raster.gdal/trunk/org.gvsig.raster.gdal/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/GdalProvider.java | ||
---|---|---|
246 | 246 |
String wktProjection = file.getProjectionRef(); |
247 | 247 |
if(wktProjection != null && wktProjection != "") { |
248 | 248 |
try { |
249 |
proj = RasterLocator.getManager().getCRSUtils().convertWktToIProjection(wktProjection); |
|
249 |
if(RasterLocator.getManager().isCRSUtilSupported()) |
|
250 |
proj = RasterLocator.getManager().getCRSUtils().convertWktToIProjection(wktProjection); |
|
250 | 251 |
} catch (Exception e) { |
251 | 252 |
logger.info("Error reading WKT from the raster provider", e); |
252 | 253 |
} |
org.gvsig.raster.gdal/trunk/org.gvsig.raster.gdal/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/util/DefaultCRSUtils.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.gdal.util; |
|
23 |
|
|
24 |
import org.cresques.cts.ICRSFactory; |
|
25 |
import org.cresques.cts.IProjection; |
|
26 |
import org.gvsig.fmap.crs.CRSFactory; |
|
27 |
import org.gvsig.fmap.dal.coverage.util.CRSUtils; |
|
28 |
import org.gvsig.jogr.CrsGdalException; |
|
29 |
import org.gvsig.jogr.OGRException; |
|
30 |
import org.gvsig.jogr.OGRSpatialReference; |
|
31 |
import org.slf4j.LoggerFactory; |
|
32 |
/** |
|
33 |
* Esta clase se encarga de hacer la conversion entre Wkt e IProjection. |
|
34 |
* |
|
35 |
* El uso se hace mediante dos llamadas estaticas que son: convertIProjectionToWkt y |
|
36 |
* convertWktToIProjection. |
|
37 |
* |
|
38 |
* Antes de usarlos, hay que saber si tenemos acceso a gvSIG e intentar coger el factory desde all?. |
|
39 |
* Ya que su uso consume tiempo y espacio de memoria y es preferible reaprovechar ese objeto ya |
|
40 |
* creado. Esto se hace con setCRSFactory. |
|
41 |
* |
|
42 |
* En caso de no asignarse el ya existente, el crear? uno interno y lo dejara en una variable estatica. |
|
43 |
* |
|
44 |
* @version 11/07/2008 |
|
45 |
* @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es) |
|
46 |
*/ |
|
47 |
public class DefaultCRSUtils implements CRSUtils { |
|
48 |
public ICRSFactory factory = null; |
|
49 |
|
|
50 |
/* |
|
51 |
* (non-Javadoc) |
|
52 |
* @see org.gvsig.fmap.dal.coverage.util.CRSUtils#setCRSFactory(org.cresques.cts.ICRSFactory) |
|
53 |
*/ |
|
54 |
public void setCRSFactory(ICRSFactory factory) { |
|
55 |
this.factory = factory; |
|
56 |
} |
|
57 |
|
|
58 |
/** |
|
59 |
* Devuelve el CRSFactory asignado desde fuera o creado desde dentro, todo depende de como se haya |
|
60 |
* usado. |
|
61 |
* |
|
62 |
* @param code |
|
63 |
* @return |
|
64 |
*/ |
|
65 |
private IProjection getCRS(String code) { |
|
66 |
if (factory == null) |
|
67 |
factory = CRSFactory.cp;//new ProjectionPool(); |
|
68 |
return factory.get(code); |
|
69 |
} |
|
70 |
|
|
71 |
/* |
|
72 |
* (non-Javadoc) |
|
73 |
* @see org.gvsig.fmap.dal.coverage.util.CRSUtils#convertWktToIProjection(java.lang.String) |
|
74 |
*/ |
|
75 |
public IProjection convertWktToIProjection(String wkt) { |
|
76 |
if (wkt == null || wkt.equals("")) |
|
77 |
return null; |
|
78 |
|
|
79 |
String code = null; |
|
80 |
String name = null; |
|
81 |
|
|
82 |
OGRSpatialReference oSRSSource = new OGRSpatialReference(); |
|
83 |
try { |
|
84 |
OGRSpatialReference.importFromWkt(oSRSSource, wkt); |
|
85 |
|
|
86 |
code = oSRSSource.getAuthorityCode("PROJCS"); |
|
87 |
if (code == null) |
|
88 |
code = oSRSSource.getAuthorityCode("GEOGCS"); |
|
89 |
name = oSRSSource.getAuthorityName("PROJCS"); |
|
90 |
if (name == null) |
|
91 |
name = oSRSSource.getAuthorityName("GEOGCS"); |
|
92 |
try { |
|
93 |
return getCRS(name + ":" + code); |
|
94 |
} catch (NumberFormatException ex) { |
|
95 |
return null; |
|
96 |
} |
|
97 |
} catch (OGRException e) { |
|
98 |
LoggerFactory.getLogger(getClass().getName()).debug("Problemas obteniendo el c?digo EPSG", e); |
|
99 |
} catch (CrsGdalException e) { |
|
100 |
LoggerFactory.getLogger(getClass().getName()).debug("Problemas obteniendo el c?digo EPSG", e); |
|
101 |
} |
|
102 |
|
|
103 |
return null; |
|
104 |
} |
|
105 |
|
|
106 |
/* |
|
107 |
* (non-Javadoc) |
|
108 |
* @see org.gvsig.fmap.dal.coverage.util.CRSUtils#convertIProjectionToWkt(org.cresques.cts.IProjection) |
|
109 |
*/ |
|
110 |
public String convertIProjectionToWkt(IProjection projection) { |
|
111 |
if(projection == null) |
|
112 |
return null; |
|
113 |
OGRSpatialReference oSRSSource = new OGRSpatialReference(); |
|
114 |
|
|
115 |
String code = projection.getAbrev(); |
|
116 |
String name = code.substring(0, code.indexOf(":")); |
|
117 |
code = code.substring(code.indexOf(":") + 1); |
|
118 |
|
|
119 |
try { |
|
120 |
do |
|
121 |
if (name.equals("EPSG")) { |
|
122 |
OGRSpatialReference.importFromEPSG(oSRSSource, Integer.parseInt(code)); |
|
123 |
break; |
|
124 |
} |
|
125 |
while (false); |
|
126 |
return OGRSpatialReference.exportToWkt(oSRSSource); |
|
127 |
} catch (CrsGdalException e) { |
|
128 |
LoggerFactory.getLogger(getClass().getName()).debug("Problemas obteniendo el c?digo WKT", e); |
|
129 |
} catch (NumberFormatException e) { |
|
130 |
LoggerFactory.getLogger(getClass().getName()).debug("Problemas obteniendo el c?digo WKT", e); |
|
131 |
} catch (OGRException e) { |
|
132 |
LoggerFactory.getLogger(getClass().getName()).debug("Problemas obteniendo el c?digo WKT", e); |
|
133 |
} |
|
134 |
return null; |
|
135 |
} |
|
136 |
} |
|
0 | 137 |
org.gvsig.raster.gdal/trunk/org.gvsig.raster.gdal/org.gvsig.raster.gdal.io/pom.xml | ||
---|---|---|
9 | 9 |
<artifactId>org.gvsig.raster.gdal</artifactId> |
10 | 10 |
<version>2.1.0-SNAPSHOT</version> |
11 | 11 |
</parent> |
12 |
<properties> |
|
13 |
<build-dir>${basedir}/../../build</build-dir> |
|
14 |
</properties> |
|
15 | 12 |
<dependencies> |
16 | 13 |
<dependency> |
17 | 14 |
<groupId>org.gvsig</groupId> |
Also available in: Unified diff