To get started, I need an address base. In this case, such a database is updated annually on the website of the electronic legal documentation fund http://docs.cntd.ru/document/432885269. I will use the latest from 01/23/2019.
I create a request through "get":
Get to school
To get started, I need an address base. In this case, such a database is updated annually on the website of the electronic legal documentation fund http://docs.cntd.ru/document/432885269. I will use the latest from 01/23/2019.
I create a request through "get":
Checking the status:
For this example, I will select two parts of the table with id = ‘p0012’ and id = ‘p0013’ immediately renaming the column names:
I will combine in a common table:
Further, to form queries at the address, it is necessary to combine the columns "Street" and "Home" so that each house has its street. Create a list using .str.split (''):
I will compile the code for the table reorganization:
The result is an address table with full names !!
To get geolocation I will use geopy.geocoders:
Now we have a table completely ready for queries to 2Gis!
By making a request to the address:
'https://2gis.ru/perm/firm/70000001023551363%2C56.245837%2C57.984467/geo/2252435468852443%2C56.263304%2C57.983466/routeSearch/rsType/pedestrian/from/'+ df3['Longitude_from'] +'%2C'+ df3['Latitude_from'] +'%7CГероев%20Хасана%2C%2081%7C2252435468851481%7Cgeo/to/'+ df3['Longitude_to'] +'%2C'+ df3['Latitude_to'] +'%7CЛьв%20Шатрова%2C%2025%7C2252435468852574%7Cgeo?queryState=center%2F56.274419%2C57.987299%2Fzoom%2F15%2FrouteTab'
I will get the shortest distances from home to school.
Also, you can use the information to analyze the human workload of schools and redistribute students, possibly building a new school.