Reduced need for routing by limiting to a radius of 7 miles
This commit is contained in:
parent
6a43a7f485
commit
c8c53b8696
4 changed files with 82 additions and 23 deletions
|
|
@ -1656,40 +1656,53 @@
|
|||
"cell_type": "markdown",
|
||||
"id": "87ead853-8a71-4de9-98d1-f4f2673a5592",
|
||||
"metadata": {},
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "98f8e950-2a3b-4856-aa62-3bc758e2fd42",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"x"
|
||||
"# Find out the proper radius we want to use"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "862e9e52-53fa-4bf9-8e31-7847481d45be",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "e284aefd-c280-4d82-935c-969b022b6bbc",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 50,
|
||||
"id": "04bb61d5-cba7-4739-9568-b00342c1b636",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Filtered listings from 32271 to 15804\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from data_access import Listing\n",
|
||||
"from geopy.distance import geodesic\n",
|
||||
"\n",
|
||||
"listings = Listing.get_all_listings()\n",
|
||||
"BROCK_STREET_LAT_LONG = 51.52570434674584, -0.13956495005056113\n",
|
||||
"\n",
|
||||
"# reduce listings to everything within 7 miles\n",
|
||||
"filtered_listings = []\n",
|
||||
"for listing in listings:\n",
|
||||
" miles = geodesic(BROCK_STREET_LAT_LONG, (listing.latitude, listing.longitude)).miles\n",
|
||||
" if miles <= 7:\n",
|
||||
" filtered_listings.append(listing)\n",
|
||||
"\n",
|
||||
"print(f\"Filtered listings from {len(listings)} to {len(filtered_listings)}\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "a73fba2d-afeb-4194-8421-eff8e84a14e9",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Typeahead"
|
||||
"# Typeahead / fetch all boroughs"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue