Example #1
0
def get_list_service_for_point(point: geodetic_point, boundary_table, engine):
    """

    :param point: location object
    :type point: `location`
    :param boundary_table: The name of the service boundary table.
    :type boundary_table: `str`
    :param engine: SQLAlchemy database engine.
    :type engine: :py:class:`sqlalchemy.engine.Engine`
    :return: 
    """
    wkb_pt = point.to_wkbelement(project_to=4326)
    # Run the query.
    return (_get_list_service_for_geom(engine, i, wkb_pt) for i in boundary_table)
Example #2
0
def get_containing_boundary_for_point(point: geodetic_point, boundary_table, engine, add_data_required=False, buffer_distance=None):
    """
    Executes a contains query for a point.

    :param point: location object
    :type point: `location`
    :param boundary_table: The name of the service boundary table.
    :type boundary_table: `str`
    :param engine: SQLAlchemy database engine.
    :type engine: :py:class:`sqlalchemy.engine.Engine`
    :return: A list of dictionaries containing the contents of returned rows.
    """

    wkb_pt = point.to_wkbelement(project_to=4326)
    # Run the query.
    if add_data_required:
        return _get_nearest_point(point.longitude, point.latitude, engine, boundary_table, wkb_pt,buffer_distance=buffer_distance)
    return _get_containing_boundary_for_geom(engine, boundary_table, wkb_pt)