shakemap.utils.layers¶
- shakemap.utils.layers.validate_config(mydict, install_path, data_path, global_data_path)[source]¶
Recursively validate select.conf.
- shakemap.utils.layers.nearest_edge(elon, elat, poly)[source]¶
Return the distance from a point to the nearest edge of a polygon.
- shakemap.utils.layers.dist_to_layer(elon, elat, geom)[source]¶
Return the distance from a point to the polygon(s) in a layer; zero if the point is inside the polygon. If the nearest edge of the polygon is greater than 5000 km from the point, the point cannot be inside the polygon and the distance reported will be the distance to the nearest edge. So don’t make polygons too big.
- Parameters:
- Returns:
The distance (in km) from the reference point to the nearest polygon in the layer. The distance will be zero if the point lies inside the polygon.
- Return type:
- shakemap.utils.layers.get_layer_distances(elon, elat, layer_dir)[source]¶
Return the distances from a point to the nearest polygon in each layer file found in ‘layer_dir’. The distance will be zero if the point is inside a polygon. If the nearest edge of a polygon is greater than 5000 km from the point, the point cannot be inside the polygon and the distance reported will be the distance to the nearest edge. So don’t make polygons too big.
The layer files should be written in Well-Known Text (with .wkt extensions), and should contain either a single POLYGON or MULTIPOLYGON object. The layer name will be the file’s basename.
- Parameters:
- Returns:
A dictionary where the keys are the layer names, and the values are the distance (in km) from the reference point to the nearest polygon in the layer. The distance will be zero if the point lies inside the polygon.
- Return type: