public static SpatialIndex locateAndSetShapeData(String shapeFileName){
  SpatialIndex spi=null;
  if (shapeFileName == null) {
    return null;
  }
  int appendixIndex=shapeFileName.indexOf(".shp");
  if (logger.isLoggable(Level.FINE)) {
    logger.fine("created with just the shape file " + shapeFileName);
  }
  if (appendixIndex != -1) {
    if (BinaryFile.exists(shapeFileName)) {
      String spatialIndexFileName=ssx(shapeFileName);
      if (logger.isLoggable(Level.FINE)) {
        logger.fine("Trying to locate spatial index file " + spatialIndexFileName);
      }
      try {
        spi=new SpatialIndex(shapeFileName);
      }
 catch (      java.io.IOException ioe) {
        logger.warning(ioe.getMessage());
        ioe.printStackTrace();
        spi=null;
      }
    }
 else {
      logger.warning("Couldn't locate shape file " + shapeFileName);
    }
  }
 else {
    if (logger.isLoggable(Level.FINE)) {
      logger.fine("file " + shapeFileName + " doesn't look like a shape file");
    }
  }
  return spi;
}

public static SpatialIndex locateAndSetShapeData ( String shapeFileName ) { SpatialIndex spi = null ; if ( shapeFileName == null ) { return null ; } int appendixIndex = shapeFileName . indexOf ( ".shp" ) ; if ( logger . isLoggable ( Level . FINE ) ) { logger . fine ( "created with just the shape file " + shapeFileName ) ; } if ( appendixIndex != - 1 ) { if ( BinaryFile . exists ( shapeFileName ) ) { String spatialIndexFileName = ssx ( shapeFileName ) ; if ( logger . isLoggable ( Level . FINE ) ) { logger . fine ( "Trying to locate spatial index file " + spatialIndexFileName ) ; } try { spi = new SpatialIndex ( shapeFileName ) ; } catch ( java . io . IOException ioe ) { logger . warning ( ioe . getMessage ( ) ) ; ioe . printStackTrace ( ) ; spi = null ; } } else { logger . warning ( "Couldn't locate shape file " + shapeFileName ) ; } } else { if ( logger . isLoggable ( Level . FINE ) ) { logger . fine ( "file " + shapeFileName + " doesn't look like a shape file" ) ; } } return spi ; }
create a spatialindex object with just a shape file name . if the shape file is local , this method will attempt to build the spatial index file and place it next to the shape file .
