Time for action – adding a PostGIS table
PostGIS data store is one of those connected to many feature types. You will probably have new spatial data to add after creating the data store. Let's see how to do so:
In Chapter 5, Adding Your Data, you loaded the tiger counties in PostGIS. Now do the same with the admin boundaries shapefile from Natural Earth; call the table
ne_110m_admin
. Then use the PostGIS connection to add the table as a new feature type in the workspace NaturalEarth. Note that we are delivering very little information about the feature type to GeoServer; the table name is the only mandatory field:curl -u admin:password -XPOST -H 'Content-type: text/xml' -d '<featureType><name>ne_110m_admin</name></ featureType>' http://localhost:8080/geoserver/rest/workspaces/NaturalEarth/datastores/myPostGI S/featuretypes
The Python syntax is as follows:
>>> myUrl = 'http://localhost:8080/geoserver/rest/workspaces/NaturalEarth/datastores/myPostGIS/featuretypes...