Where the f*** can I park?
I made a map showing the different residential parking areas in my city.
It is the first map of this data that exists, and I am disappointed with the Spanish Government Open Data policies.
You can check out the map here. I also shared the code required to create this map as a jupyter notebook here.
An introduction, and a bit of ranting.
After living in NYC for quite some time, I recently moved to Murcia, Spain to be closer to my family. I expected that, as with every time you move (and I have moved quite a bit over the years), there would be some administrative tasks that I would have to do: deal with things like immigration, housing, taxes, and other adult things.
Being accustomed to NYC bureaucracy, and complaining about it, I had absolutely forgotten how much worse bureaucratic processes are here in Spain.
I found out, that for most processes, the information is not clearly accesible online, and you have to either call to an office multiple times in hopes of someone picking up the phone, or even worse, go phisically to an office just to ask what to do next time you go. Sigh.
Those newyorkers reading this, I can tell you you guys are lucky, since everything you need to do for any bureocratic application in NYC being clearly explained in official governtment websites.
Of all the errands I had to do in order to settle in Spain, who would imagine that the most cumbersome process would be to get my parking permit.
See, in my hometown, there are certain parking spots that are reserved for those people living in the surrounding areas. The reason for this being is that most building are old and have no underground parking. A parking license allows you to park in those reserved spots that are nearby your house.
These residence only parking areas are organized by zones, with a zone pass allowing you to park on that zone.
In order to get my parking license I had to go to 3 different government buildings on 4 different occasions. This was just ridiculous. But the most ridiculous thing was about to happen.
Once I got my residence card, I wanted to know where I could actually park, since the residential parking areas have no sign indicating which zone do they belong to.
This is how the conversation went.
Do you have a map showing streets where I can park?
No, I don't think there is a map.
Then how can I know if a parking area is part of my zone or not?
What we do have is a list of streets that we can give you.
What? Does that mean I have to keep this printed list in my car?
Well, what you can do is just check the permits on the other cars around you since the permit zone is written there.
So, in case you are as stunned as I was, here is what is going on in my hometown.
- There are some parking spots that are exclusively for people living in that area.
- Parking there without the proper residence permit can get you fined (an undisclosed amount for what I know since there is no information online on the matter).
- To be able to park in those spots you have to get a residence parking permit.
- The process to get this permit is lengthy and cumbersome.
- The permit allows you to park in those residential spots in that particular zone.
- There is no map displaying which zone each street belongs to, only a list of street names.
Here is the list they gave me in all its glory:
Basically, a list of street names, some with street numbers. No zipcode, no geographic denomination (e.g., square, street, etc) and no consistent formatting.
So until now, in 2016, the process to park in a residential spot goes as follows:
- Drive around until you find a parking spot.
- Check the nearby cars to see if the parking zone in their permits matches yours.
- Alternatively, find the street name and search for it in your paper list.
- If the zone does not match yours, leave the parking spot and go to step 1.
There are three things I found extremely ridiculous at this point.
a) Given that these zones are marking streets surrounding where you live, this is probably the best example in the world of data that should be displayed on a map.
b) Given that they assigned my parking zone based on where I live, there is already a government database matching locations with parking zones.
c) Given a) and b), I find it embarrasing that my town has not yet created a map showing the parking zones
The solution was clear to me, I had to make the first residential parking zones map in my town.
Give me the data
In order to do the map, I had to get the street list for all the remaining zones.
To do so, I went once more time to the local town public office, got my turn, and waited until they called me.
I knew that telling the civil servant in charge the actual reason why I wanted the street lists for all the zones would not work, so I told her that my mom asked me to get the list for a friend of hers, and that she did not tell me the zone.
Then she tried and asked me where that woman lived, and I said I did not know.
After that, the public worker told me that they didn't usually share the zone streets lists with people who weren't residents in that zone.
I have to recognize that at this point I was feeling disappointed with my country, seeing how information that affected me on a daily basis was so hard to obtain. These lists should be online available for anyone to see!, I thought.
Finally, the public worker called her manager and after some minutes on the phone, she reluctantly printed all the street lists for me. Victory!
Now that I had the list of streets for each zone, I had to get the geographic information for those streets so I could put them in a map.
To get Murcia's geo data, I went and submitted a pull request in the Mapzen Metro extracts projetc. After aproving your PR, OpenStreetMaps geojson data for the specific location you submit is available for downloading on their site.
Processing the data
Part of the OSM geojson data contains geometries for each street in the city. However, given that the lists provided by the public worker were written by hand by who knows who, there were some discrepancies between the Mapzen street names and the list names.
Among other data issues, these were the most common ones.
Plain typos. These errors are common when data is manually input. For example, Corregidor alonso fajardo instead of Regidor alonso fajardo
Wrong geographic entity definition. Specifying Square x instead of street x. For example, PLAZA JOSE MARIA PARRAGA, 2 instead of CALLE JOSE MARIA PARRAGA, 2
To match the streets on the street lists with the OSM data, it took a while of manual data munging. I put all of the geojson street names and the street lists on a google spreadsheet and match them. Most were a perfect match while others I had to do a bit of manual search.
Making the map
So finally I got a file with the streets on each list and the associated osm street id.
To make the map, I used Folium, which is an excellent library on top of leaflet that makes very beautiful maps.
I wanted to plot not only the streets, but also display a nice marker with the name on the street. To do so I used geopy to geocode the streets and plot them on the map.
I also used those points to calculate the borders of each parking zone, making it easier to differentiate between parking areas.
Once I plotted all the streets colored by which zone they fall into I realized quickly that something was wrong.
The issue is, on the street lists there was no zipcode information , and there are multiple streets with the same name in the region belonging to different zipcodes. Thus I associated the street names with the wrong osm streets.
To fix this I just took the most common zipcode on each zone cluster and used it to geocode again those streets geocoded wrongly.
Finally, I got the map running!
You can check out the map live here. I have found it very useful when looking for places to park.
If you want to play with the code, you can check the notebook here.
That's all, thanks for reading!
Update Feb 23
It seems that there was already a map with parking zones information. Not a public one (I have no idea how they got the information), not an easy to find one, but hey, its something. Honestly, had I known it existed I wouldn't have gone through the process of making the map myself. But hey, as with any pet project, I got to learn about new technologies.