13

I am a beginner with QGIS. I am trying to learn it through lynda.com. I have tried downloading the nanaimo crime map in GeoJSON format, but I get a message saying that the data source is invalid.

I am bemused at to what I do as I am following the instructions to the letter.

pick of QGIS

14

So the JSON you are using is just simple JSON not GeoJSON. The main difference is that the GeoJSON contains a geometry object you can read more about here in the GeoJSON spec.

You can however convert your JSON to a CSV file and load it into QGIS that way.

  1. Go to a site like this one and put in the URL to your JSON. I plugged in "http://www.nanaimo.ca/crimereporting/api/incidents" into the "Option 2 - Enter URL".
  2. Convert the JSON to a CSV file on that site and download it to your machine.
  3. Then in QGIS add a delimited text layer the button is circled below (im using QGIS version 2.14.3). enter image description here
  4. Load the CSV file you created and downloaded from that website, make sure in the dialog that you have set the file format as "CSV", the x-field to "Long" and the y-field to "Lat". Use the image below for reference. enter image description here
  5. Once you load the layer it should pop up in your map, you may get a warning saying that no CRS was defined and it is going to assume EPSG:4326. Final output should look like below. enter image description here
3

Reading the documentation here http://www.nanaimo.ca/crimereporting/help it seems you can construct a query url as the following and this will return the GeoJSON you are looking for

http://www.nanaimo.ca/crimereporting/api/incidents.geojson

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.