Mr. Malm,
The code in question does not look like mine. It would be
uncharacteristic for me to name a SimpleFeatureTypeBuilder "b". My
guess is that some refactoring work was done after I stopped working on
the project (I did my work about 4 years ago) and that this work
assumes that the "gat" will be populated. If I recall correctly, some
VPF "feature types" don't actually have geometries so this is an unsafe
assumption. My suggestion is simply to place a sanity check around the
call to setDefaultGeometry and to proceed from there.
If this doesn't work (the "gat" is NEVER populated), please let me know
and I will try to investigate further.
Regards,
Jeff
________________________________
From: Malm Paul [mailto:[email protected]]
Sent: Monday, January 19, 2009 7:23 AM
To: Jeff Yutzler
Subject: VPF question
Hi Jeff!
I have tried to mail the user group without any luck, therefore I'm
trying with you directly.
If you have the time to point me in the right direction I would be very
gratefull !
I don't know anything about the VPF - format.
I've downloaded geoTools 2.5.2 because I saw that it was possible to
read VPF files with tis tool kit.
Indata = eurnasia downloaded from NGA.
When I run the following command
DataStore ds = new org.geotools.data.vpf.VPFLibrary( new File
"C:\test\eurnasia\lib_007" ); // where the lht file is placed
I'm getting an exception;
Exception in thread "main" java.lang.NullPointerException
at org.geotools.data.vpf.file.VPFFile.<init>(VPFFile.java:171)
at
org.geotools.data.vpf.file.VPFFileStore.findFile(VPFFileStore.java:137)
at
org.geotools.data.vpf.file.VPFFileStore.getSchema(VPFFileStore.java:86)
at
org.geotools.data.vpf.file.VPFFileFactory.getFile(VPFFileFactory.java:13
5)
at org.geotools.data.vpf.VPFLibrary.<init>(VPFLibrary.java:171)
at org.geotools.data.vpf.VPFLibrary.<init>(VPFLibrary.java:156)
at VpfTest.main(VpfTest.java:22)
because of this function:
public VPFFile(String cPathName) throws IOException, SchemaException {
pathName = cPathName;
inputStream = new RandomAccessFile(cPathName, ACCESS_MODE);
readHeader();
GeometryDescriptor gat = null;
VPFColumn geometryColumn = null;
Iterator iter = columns.iterator();
while (iter.hasNext()) {
geometryColumn = (VPFColumn) iter.next();
if (geometryColumn.isGeometry()) {
gat = geometryColumn.getGeometryAttributeType();
break;
}
}
SimpleFeatureType superType = null;
// if it's a text geometry feature type add annotation as a
super type
if (pathName.endsWith(TEXT_PRIMITIVE)) {
superType = AnnotationFeatureType.ANNOTATION;
}
SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder();
b.setName( cPathName );
b.setNamespaceURI("VPF");
b.setSuperType(superType);
b.addAll( columns );
b.setDefaultGeometry(gat.getLocalName());
featureType = b.buildFeatureType();
}
gat is null when trying to get localName()
geometryColumn.isGeometry() is allways false !
Kind Regards,
Paul Malm
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel