6

As the title states I'm trying to open a REST/JSON service in QGIS, but without luck so far. Now I'm wondering if this kind of service is even possible to open in QGIS with current, existing tools. I'm using the new QGIS 3.0, but I tried with the latest 2.x.x version too.

Here's an example of the URL: https://tie.digitraffic.fi/api/v1/data/weather-data (open in browser in order to view JSON tree)

As far as I know QGIS is capable of opening REST services with add layer --> add ArcGIS featureserver layer, but that hasn't worked in this case. Then on the other hand I know ArcGIS has a specific JSON-toolset which might imply that this wouldn't be an issue with ArcGIS.

EDIT: As you can see in the tree, there's no geometry or coordinate information. Presumably that will be joined later based on id.

Is there anyone with more knowledge about the matter?

4

2 Answers 2

6

The JSON returned from that URL does not look like it conforms to any standard format. Any system that could map from that URL would have to know it was an array, with an array of "weatherStations" and each of those elements had an array of "sensorValues" and in each of those is eventually a measurement and a description of what that measurement meant.

Even without the additional problem of having to lookup the station location somehow, a free-form JSON data stream can't be understood by a simple data source handler in QGIS (or ArcGIS). This is why GeoJSON exists - it is a standard form for spatial data with attributes that all GIS can understand and interpret, and is intended for web services.

The easiest thing to do here would probably be to write some code that could download the JSON and convert it to a standard format that GIS can read - GeoJSON or Shapefile or SpatiaLite or whatever. A harder thing to do would be to integrate this into QGIS as a plugin, or even as a data provider that would let you add this as a layer - but those solutions would require a bit more programming and understanding of the QGIS internals.

Further investigation reveals the REST URL for the locations returns a GeoJSON data which can be loaded into QGIS. The task is then to convert the data JSON into a table that can be loaded into QGIS as a table and then joined to the spatial data by the ID. This should be fairly easy with a small standalone python script or some other JSON processing tool. If you are interested in a solution please let me know.

2
  • Thank you for the thorough answer. Can you tell me what way you were successful in loading the data into QGIS? Commented Mar 13, 2018 at 6:16
  • The spatial data is available as geoJSON from the URL I gave in comments (take the "2048" off to get all the locations).
    – Spacedman
    Commented Mar 13, 2018 at 8:09
0

Check out esridump. This will extract the data from the query service

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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