java.lang.Object
com.example.cab302project.SuburbSearchService
Service for searching suburbs and retrieving their boundary polygons.
Uses the Nominatim API to search for a suburb by name and retrieve its
bounding box and GeoJSON polygon boundary. The boundary is used to
highlight the suburb on the map and filter crime records to only those
within the area.
All calls are made from a background thread via the caller; this class
does not manage threading itself.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classResult object returned from a suburb search. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisInBoundingBox(double lat, double lon, double[] boundingBox) Checks whether a lat/lon coordinate falls within the given bounding box.Searches for a suburb by name and returns its boundary data.
-
Constructor Details
-
SuburbSearchService
public SuburbSearchService()
-
-
Method Details
-
search
Searches for a suburb by name and returns its boundary data. Calls Nominatim with polygon_geojson=1 so the full boundary polygon is returned in the same request, avoiding a separate Overpass API call. Results are biased toward Queensland, Australia.- Parameters:
query- the suburb or area name entered by the user- Returns:
- a SuburbResult with location and boundary data, or null if not found
-
isInBoundingBox
public static boolean isInBoundingBox(double lat, double lon, double[] boundingBox) Checks whether a lat/lon coordinate falls within the given bounding box. Used to filter crime records to only those inside the searched suburb.- Parameters:
lat- the latitude to testlon- the longitude to testboundingBox- [minLat, maxLat, minLon, maxLon]- Returns:
- true if the coordinate is within the bounding box
-