GithubHelp home page GithubHelp logo

sulays / poi_cluster Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 1.43 MB

Extracting point of interest(POI) data from openstreetmap and then clustering them to find commercial markets/centers in a region.

Jupyter Notebook 100.00%

poi_cluster's Introduction

poi_cluster

Extracting point of interest(POI) data from openstreetmap and then clustering them to find commercial markets/centers in a region.

Tools and Libraries needed to run:

Python, matplotlib, numpy, pandas, geopandas, geopy, folium, shapely, smopy, fiona, sklearn, overpy

Methodology:

Data Extraction:

First, all the points of interests(POI) for commercial market/center are extracted. I assumed that a commercial market will only have shops as their POIs. I extracted all the nodes for the Delhi region with the key shop using the overpass api for python (overpy). Now there will be some commercial markets in the form of ways. I assumed that every commercial market has a way with the key shop=mall. Certain markets are left out due to the fact that all tags can't be searched through in a short time.

Clustering the nodes:

I chose DBSCAN (Density based spatial clustering of application with noise) because density clustering algorithms use the concept of reachability i.e. how many neighbors has a point within a radius and also we didn't know how many clusters will be formed from the dataset. So I've chosen the minimum number of samples in a cluster to be 5 and the reachability to be 100 metres. I got 60 clusters for the area that I chose for Delhi. I decided that if a cluster has more than 10 nodes then it must be significant.

Creating polygons:

Using shapely I created convex_hull polygons for each of the cluster. For some clusters, the polygon for the ways and the cluster interesected. So the cluster polygons were removed as they were a superset of the way polygons.

Deciding labels for clusters:

For the way, there is a name tag available for each way in the OSM database which was used. For clusters, reverse geocoding using geopy was done of the centermost point of the cluster to get the address. From the address the 1st street name was extracted and that name was given to the markets. Labeling is only done for the significant clusters and is left blank for the clusters with less than 10 nodes and the ways with no name tag.

Visualization and saving to shapefile:

The geometry and the name of the polygons (clusters) are stored in a shapefile 'polygon.shp' and geojson file 'polygon.shp' using geopandas. For interative visualization folium is used which uses OSM maps. Interaction feature of clicking on polygon and getting name of the market and cluster is added.

poi_cluster's People

Contributors

sulays avatar

Watchers

 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.