@@ -48,6 +48,7 @@ public void testBasicIndexing() throws Exception {
48
48
System .out .printf ("Index built in: %.2f seconds\n " , (new Date ().getTime () - start ) / (float ) 1000 );
49
49
50
50
GeometryFactory geometryFactory = new GeometryFactory ();
51
+ new File ("target/test/output/flickr-shapes" ).mkdirs ();
51
52
File output = new File ("target/test/output/flickr-shapes/neighbourhoods.txt" );
52
53
Formatter formatter = new Formatter (output );
53
54
@@ -81,7 +82,7 @@ public void testBasicIndexing() throws Exception {
81
82
@ Test
82
83
public void testPrintShapefile () throws Exception {
83
84
84
- File shapefile = new File ("data/build/flickr-shapes/continents .shp" );
85
+ File shapefile = new File ("data/build/flickr-shapes/counties .shp" );
85
86
ShapefileDataStore store = new ShapefileDataStore (shapefile .toURI ().toURL ());
86
87
87
88
String name = store .getTypeNames ()[0 ];
@@ -103,7 +104,8 @@ public void testPrintShapefile() throws Exception {
103
104
// now print out the feature contents (every non geometric attribute)
104
105
SimpleFeatureIterator features = source .getFeatures ().features ();
105
106
106
- while (features .hasNext ()) {
107
+ int i = 0 ;
108
+ while (features .hasNext () && i < 10 ) {
107
109
SimpleFeature feature = features .next ();
108
110
109
111
System .out .print (feature .getID () + "\t " );
@@ -116,16 +118,21 @@ public void testPrintShapefile() throws Exception {
116
118
}
117
119
118
120
System .out .println ();
121
+ i ++;
119
122
}
120
123
121
124
// and finally print out every geometry in wkt format
122
125
features = source .getFeatures ().features ();
123
- while (features .hasNext ()) {
126
+ i = 0 ;
127
+ while (features .hasNext () && i < 10 ) {
124
128
125
129
SimpleFeature feature = features .next ();
126
130
127
131
System .out .print (feature .getID () + "\t " );
128
132
System .out .println (feature .getDefaultGeometry ());
133
+ i ++;
129
134
}
135
+
136
+ store .dispose ();
130
137
}
131
138
}
0 commit comments