Package org.goplanit.osm.util
Class OsmBoundingAreaUtils
- java.lang.Object
-
- org.goplanit.osm.util.OsmBoundingAreaUtils
-
public class OsmBoundingAreaUtils extends Object
Utilities regarding the use of a bounding box when parsing OSM data- Author:
- markr
-
-
Constructor Summary
Constructors Constructor Description OsmBoundingAreaUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.locationtech.jts.geom.Envelope
createBoundingBox(de.topobyte.osm4j.core.model.iface.OsmNode osmNode, double offsetInMeters, PlanitJtsCrsUtils geoUtils)
create a (Rectangular) bounding box around the osm node geometry based on the provided offsetstatic org.locationtech.jts.geom.Envelope
createBoundingBoxForOsmWay(de.topobyte.osm4j.core.model.iface.OsmEntity osmEntity, double offsetInMeters, Map<Long,de.topobyte.osm4j.core.model.iface.OsmNode> osmNodes, PlanitJtsCrsUtils geoUtils)
create a bounding box based on the provided offset and OSM entity geometry.static boolean
isCoveredByZoningBoundingPolygon(de.topobyte.osm4j.core.model.iface.OsmNode osmNode, org.locationtech.jts.geom.Polygon boundingPolygon)
Verify if node resides on or within the zoning bounding polygon.static boolean
isCoveredByZoningBoundingPolygon(de.topobyte.osm4j.core.model.iface.OsmWay osmWay, Map<Long,de.topobyte.osm4j.core.model.iface.OsmNode> osmNodes, org.locationtech.jts.geom.Polygon boundingPolygon)
Verify if OSM way has at least one node that resides within the zoning bounding polygon.static boolean
isNearNetworkBoundingBox(org.locationtech.jts.geom.Geometry geometry, org.locationtech.jts.geom.Envelope networkBoundingBox, PlanitJtsCrsUtils geoUtils)
check if geometry is near network bounding box using buffer based on PlanitOsmNetworkReaderData.BOUNDINGBOX_NEARNESS_DISTANCE_METERSstatic void
logWarningIfNotNearBoundingBox(String message, org.locationtech.jts.geom.Geometry geometry, org.locationtech.jts.geom.Envelope boundingBox, PlanitJtsCrsUtils geoUtils)
log the given warning message but only when it is not too close to the bounding box, because then it is too likely that it is discarded due to missing infrastructure or other missing assets that could not be parsed fully as they pass through the bounding box barrier.
-
-
-
Method Detail
-
logWarningIfNotNearBoundingBox
public static void logWarningIfNotNearBoundingBox(String message, org.locationtech.jts.geom.Geometry geometry, org.locationtech.jts.geom.Envelope boundingBox, PlanitJtsCrsUtils geoUtils)
log the given warning message but only when it is not too close to the bounding box, because then it is too likely that it is discarded due to missing infrastructure or other missing assets that could not be parsed fully as they pass through the bounding box barrier. Therefore the resulting warning message is likely more confusing than helpful in those situation and is therefore ignored- Parameters:
message
- to log if not too close to bounding boxgeometry
- to determine distance to bounding box toboundingBox
- to usegeoUtils
- to use
-
isNearNetworkBoundingBox
public static boolean isNearNetworkBoundingBox(org.locationtech.jts.geom.Geometry geometry, org.locationtech.jts.geom.Envelope networkBoundingBox, PlanitJtsCrsUtils geoUtils)
check if geometry is near network bounding box using buffer based on PlanitOsmNetworkReaderData.BOUNDINGBOX_NEARNESS_DISTANCE_METERS- Parameters:
geometry
- to checknetworkBoundingBox
- to considergeoUtils
- to use- Returns:
- true when near, false otherwise
-
isCoveredByZoningBoundingPolygon
public static boolean isCoveredByZoningBoundingPolygon(de.topobyte.osm4j.core.model.iface.OsmNode osmNode, org.locationtech.jts.geom.Polygon boundingPolygon)
Verify if node resides on or within the zoning bounding polygon. If no bounding area is defined or if no node is provided (null), false is returned by definition- Parameters:
osmNode
- to verifyboundingPolygon
- defining the area- Returns:
- true when no bounding area, or covered by bounding area, false otherwise
-
isCoveredByZoningBoundingPolygon
public static boolean isCoveredByZoningBoundingPolygon(de.topobyte.osm4j.core.model.iface.OsmWay osmWay, Map<Long,de.topobyte.osm4j.core.model.iface.OsmNode> osmNodes, org.locationtech.jts.geom.Polygon boundingPolygon)
Verify if OSM way has at least one node that resides within the zoning bounding polygon. If no bounding area is defined or OSM way is null false is returned by definition- Parameters:
osmWay
- to verifyosmNodes
- to collect nodes of way fromboundingPolygon
- defining the area- Returns:
- true when covered by bounding area, false otherwise
-
createBoundingBoxForOsmWay
public static org.locationtech.jts.geom.Envelope createBoundingBoxForOsmWay(de.topobyte.osm4j.core.model.iface.OsmEntity osmEntity, double offsetInMeters, Map<Long,de.topobyte.osm4j.core.model.iface.OsmNode> osmNodes, PlanitJtsCrsUtils geoUtils)
create a bounding box based on the provided offset and OSM entity geometry. The bounding box adds the offset to the extremes of the geometry- Parameters:
osmEntity
- to create bounding box foroffsetInMeters
- buffer in metersosmNodes
- used in case osm entity is not a node and we require to obtain geometry information from underlying referenced nodesgeoUtils
- used to extract distances based on underlying crs- Returns:
- bounding box
-
createBoundingBox
public static org.locationtech.jts.geom.Envelope createBoundingBox(de.topobyte.osm4j.core.model.iface.OsmNode osmNode, double offsetInMeters, PlanitJtsCrsUtils geoUtils)
create a (Rectangular) bounding box around the osm node geometry based on the provided offset- Parameters:
osmNode
- to create bounding box aroundoffsetInMeters
- of the bounding box with node location in centregeoUtils
- to properly create bounding box based on crs- Returns:
- bounding box
-
-