What I use:Java 1.7, JTS 1.13, geotools.api 14
What I have finished:Creating correct JTS geometries from OSM relations, ways and nodes.
What I want to achieve:Create a csv file which contains the following data:the_geom, name, postal_code, country, osm_id
"the_geom" should be a JTS polygon geometry or a null geometry.(Complains ESRI Specification)
The csv file makes it possible to easy fill up data.
After those csv file is completely created I want to read that file and create a shapefile from it. Those attributes like name, postal_code and so on, should be written into a dbf file related to new shapefile.
Following this I want to import the new shape and dbf file into postgreSQL.
Next step to acomplish requirements written above:How can I create a new shape and dbf file from any collection containing JTS polygon geometries? There are many classes involved but none of them is explained clearly in geotools.org like creating file headers and so on.
Something like:
public class Shapefile{ public Shapefile(String filename) { //..creates necessary stuff } public void loadFromCSV(String filename, String delimiter) { //use addGeometry for each row in csv ... } public void addGeometry(Geometry g, int esriType, Map attributes) { //esriType = 5 for polygons and so on.... //attributes = attributes for dbf file. Like name, postal_code ... } public void write() throws IOException { //Writes output to shapefile and dbf file ... } }I hope someone can explain it.
أكثر...
What I have finished:Creating correct JTS geometries from OSM relations, ways and nodes.
What I want to achieve:Create a csv file which contains the following data:the_geom, name, postal_code, country, osm_id
"the_geom" should be a JTS polygon geometry or a null geometry.(Complains ESRI Specification)
The csv file makes it possible to easy fill up data.
After those csv file is completely created I want to read that file and create a shapefile from it. Those attributes like name, postal_code and so on, should be written into a dbf file related to new shapefile.
Following this I want to import the new shape and dbf file into postgreSQL.
Next step to acomplish requirements written above:How can I create a new shape and dbf file from any collection containing JTS polygon geometries? There are many classes involved but none of them is explained clearly in geotools.org like creating file headers and so on.
Something like:
public class Shapefile{ public Shapefile(String filename) { //..creates necessary stuff } public void loadFromCSV(String filename, String delimiter) { //use addGeometry for each row in csv ... } public void addGeometry(Geometry g, int esriType, Map attributes) { //esriType = 5 for polygons and so on.... //attributes = attributes for dbf file. Like name, postal_code ... } public void write() throws IOException { //Writes output to shapefile and dbf file ... } }I hope someone can explain it.
أكثر...