1

I am trying to use the map data, found on this website

https://fixmyberlin.de/planungen

and import it to QGIS. Specifically I am looking for the bike paths shown there. I have contacted them and they sent me a link to the API version of their website:

https://api.fixmyberlin.de/api/projects?page_size=200

Since I am new to QGIS and that whole topic, I really don't know what to do further.

  • 1
    Welcome to GIS.SE. What research have you done so far? What have you tried? What processing do you intend? – Erik Nov 26 '19 at 10:03
  • Thanks. I'm intending to export different layers as dxf files from QGIS to then draw different maps in architectural software. – Hannes Nov 28 '19 at 14:25
3

You can run the following in the QGIS Python console to write a GeoJSON

from urllib.request import urlopen
import json

url = "https://api.fixmyberlin.de/api/projects?page_size=200"
html = urlopen(url)
data = json.load(html)

geojson = {
  "type": "FeatureCollection",
  "features": [{
      "type": "Feature",
      "properties": {
        "id": bike_path['id'],
        "url": bike_path['url'],
        "project_key": bike_path['project_key'],
        "title": bike_path['title'],
        "description": bike_path['description'],
        "short_description": bike_path['short_description'],
        "category": bike_path['category'],
        "street_name": bike_path['street_name'],
        "borough": bike_path['borough'],
        "side": bike_path['side'],
        "costs": bike_path['costs'],
        "draft_submitted": bike_path['draft_submitted'],
        "construction_started": bike_path['construction_started'],
        "construction_completed": bike_path['construction_completed'],
        "phase": bike_path['phase'],
        "responsible": bike_path['responsible'],
        "external_url": bike_path['external_url'],
        "cross_section": bike_path['cross_section'],
        "faq": bike_path['faq'],
        "length": bike_path['length'],
        "photos": bike_path['photos'],
        "likes": bike_path['likes'],
        "liked_by_user": bike_path['liked_by_user']
      },
      "geometry": bike_path["geometry"]
    } for bike_path in data['results']]
}

with open('/tmp/my_geojson.geojson', 'w', encoding='utf-8') as outfile:
    json.dump(geojson, outfile)

PS: I do not manage the pagination here

You can change the path /tmp/my_geojson.geojson according to your need. Then, open the file as a vector layer in QGIS and it works.

An overview below with OSM background

Berlin Bike paths overview

  • Thanks for the quick reply. I'm having issues running your python code though: [url=postimg.cc/Hc6zXpCB][img]https://i.postimg.cc/Hc6zXpCB/… Any clues what happened here? As you might realise, I'm also new to Python. Thank you! – Hannes Nov 28 '19 at 14:05
  • data is not defined is weird. The first lines of the sample are declaring it. – ThomasG77 Dec 6 '19 at 13:42
0

your data seems to be JSON-format. First you have to convert it to CSV and then load that CSV into QGIS.

This post describes in detail how to do it: https://gis.stackexchange.com/a/199408/7849

  • Also thanks for the quick reply. Converting and downloading the data seems to work fine. Importing it to QGIS is where I'm having trouble: the way its described in the link you posted, is not exactly possible with the QGIS version I have (3.4.11). I can't choose long and lat for the x and y-field (they're just not an option). I've tried choosing other names but when loading the cvs nothing shows up on the map... Any further advice? Thank you! – Hannes Nov 28 '19 at 14:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.