hi all,
I tried out the Feature Tutorial [gt10 ]using eclipse and checked the
Csv2Shape...
[ http://docs.geotools.org/latest/userguide/tutorial/feature/csv2shp.html ]
nealry everything went like it has to do...but the written shapefile
will not be
showable using the quickviewer from Tutorial Quickstart, neither arcGIS
or Q-Gis....the resulting coordinates in that shape are lamnda=1,
phi=1....for all the points from the given csv-list.
it seems that the point is written correct in the <SimpleFeature>List
try {
/* First line of the data file is the header */
String line = reader.readLine();
System.out.println("Header: " + line);
for (line = reader.readLine(); line != null; line =
reader.readLine()) {
if (line.trim().length() > 0) { // skip blank lines
String tokens[] = line.split("\\,");
double latitude = Double.parseDouble(tokens[0]);
double longitude = Double.parseDouble(tokens[1]);
String name = tokens[2].trim();
int number = Integer.parseInt(tokens[3].trim());
// OK =>Correct Points!! System.out.println(latitude+" LONG:"+longitude+"
Name="+name);
/* Longitude (= x coord) first ! */
Point point = geometryFactory.createPoint(new
Coordinate(longitude, latitude));
// OK =>Correct Points !! System.out.println("Point="+point);
featureBuilder.add(point);
featureBuilder.add(name);
featureBuilder.add(number);
SimpleFeature feature =
featureBuilder.buildFeature(null);
features.add(feature);
Point g = (Point) features.get(0).getAttribute( 0 );
// OK =>Correct Points !! System.out.println("pf="+g);
//OK=>Correct Points !! System.out.println("pb
"+feature.getBounds().getMinX()+" Y="+feature.getBounds().getMinY());
}
}
after that the features were written to the SimpleFeatureCollection,
whcih wrote the stuff into the featureStore and afaik to the directet
shapefile...but with coordinates of 1/1...
did anybody solved that??? I'd searched for several hours without
success for that case....
any ideas - further hints out how to fix that?
best regards
rolf
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users