Difference between revisions of "How to load data from a Shape File directly"
Jump to navigation
Jump to search
(Created page with 'An example that allows to load data stored in a Shapefile directly, without any GUI interactions: <pre> String filename= "data/tigerline/2009_us_state/tl_2009_us_state.shp"; Sha…') |
|||
Line 14: | Line 14: | ||
Note, the context is a ''PlugInContext'' available in a PlugIn class. | Note, the context is a ''PlugInContext'' available in a PlugIn class. | ||
+ | |||
+ | For other examples, and also on how to load image files by code check out this email thread:<br> | ||
+ | http://www.mail-archive.com/jump-pilot-devel@lists.sourceforge.net/msg07498.html |
Latest revision as of 20:36, 2 June 2010
An example that allows to load data stored in a Shapefile directly, without any GUI interactions:
String filename= "data/tigerline/2009_us_state/tl_2009_us_state.shp"; ShapefileReader reader = new ShapefileReader(); FeatureCollection fc = reader.read(new DriverProperties(filename)); List<Feature> features = fc.getFeatures();
The list of features can then be parsed and modified. You can also add the FeatureCollection as layer in OpenJUMP using:
context.addLayer(StandardCategoryNames.RESULT, "myLayerName" , fc );
Note, the context is a PlugInContext available in a PlugIn class.
For other examples, and also on how to load image files by code check out this email thread:
http://www.mail-archive.com/jump-pilot-devel@lists.sourceforge.net/msg07498.html