Code Monkey home page Code Monkey logo

map-immo's Introduction

Map-Immo / python geocoder with BANO

Toutes les agences immobilières parisiennes de SeLoger.com geocodées via BANO

Données consultables ici : https://github.com/RouxRC/map-immo/blob/master/agences.tsv Et visualisées grâce à uMap ici : https://umap.openstreetmap.fr/fr/map/map-immo-paris_16133

Ce code est publié sous licence GPL v3 et les données sous licence ODBL. Elles ont été scrappées sur SeLoger.com et géolocalisées grâce à Bano d'OpenStreetMap France.

Le geocoder python employé est réutilisable en utilisant simplement le fichier geocode.py sans rien de plus. les données bano requises sont téléchargées à la volées et cachées dans un dossier .cache.

Par exemple :

# import the GeoCoder class
from geocode import GeoCoder

# instantiate it
G = GeoCoder()
# optionnally make it verbose on errors
G = GeoCoder(verbose=True)

# geocode an adress
G.geocode("16, rue Pierre Lescot 75001 Paris")
> (48.86219, 2.348475)
# optionnally get fixed postcode returned
# note it will try and fix possible wrong postcodes by looking through others
G.geocode("16 r Pierre Lescot 75003 Paris", return_postcode=True)
> (75001, 48.86219, 2.348475)

# provide preknown postcode
G.geocode("16 Pierre Lescot", 75001)
> (48.86219, 2.348475)
# provide preknown details with lower level find_street function
# note the handling of street types such as rue, blvd, etc. is handled blurily
G.find_street(75001, "reu Pierre Lescot", 16)
> (48.86219, 2.348475)
# although providing wrong street names won't be handled automatically
# the result on mismatch will be None instead of a tuple
# and in verbose mode an error will be displayed in stderr
G.geocode("16 r Piere Lescot 75003 Paris", return_postcode=True)
> [ERROR] Could not find a street "ruepierelescot" with postcode 75003 in bano data
> 

# adresses with no number will return coordinates for the middle of the street
G.geocode("Pierre Lescot", 75001)
> (48.863034, 2.34866)
# adress with number missing from Bano data will return coordinates from the 
# closest existing number, priorily on the same side of the street
G.geocode("160 Pierre Lescot 75001")
> (48.864977, 2.330415)

# Data from multiple departments can quickly increase ram used
# For lighter but slower runs, you can preload a department's data on initiate
G = GeoCoder(69, verbose=True)
> [INFO] Downloading bano data for dept 69
G.loaded
> ['69']
# and reset loaded departement data when changing departement
G.set_departement(13)
> [INFO] Downloading bano data for dept 13
G.loaded
> ['13']
# other departments data will be loaded when needed anyway
G.find_street(75001, "rue pierre  lescot")
> [INFO] Downloading bano data for dept 75
> (48.863034, 2.34866)
G.loaded
> ['13', '75']

map-immo's People

Contributors

rouxrc avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.