From a clean Ubuntu 12.04 Precise install I was able to get it to work with this:
echo 'deb http://ppa.launchpad.net/ubuntugis/ppa/ubuntu precise main' | sudo tee -a /etc/apt/sources.list
echo 'deb-src http://ppa.launchpad.net/ubuntugis/ppa/ubuntu precise main' | sudo tee -a /etc/apt/sources.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 314DF160
sudo apt-get update
sudo apt-get install -y postgresql-server-dev-9.1 postgis python-mapscript python-gdal
For more up-to-date gis packages use the unstable repository
echo 'deb http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu precise main' | sudo tee -a /etc/apt/sources.list
echo 'deb-src http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu precise main' | sudo tee -a /etc/apt/sources.list
This also works for Ubuntu 14.04 Trusty, just replace precise
with trusty
when adding the ubuntugis repos. Then you can also install postgres 9.3 instead of 9.1. So on Trusty use:
sudo apt-get install -y postgresql-server-dev-9.3 postgis python-mapscript python-gdal
The two references for installing this I used were
http://trac.osgeo.org/ubuntugis/wiki/UbuntuGISRepository
https://launchpad.net/~ubuntugis/+archive/ubuntu/ppa/
Also, if you want to use the postgis raster driver through mapscript, it is worth trying to install the latest GDAL version, as it has essential improvements on the raster driver (its much faster and more stable). So in that case I would recommend the unstable repo, in my work so far I did not run into problems due to the "unstable" name.
UPDATE:
Your problem seems to be with your data. Here is a snippet of your file:
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
585951.8,
181704.9
],
[
576293.9,
181299.8
],
If I'm not mistaken, those coordinates use the Ordnance Survey National Grid reference system. By default, geoJSON expects the coordinates to be WGS84(longitude, latitude). You can try converting the shape files again and making sure that the output reference system is WGS84. You can do this in QGIS by saving the file as geoJSON and selecting WGS84 as the output coordinate reference system.
The resulting geoJSON should work fine. So to answer your question, the format is correct. It's the coordinates that aren't right.
Here is the geoJSON spec for your reference next time.
I think the problem is that your code expects some attributes to be present in the geoJSON. The code has some specific assumptions about the contents of the geoJSON file. You can't just expect to replace the geoJSON in the exercise with your own file and expect it to work. It is highly unlikely that the attributes in your files would be the same, especially when they're from different sources.
You wouldn't expect code written for visualizing data from one CSV to automatically work with a different CSV file without some tweaks, would you? The data has changed and so must the code.
You can start by comparing the contents of the geoJSON files and checking the differences. You can do this by loading them in a text editor and comparing the contents. See what the code expects in the file and tweak it accordingly. You can also load them into QGIS and see what attributes are different.
The geoJSON format only specifies how you can encode geographic data structures. The contents of the file are up to you. In much the same way that CSVs only tell you how to encode tabular data. What the column names and other content are up to the data producer.
Best Answer
I've recently updated the Loader install instructions on the wiki to use
pip
an alternative Python package manager which supersedeseasy_install
.