Apologies, I went off-list by mistake.

There are selectAndCreateNewShapefile methods in:
https://github.com/agdturner/digital-welfare/blob/master/src/main/java/uk/ac/leeds/ccg/andyt/projects/digitalwelfare/mapping/DW_Maps.java

The transact method is in:
https://github.com/agdturner/digital-welfare/blob/master/src/main/java/uk/ac/leeds/ccg/andyt/projects/digitalwelfare/mapping/DW_Shapefile.java

I call these from deep within the loops of the mapCountsForLevel method in:
https://github.com/agdturner/digital-welfare/blob/master/src/main/java/uk/ac/leeds/ccg/andyt/projects/digitalwelfare/process/DW_ChoroplethMaps.java

The other main classes where useful code for this might be are in:
https://github.com/agdturner/digital-welfare/blob/master/src/main/java/uk/ac/leeds/ccg/andyt/projects/digitalwelfare/mapping/

I am moving all the generic things to a separate project in the very near 
future as I have another project that will be doing something similar and 
abstracting things like this out seems best. So that code is moving to:
https://github.com/agdturner/agdt-geotools

I hope to abstract the code and get this working for another project next week.

HTH

Andy

________________________________________
From: Gabriella Turek [gabriella.tu...@niwa.co.nz]
Sent: 26 February 2015 19:47
To: Andy Turner
Subject: Re: [Geotools-gt2-users] Shapefiles questions

Ah great! Yes, if you could pin point an example it would help me a lot
Cheers
Gaby

On 26/02/15 7:25 pm, "Andy Turner" <a.g.d.tur...@leeds.ac.uk> wrote:

>Hi Gaby,
>
>I do something like this. I define a new SimpleFeatureType with the
>additional attributes, then iterate over the features in a
>ShapefileDataSource adding those features that match my selection
>criteria to a TreeSetFeatureCollection. Once this is done I Transact the
>changes creating a new Shapefile. I can point you to my code that does
>this if it helps... Overwriting the same file might be best done (if it
>must be done) after.
>
>HTH
>
>Andy
>
>http://www.geog.leeds.ac.uk/people/a.turner/index.html
>
>----- Reply message -----
>From: "Gabriella Turek" <gabriella.tu...@niwa.co.nz>
>To: "geotools users" <geotools-gt2-users@lists.sourceforge.net>
>Subject: [Geotools-gt2-users] Shapefiles questions
>Date: Thu, Feb 26, 2015 03:22
>
>Hello,
>I am reading a shapefile, and I want to use some (or all) of the
>attributes in a new shape file I’ll be eventually saving.
>The features in the shapefile will be typically a subset of the original
>shapefile, but there will be added attributes.
>
>Is there a way to create a clone of the original's SimpleFeatureCollection
>so that I can edit it and then save that data to a new shapefile?
>In some cases I cannot run a simple filter to obtain a sub collection, I
>need to remove actual features.
>
>Or if this is not the best way to do this, what would be?
>
>Thanx
>gaby
>
>
>
>--------------------------------------------------------------------------
>----
>Dive into the World of Parallel Programming The Go Parallel Website,
>sponsored
>by Intel and developed in partnership with Slashdot Media, is your hub
>for all
>things parallel software development, from weekly thought leadership
>blogs to
>news, videos, case studies, tutorials and more. Take a look and join the
>conversation now. http://goparallel.sourceforge.net/
>_______________________________________________
>GeoTools-GT2-Users mailing list
>GeoTools-GT2-Users@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to