JSON and the Argonauts
We look at extracting data from the Christchurch City Councils SmartView maps.
As local government uses maps to make their data more and more available, we’ll look in this post at extracting some useful data from the Christchurch City Councils SmartView maps. Let start with a quick look at what’s available:
You can type in an address int the Search window or click on one of the subsections – let’s go to Find section and see what’s there:
Clicking on any one of these takes you eventually to a map – Fruit trees look interesting, yes?
This shows us locations and additional information if we click on a tree point. While this is great stuff, I might like to use this layer in my analysis, but in its current form, it is shackled to the browser. How could I extract it?
I’ll admit at the start that I had no idea how to do this, let alone that SmartView was a thing until some of my ERST606 students brought it to my attention (hat tip to Estela and Grace, as well as the Argonauts). There’s always something new to learn with GIS. Anyway, here’s how; gird your loins – it gets a bit involved.
First navigate up to the top level page where we clicked on Find. Right-click somewhere on the blue area and choose “Inspect” – you’ll get a funny looking window at the right:
Select Network tab from the top menu and make sure XHR is selected:
On the SmartView page, click Find > Fruit Trees. In one of the windows, an item called “map_feature.php…” appears (NB – I had to use (gulp) Edge to do this – please don’t tell anyone I used Edge by choice):
Right-click on this and choose ‘Copy link address’
Paste this link in a new tab and bunch of text appears:
Talk about gobbeldygook – what a mess. But there’s gold in them thar characters – on closer inspection, useful bits appear:
Select all this text and copy it into a text file using something like Notepad or WordPad. Save the file, giving it a .json extention, e.g. “fruittrees.json”.
In Pro now, use the JSON To Features tool – the Input JSON is the fruittrees.json file and enter a name for the Output feature class in a geodatabase (or you could save it as a shapefile):
Click ‘Run’ and voila they should appear as points!
Nice! This worked for most of the choices in Find, but not all; Street Art, for instance, didn’t, but with a bit of perseverance I’m sure you can get them to work too.
This is a bit involved to get at some data but sometimes one must be prepared to do what’s necessary to get points on the map.