Based on pieces of advice I found in other threads of this email list I
managed to export to PostGIS without any problem. Nevertheless, when I
change my dependencies back to oracle libraries, I manage to get exported
all of the attributes data, but the_geom collumn which remains null. And
there is still the warning causing all the troubles:
May 28, 2011 9:02:36 PM org.geotools.jdbc.JDBCDataStore getMapping
WARNING: No mapping for com.vividsolutions.jts.geom.Point
Am I missing some additional jar dependency? It seems to me that there is
some problem with OracleDialect class inicialization, but I have no clue
where and why :(
I am using geotools version 8.0-M0 from the following repository and Oracle
version:
NLSRTL 10.2.0.1.0 Production
Oracle Database 10g Express Edition 10.2.0.1.0 Product
PL/SQL 10.2.0.1.0 Production
TNS for Linux: 10.2.0.1.0 Production:
And ojdbc14.jar v10.2.0.3.0 downloaded from the oracle site.
=================================================================
<repositories>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net repository</name>
<url>http://download.java.net/maven/2</url>
</repository>
<repository>
<id>osgeo</id>
<name>Open Source Geospatial Foundation
Repository</name>
<url>http://download.osgeo.org/webdav/geotools/</url>
</repository>
</repositories>
=================================================================
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-shapefile</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools.jdbc</groupId>
<artifactId>gt-jdbc-oracle</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-epsg-hsql</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.3.0</version>
</dependency>
</dependencies>
=================================================================
package org.geotools.tutorial;
import java.io.IOException;
import java.io.Serializable;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.geotools.data.DataStore;
import org.geotools.data.DataStoreFinder;
import org.geotools.data.FeatureSource;
import org.geotools.data.FeatureStore;
import org.geotools.feature.FeatureCollection;
import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
import org.geotools.referencing.CRS;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.simple.SimpleFeatureType;
import org.opengis.referencing.FactoryException;
import org.opengis.referencing.ReferenceIdentifier;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
public class Test {
public static void main(String args[]) throws FactoryException {
try {
// shapefile loader
Map<Object,Serializable> shapeParams = new
HashMap<Object,Serializable>();
shapeParams.put("url", new
URL("file:///home/jirka/Desktop/shapes/archsites.shp"));
DataStore shapeDataStore =
DataStoreFinder.getDataStore(shapeParams);
// feature type
String typeName = shapeDataStore.getTypeNames()[0];
FeatureSource<SimpleFeatureType,SimpleFeature> featSource
= shapeDataStore.getFeatureSource(typeName);
FeatureCollection<SimpleFeatureType,SimpleFeature>
featSrcCollection = featSource.getFeatures();
SimpleFeatureType ft = shapeDataStore.getSchema(typeName);
// feature type copy to set the new name
SimpleFeatureTypeBuilder builder = new
SimpleFeatureTypeBuilder();
builder.setName("testik");
builder.setAttributes(ft.getAttributeDescriptors());
builder.setCRS(ft.getCoordinateReferenceSystem());
SimpleFeatureType newSchema = builder.buildFeatureType();
// management of the projection system
CoordinateReferenceSystem crs =
ft.getCoordinateReferenceSystem();
// test of the CRS based on the .prj file
Integer crsCode = CRS.lookupEpsgCode(crs, true);
Set<ReferenceIdentifier> refIds =
ft.getCoordinateReferenceSystem().getIdentifiers();
if ( ( (refIds == null) || (refIds.isEmpty() ) ) && (crsCode ==
null) ) {
CoordinateReferenceSystem crsEpsg = CRS.decode("EPSG:4326");
newSchema =
SimpleFeatureTypeBuilder.retype(newSchema,crsEpsg);
}
Map params = new HashMap();
/*
params.put("dbtype", "postgis");
params.put("host", "localhost");
params.put("port", new Integer(5432));
params.put("database", "gisdb");
params.put("user", "gis");
params.put("passwd", "blabla");
*/
params.put( "dbtype", "oracle");
params.put( "host", "localhost");
params.put( "port", 1521);
params.put( "database", "xe");
params.put( "schema", "jirka");
params.put( "user", "jirka");
params.put( "passwd", "blabla");
DataStore dataStore = DataStoreFinder.getDataStore(params);
dataStore.createSchema(newSchema);
FeatureStore<SimpleFeatureType,SimpleFeature> featStore =
(FeatureStore<SimpleFeatureType,SimpleFeature>)
dataStore.getFeatureSource("TESTIK");
featStore.addFeatures(featSrcCollection);
} catch (IOException e) {
e.printStackTrace();
}
}
}
=================================================================
--
View this message in context:
http://osgeo-org.1803224.n2.nabble.com/Oracle-spatial-plugin-WARNING-No-mapping-for-com-vividsolutions-jts-geom-Point-tp6413790p6415531.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery,
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now.
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users