public List<Coord> readCoords(String shapefile){
  List<Coord> list=new ArrayList<Coord>();
  ShapeFileReader sfr=new ShapeFileReader();
  Collection<SimpleFeature> features=sfr.readFileAndInitialize(shapefile);
  for (  SimpleFeature feature : features) {
    Geometry geo=(Geometry)feature.getDefaultGeometry();
    if (geo instanceof Point) {
      Point ps=(Point)geo;
      list.add(new Coord(ps.getX(),ps.getY()));
    }
 else {
      throw new RuntimeException("The shapefile does not contain Point(s)!");
    }
  }
  return list;
}

public List < Coord > readCoords ( String shapefile ) { List < Coord > list = new ArrayList < Coord > ( ) ; ShapeFileReader sfr = new ShapeFileReader ( ) ; Collection < SimpleFeature > features = sfr . readFileAndInitialize ( shapefile ) ; for ( SimpleFeature feature : features ) { Geometry geo = ( Geometry ) feature . getDefaultGeometry ( ) ; if ( geo instanceof Point ) { Point ps = ( Point ) geo ; list . add ( new Coord ( ps . getX ( ) , ps . getY ( ) ) ) ; } else { throw new RuntimeException ( "The shapefile does not contain Point(s)!" ) ; } } return list ; }
reads a point feature shapefile .
