This commit is contained in:
Eljakim Herrewijnen 2023-12-28 16:43:53 +01:00
parent 555769e89a
commit 483a62010c
5 changed files with 247241 additions and 146096 deletions

File diff suppressed because one or more lines are too long

View File

@ -43,6 +43,7 @@ fi
# Check if the container image exists
if [[ ! "$(docker images -q ${IMAGE_NAME})" ]]; then
echo "Building the Docker container..."
cp ${OUT_JSON_PATH} src/locations.json
docker build -t ${IMAGE_NAME} --build-arg http_proxy=$http_proxy --build-arg https_proxy=$https_proxy .
check_ret "Docker build failed!"
fi
@ -66,4 +67,4 @@ fi
# Run container
docker run --name ${CONTAINER_NAME} -p ${PORT_MAPPING} -v ${OUT_JSON_PATH}:/usr/src/app/src/locations.json ${IMAGE_NAME}
docker run --name ${CONTAINER_NAME} -p ${PORT_MAPPING} ${IMAGE_NAME}

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -2,7 +2,7 @@ import geopy
# from funda_scraper import FundaScraper
from funda_scraper.scrape import FundaScraper
import datetime, os, pickle, json, tqdm, numpy
import osrm
import osrm, random
OSRM_HOST = 'https://osrm.herreweb.nl'
NOMINATIM_HOST = 'geocode.herreweb.nl'
@ -47,18 +47,26 @@ def generate_json(houses):
# address_l = f"{houses.zip.get(i)}".split(" ")
address = f"{houses.address.get(i)} {houses.city.get(i)}"
if "lindenlaan" in address.lower():
pass
res = nomi_c.geocode(address)
# res = gmaps.geocode(f"{address}")
if res == None:
print(f"{i}:Failed to get any loction for: {address}")
continue
address = f"{houses.city.get(i)}"
res = nomi_c.geocode(address)
if res == None:
print(f"{i}:Failed to get any loction for: {address}")
continue
destination_location = res.point
destination_location = [destination_location.longitude, destination_location.latitude]
if destination_location in saved_locations:
print(f"double for: {address}")
destination_location[0] = destination_location[0] + random.randint(1, 10) / 10000
destination_location[1] = destination_location[1] + random.randint(1, 10) / 10000
saved_locations.append(destination_location)
out_dict['name'] = f"{address}_{count}" # Fix for duplicate names in dictionary.