FileDataStore store = FileDataStoreFinder.getDataStore(shapeFile);
SimpleFeatureSource featureSource = store.getFeatureSource();
SimpleFeatureCollection featureCollection = featureSource.getFeatures();
SimpleFeatureIterator featureIterator = featureCollection.features();
List<AttributeDescriptor> attributeDescriptors = featureSource.getSchema().getAttributeDescriptors();
// update field listing
Long position = new Long(0);
for(AttributeDescriptor attribute : attributeDescriptors)
{
GisUploadField field = new GisUploadField();
field.fieldName = attribute.getName().toString();
field.fieldType = attribute.getType().getName().getLocalPart();
field.fieldPosition = position;
field.gisUpload = gisUpload;
field.save();
position++;
}
CoordinateReferenceSystem dataCRS = featureSource.getSchema().getCoordinateReferenceSystem();
String code = "EPSG:4326";
CRSAuthorityFactory crsAuthorityFactory = CRS.getAuthorityFactory(true);
CoordinateReferenceSystem mapCRS = crsAuthorityFactory.createCoordinateReferenceSystem(code);
boolean lenient = true; // allow for some error due to different datums
MathTransform transform = CRS.findMathTransform(dataCRS, mapCRS, lenient);
while (featureIterator.hasNext())
{
SimpleFeature feature = featureIterator.next();
GeometryType geomType = feature.getFeatureType().getGeometryDescriptor().getType();
// handle appropriate shape/upload type
if(gisUpload.type == GisUploadType.ROUTES)