I figured out how to do this. An outline of the steps involved are as
follows:
- Get the schema of all the feature classes (shapefiles) getting merged
- Combine these schemas into a new schema
- Read each feature for each feature class and copy
the geometry and attributes to the new feature class (shapefile)
- Write the shapefile
Andrea,
A shapefile only has one schema. The problem was trying to get Geotools to
merge the schemas together into a new shapefile. Coming from ArcObjects,
this is a simple procedure because AO will copy all the attributes for you;
I thought this would be the same with Geotools.
With Geotools, we just need to copy the attributes ourselves, which is very
simple.
On Sat, Dec 29, 2012 at 3:37 AM, Andrea Aime
<[email protected]>wrote:
> On Fri, Dec 28, 2012 at 11:03 PM, Brian Behling
> <[email protected]>wrote:
>
>> So, since there is really isn't any documentation on how to merge
>> shapefiles, anyone have any ideas?
>>
>
> First off, a shapefile cannot contain features with different schemas, you
> have to make them homogeneous
> first, meaning:
> - same geometry type
> - same coordinate reference system
> - same set of non geometric attributes
>
> How you do that is up to you, generally speaking you could build a feature
> type that has the sum
> of all the attributes of all incoming shapefiles, which will of course
> result in a lot of null values...
>
> Cheers
> Andrea
>
>
> --
> ==
> Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
> information.
> ==
>
> Ing. Andrea Aime
> @geowolf
> Technical Lead
>
> GeoSolutions S.A.S.
> Via Poggio alle Viti 1187
> 55054 Massarosa (LU)
> Italy
> phone: +39 0584 962313
> fax: +39 0584 1660272
> mob: +39 339 8844549
>
> http://www.geo-solutions.it
> http://twitter.com/geosolutions_it
>
> -------------------------------------------------------
>
------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users