Mapping in Python
<p>I have at my dispositions a JSON list with all the bike stations called Velib in Paris with their latitude, longitude, number of bikes and capacity. </p>

<p>I am trying to calculate proportion <code>averages(number_of_bikes/bike_capacity)</code> of the number of bikes for the bike stations in different districts of Paris. I would like to create a mapping/function of a city that differentiates different districts(= so that when i put coordinates it sends me back the number or the district )  so that when i try to calculate an average per part of the city i can insert coordinates of the bike stations and it goes directly into the average of the number of bikes of the district it is in. </p>

<p>I can do it when the districts are parallel one to each other delimited by horizontal/ vertical strait lines. </p>

<pre><code>for k in range(len(bike_station_list):
   if lat(bike_station_k)&lt;lat_district_1 and   lng(bike_station_k &lt;lng_disctrict_1

... and so on
</code></pre>

<p>However in reality Paris districts are far more complex.</p>

<p>How can I create a mapping of the city that can tell me in which district I am.</p>

<p>My first idea was to create a huge matrix with all longitudinal and latitudinal coordinates with the number of the district it is in but it looks a bit exaggerated. </p>

<p>Thanks for helping !</p>

<p>You can do get the district information by coordinate using Google's geocoding API</p>

<p><a href="https://maps.googleapis.com/maps/api/geocode/json?latlng=48.874809,2.396988" rel="nofollow">https://maps.googleapis.com/maps/api/geocode/json?latlng=48.874809,2.396988</a></p>

<p>In the response:</p>

<pre><code>{
    long_name: "20th arrondissement",
    short_name: "20th arrondissement",
    types: [
        "political",
        "sublocality",
        "sublocality_level_1"
    ]
}
</code></pre>

<p>See <a href="https://developers.google.com/maps/documentation/geocoding/intro#ReverseGeocoding" rel="nofollow">here</a>.
You'll be limited to 2500 free requests per day however (more if you pay) and you'll need to register an API key.</p>

python mapping geocoding reverse-geocoding