libpysal.weights.min_threshold_dist_from_shapefile¶
- libpysal.weights.min_threshold_dist_from_shapefile(shapefile, radius=None, p=2)[source]¶
Get the maximum nearest neighbor distance between observations in the shapefile.
- Parameters:
- Returns:
- d
float
Maximum nearest neighbor distance between the n observations.
- d
Notes
Supports polygon or point shapefiles. For polygon shapefiles, distance is based on polygon centroids. Distances are defined using coordinates in shapefile which are assumed to be projected and not geographical coordinates.
Examples
>>> import libpysal >>> md = libpysal.weights.min_threshold_dist_from_shapefile( ... libpysal.examples.get_path("columbus.shp") ... ) >>> md 0.6188641580768541 >>> libpysal.weights.min_threshold_dist_from_shapefile( ... libpysal.examples.get_path("stl_hom.shp"), ... libpysal.cg.sphere.RADIUS_EARTH_MILES ... ) 31.846942936393717