I\'m interested in writing a visualization program for the road data in the 2009 Tiger/Line Shapefiles. I\'d like to draw the line data to display all the roads for my coun
You can directly use GUI GIS tools so that their is no need of changing the source code of GeoTools.
I use QGIS which does all operations(even more) than GeoTools.
Quantum GIS - An open source Geographic Information System for editing, merging and simplifying shapefile maps. See also: creating maps with multiple layers using Quantum GIS.
There is GeoTools, or more exactly this class ShapefileDataStore.
GeoTools will do it. There are a ton of jars and you don't need most of them. However, reading the shapefile is just a few lines.
File file = new File("mayshapefile.shp");
try {
Map<String, String> connect = new HashMap();
connect.put("url", file.toURI().toString());
DataStore dataStore = DataStoreFinder.getDataStore(connect);
String[] typeNames = dataStore.getTypeNames();
String typeName = typeNames[0];
System.out.println("Reading content " + typeName);
FeatureSource featureSource = dataStore.getFeatureSource(typeName);
FeatureCollection collection = featureSource.getFeatures();
FeatureIterator iterator = collection.features();
try {
while (iterator.hasNext()) {
Feature feature = iterator.next();
GeometryAttribute sourceGeometry = feature.getDefaultGeometryProperty();
}
} finally {
iterator.close();
}
} catch (Throwable e) {}
You could try to use Java ESRI Shape File Reader library. It's small, easy to install and has very simple API. The only drawback is that it does not read other mandatory and optional files (.shx, .dbf, etc.) that are usually shipped with a shape file.
Openmap has a Java API that provides read and write access to ESRI files.