Outputting and consuming GeoJSON

GML output may be considered by many as not too user-friendly, as XML in general is supposed to be machine readable, but not necessarily human readable (although once one gets used to it - it is not that scary anymore). Luckily, servers such as GeoServer can output data in GeoJSON. This makes things way easier, not only from the perspective of the user looking at the output, but also when it comes to coding the layers that consume it.

This time we will plug in some earthquake data - we will need the data we imported in Chapter 1, Importing Spatial Data, but this time let's put it into the webgis.earthquakes table.

If you happen to have removed the data from the imported_data schema, you will have to reimport the dataset. Otherwise, you can simply copy the data over with select * into webgis.earthquakes from imported_data.earthquakes_subset_with_geom.

Next, make sure to expose the data as a mastering_postgis:earthquakes layer and we are ready to roll.

Even though we consume GeoJSON now, the service we request data from is still WFS.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset