Photovoltaic Geographical Information System (PVGIS) API
2017-08-02
Through work I was tasked to utilize values from the PVGIS app over at the Europe JRC website. It gives you estimated power generation levels for which can be used for solar panel calculations.
I search for a while to see if I could find some API, webservice, or something which let me easily, programatically, fetch the values I needed. But no such thing was to be found.
The problem is that the PVGIS app only lets you view the results in a popup window, a downloadable file which doesn’t contain all the values, and same with a PDF which also doesn’t contain all the values. So to get all values you have to use the popup.
After some poking around I figured you can do a postback directly to the app and get the HTML results back, which meant I just had to parse the HTML to retrieve the correct values. This, of course, isn’t an awesome solution, but it worked. After the project finished I figured this should really be a service, so I made it one.
Introducing pvgisjson.com
The website gives a pretty good explanation of the functionality, but I’ll go into it shortly here.
You perform a POST
request to https://api.pvgisjson.com/
with a JSON payload of at least a lat
and lng
, such as: {"lat":63.3622086,"lng":10.3907399}
and you’ll get a response with solar energy values for monthly average, yearly average, and yearly total.
The source code is freely available over at https://github.com/nagilum/pvgis and is released under the MIT License. Feel free to contact me through GitHub regarding the API.