M.S.Bachler wrote:
Hi!
Silly question.
Earlier you helpfully gave me a code snippet to create a new shapefile.
IndexedShapefileDatastoreFactory fac=new
IndexedShapefileDataStoreFactory();
ShapefileDataStore ds=fac.createDatastore(url);
// I assume this is the URL of the new shapefile I want it to create?
GeometryFactory gf = new GeometryFactory();
ds.createSchema( featureType );
// Here I got lost. Started to investigate FeatureType and felt like I
was walking through tar.
FeatureType describes what your data looks like, you can make a new
shapefile in uDig and play with it in a java program to look at the kind
of information that is there.
It comes down to:
- a type name
- a series of attributes (string, number, geometry .... but not date,
there is a problem with date)
- one of the attribtues may be marked as the "default geometry"
I eventually found IndexedShapefileDatastoreFactory etc in the
GeoTools api.
Do I actually have to download this and import it into Eclipse, or is
it already available to me somehow, as the compiler keeps telling me
it can't find IndexedShapefileDatastoreFactory even though I have put
the import statement for it in the class?
The geotools stuff is already available (if not you may need to depend
on GISPlatform or on libs itself).
But there is something serious I gotta explain to you first about
eclipse hacking, and that is how "depending on a plugin" works...
The import statement, and even the help the eclipse gives you interms of
"quickfixes" are wrong. These are all based on the "Java Nature" ... the
Java Nature does all the building stuff.
When you are doing Eclipse RCP development you are doing the "PDE
Nature" and everything is done in terms of plug-ins and dependencies.
So the fact that you cannot "see" the right thing to import is a problem
that shows up at the java level - normally you would solve this by
playing with your .classpath file.
But today you are going to solve it by going to your plugin MANIFEST
file and changing the dependencies (aka add net.refractions.udig.libs)
and then right click on the plugin and choose PDE Build -> Update classpath
Once the classpath is updated, the java build system will be happy and
let you import what you wanted.
Jody
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel