Re: [JPP-Devel] How to load ESRI shapefiles by code

2010-05-28 Thread Stefan Steiniger
nice! Do you want write access to the svn? Then I would need you to register at sourceforge and you send me your name there (can be also in personal communication - even in german ;) stefan Benjamin Gudehus wrote: > I should not forget to take a look at DataSourceFileLayerLoader which > alread

Re: [JPP-Devel] How to load ESRI shapefiles by code

2010-05-28 Thread Sunburned Surveyor
Thanks for everyone that posted or contributed code on this thread. This is very handy info, and I'll try to post the best excerpts to my OpenJUMP blog. The Sunburned Surveyor On Fri, May 28, 2010 at 9:20 AM, Hernan Arellano wrote: > Hi all, in the same way that load a layer by code, I needed lo

Re: [JPP-Devel] How to load ESRI shapefiles by code

2010-05-28 Thread Hernan Arellano
Hi all, in the same way that load a layer by code, I needed load a jpg image by code, at the same map. I want to share with you too, the code to load an image without a wizard: *** *** public boolean execute(PlugInContext context) throws Exception { LayerManager layerManager = co

Re: [JPP-Devel] How to load ESRI shapefiles by code

2010-05-28 Thread Benjamin Gudehus
I should not forget to take a look at DataSourceFileLayerLoader which already provides a similar functionality. But it needs to split up in serveral independent methods. i.e. split DataSourceFileLayerLoader.open() into toDataSourceQuery(), toFeatureCollection() and toLayer(). --Benjamin 2010/5/2

Re: [JPP-Devel] How to load ESRI shapefiles by code

2010-05-28 Thread Benjamin Gudehus
What I forgot to mention: I've written it in Groovy. My unit tests / specifications depend on Groovy and Spock. Once finished I'll rewrite/convert the non-test code to Java. 2010/5/28 Benjamin Gudehus > I pushed a working draft of DataSourceTools to > http://bitbucket.org/hastebrot/openjump-groo

Re: [JPP-Devel] How to load ESRI shapefiles by code

2010-05-28 Thread Benjamin Gudehus
I pushed a working draft of DataSourceTools to http://bitbucket.org/hastebrot/openjump-groovy-addons/src/653c99258dea/src/org/openjump/groovy/DataSourceTools.groovy . Here an outline: class DataSourceTools { static DataSourceQuery toDataSourceQuery(File file, Class dataSourceClass,

Re: [JPP-Devel] How to load ESRI shapefiles by code

2010-05-28 Thread Larry Becker
Thanks for volunteering to do this Benjamin. We probably need to make a new page on the wiki that documents it called something like "how to load layers in a plugin". A snippet of BeanShell would be nice too. :-] regards, Larry On Fri, May 28, 2010 at 3:26 AM, Benjamin Gudehus wrote: > how ab

Re: [JPP-Devel] How to load ESRI shapefiles by code

2010-05-28 Thread Benjamin Gudehus
> how about not splitting the class (i.e. avoiding to break anything), but > just add the second class for programmatical access? Maybe this could > even go into the core.apitools package. yes, important to make no backward incompatible changes to LoadDatasetPlugIn. If you feel like creating su

Re: [JPP-Devel] How to load ESRI shapefiles by code

2010-05-27 Thread Hernan Arellano
Thanks for the help guys! I`ve solved it by the following code: (maybe there are some things no needed, like options, but it works!!) DataSource dataSource = (DataSource)LangUtil.newInstance(StandardReaderWriterFileDataSource.Shapefile.class); Map options = new HashMap(); Map

Re: [JPP-Devel] How to load ESRI shapefiles by code

2010-05-27 Thread Stefan Steiniger
thanks michael, I add that to the wiki. Michaël Michaud wrote: > Hi, > > Don't know if you still want to work inside OpenJUMP wokbench or not, > but here is a very simple example I just picked up from the JTS > discussion list : > > String layer = "data/tigerline/2009_us_state/tl_2009_us_sta

Re: [JPP-Devel] How to load ESRI shapefiles by code

2010-05-27 Thread Stefan Steiniger
Hei Benjamin, how about not splitting the class (i.e. avoiding to break anything), but just add the second class for programmatical access? Maybe this could even go into the core.apitools package. If you feel like creating such a class, I can add it. cheers, stefan Benjamin Gudehus wrote: > H

Re: [JPP-Devel] How to load ESRI shapefiles by code

2010-05-27 Thread Michaël Michaud
Hi, Don't know if you still want to work inside OpenJUMP wokbench or not, but here is a very simple example I just picked up from the JTS discussion list : String layer = "data/tigerline/2009_us_state/tl_2009_us_state.shp"; ShapefileReader reader = new ShapefileReader(); FeatureCollection fc =

Re: [JPP-Devel] How to load ESRI shapefiles by code

2010-05-27 Thread Benjamin Gudehus
Hi! If you just want to load shapefiles, you can use ShapefileReader directly to load a shapefile into a FeatureCollection. ShapefileReader reader = new ShapefileReader(); FeatureCollection features = reader.read(new DriverProperties(shapefilePath)); Layer layer = context.getLayerManager().addLay

Re: [JPP-Devel] How to load ESRI shapefiles by code

2010-05-26 Thread Stefan Steiniger
does it help you too look into this class: com.vividsolutions.jump.workbench.datasource.AbstractLoadDatasetPlugIn I think it is not used anymore... stefan Hernan Arellano wrote: > Hi all! i'm working on a project, with OpenJump 1.3.1, that it needs to > load a set of ESRI Shapefiles from a pa

[JPP-Devel] How to load ESRI shapefiles by code

2010-05-26 Thread Hernan Arellano
Hi all! i'm working on a project, with OpenJump 1.3.1, that it needs to load a set of ESRI Shapefiles from a path to any category of the map. I`ve seen the following code to load a shapefile, of the method "open" from DataSourceFileLayerLoader class. The problem is that this uses a monitor of