Hi,
I am using geotools 14.2 (great software, btw) and ran into the following
problem:
I am trying to access a geodatabase (gdb), which contains street data.
This is the relevant code:
Map<String, String> connectionParams = new HashMap<String, String>();
connectionParams.put("DriverName", "FileGDB");
connectionParams.put("DatasourceName", new
File("G:/foo.gdb/").getAbsolutePath());
lu2000DataStore = factory.createDataStore(connectionParams);
SimpleFeatureSource lu2000Verkehr =
lu2000DataStore.getFeatureSource("d_003_verkehrsnetz");
lu2000Verkehr.getSchema();
The getSchema()-call produces the following exception:
Exception in thread "main" java.lang.RuntimeException: java.io.IOException:
Unknown geometry type: 5
at
org.geotools.data.store.ContentFeatureSource.getAbsoluteSchema(ContentFeatureSource.java:345)
at
org.geotools.data.store.ContentFeatureSource.getSchema(ContentFeatureSource.java:312)
at
org.geotools.data.store.ContentFeatureSource.getSchema(ContentFeatureSource.java:112)
at urbanGrowthModeling.PrepareData.main(PrepareData.java:158)
Caused by: java.io.IOException: Unknown geometry type: 5
at
org.geotools.data.ogr.FeatureTypeMapper.getGeometryBinding(FeatureTypeMapper.java:313)
at
org.geotools.data.ogr.FeatureTypeMapper.getFeatureType(FeatureTypeMapper.java:80)
at
org.geotools.data.ogr.OGRFeatureSource.buildFeatureType(OGRFeatureSource.java:430)
at
org.geotools.data.ogr.OGRFeatureStore.buildFeatureType(OGRFeatureStore.java:120)
at
org.geotools.data.store.ContentFeatureSource.getAbsoluteSchema(ContentFeatureSource.java:343)
... 3 more
So, the geometry type seems to be unknown. Geometry type 5 typically refers to
MultiLineStrings. right?
According to FeatureTypeMapper.class, MultiLineStrings are in principal
supported:
private Class<? extends Geometry> getGeometryBinding(Object definition) throws
IOException {
long value = ogr.LayerGetGeometryType(definition);
// for line and polygon we return multi in any case since OGR will
declare simple for
// multigeom
// anyways and then return simple or multi in the actual geoemtries
depending on
// what it finds
if (value == ogr.GetPointType()
|| value == ogr.GetPoint25DType()) {
return Point.class;
} else if (value == ogr.GetLinearRingType()) {
return LinearRing.class;
} else if (value == ogr.GetLineStringType()
|| value == ogr.GetLineString25DType()
|| value == ogr.GetMultiLineStringType()
|| value == ogr.GetMultiLineString25DType()) {
return MultiLineString.class;
} else if (value == ogr.GetPolygonType()
|| value == ogr.GetPolygon25DType()
|| value == ogr.GetMultiPolygonType()
|| value == ogr.GetMultiPolygon25DType()) {
return MultiPolygon.class;
} else if (value == ogr.GetGeometryCollectionType()
|| value == ogr.GetGeometryCollection25DType()) {
return GeometryCollection.class;
} else if (value == ogr.GetGeometryNoneType()) {
return null;
} else if (value == ogr.GetGeometryUnknownType()) {
return Geometry.class;
} else {
throw new IOException("Unknown geometry type: " + value);
}
}
So, I guess, ogr.getMultiLineStringType() does return something else but 5,
right?
Is this the problem? Any ideas how to fix the problem? Any help is much
appreciated. Thank you in advance.
Best
Julian
------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users