public InterestingPointVisitor(FeatureSource surface, double radius, double hillHeight) { surfaceFeatureSource = surface; this.radius = radius; this.hillHeight = hillHeight; viewAngles = DefaultFeatureCollections.newCollection(); try { viewAngleType = DataUtilities.createType("ViewAngles", "geometry:Polygon,daukstis:Double,"); } catch (SchemaException e) { e.printStackTrace(); } }
public KPTShapefileWriter(String directory, String fileName) { this.directory = directory; this.fileName = fileName; crs = DefaultGeographicCRS.WGS84; try { TYPE = DataUtilities.createType( "Location", "" // + "cadastral_number:String," // <- a String attribute + "state:String," // a number attribute + "date_created:String," // + "area:String," // + "area_unit:String," // + "name:String," // + "location_in_bounds:String," // + "address_okato:String," // + "address_kladr:String," // + "address_region:String," // + "address_district_name:String," // + "address_district_type:String," // + "address_city_name:String," // + "address_city_type:String," // + "address_locality_name:String," // + "address_locality_type:String," // + "address_street_name:String," // + "address_street_type:String," // + "address_level_1_type:String," // + "address_level_1_value:String," // + "addess_note:String," // + "category:String," // + "utilization:String," // + "utilization_by_doc:String," // + "cadastral_cost:String," // + "cadastral_unit:String," // + "location:Polygon:srid=4326" // <- the geometry attribute: Point type ); } catch (SchemaException e) { e.printStackTrace(); } File newFile = new File(directory + "/" + fileName.substring(0, fileName.lastIndexOf(".")) + ".shp"); ShapefileDataStoreFactory dataStoreFactory = new ShapefileDataStoreFactory(); Map<String, Serializable> params = new HashMap<>(); try { params.put("url", newFile.toURI().toURL()); } catch (MalformedURLException e) { e.printStackTrace(); } params.put("create spatial index", Boolean.TRUE); try { newDataStore = (ShapefileDataStore) dataStoreFactory.createNewDataStore(params); } catch (IOException e) { e.printStackTrace(); } try { newDataStore.createSchema(TYPE); } catch (IOException e) { e.printStackTrace(); } }