Datasets API

Endpoint: http://geocommons/datasets

Description: The datasets endpoint allows creation, modification, download and deletion of data in GeoIQ. Methods for modifying and deleting datasets require basic authentication. For reading of data it depends on the configuration of the GeoIQ instance for GeoCommons it is not required.

HTTP Methods Available: GET, POST, PUT, DELETE

URL Summary

TaskURLFormatsHTTP METHOD
Downloadhttp://geocommons.com/datasets/{id}.{format}kml,csv,zip,atom,json,spatialiteGET
Createhttp://geocommons.com/datasetsxml,json,atomPOST
Updatehttp://geocommons.com/datasets/{id}.{format}json,atomPUT
Update Feedhttp://geocommons.com/datasets/{id}/fetch.{format}json,xml,htmlPUT
Deletehttp://geocommons.com/datasets/{id}jsonDELETE

zip returns compressed folder with shapefile inside

Download Dataset

Authentication:

Not required for GeoCommons datasets, GeoIQ appliance datasets depends on the permissions of the data

Required Parameters: (none)

Optional Parameters:

ParameterDescriptionExample
include_attributesinclude data_attributes in the output: 0 or 1 (default: 0 (false))include_attributes=1
include_featuresinclude features in the outputinclude_features=1
include_geometryinclude feature geometriesinclude_geometry=1
hex_geometryuse Hex EWKB for geometrieshex_geometry=1

default is false for option parameters use 0 or 1 (0 is false)

Returns:

TypeDescriptionExample
filereturns a file of the type requestedhttp://geocommons.com/overlays/7294.kml

Curl Examples:

curl http://geocommons.com/overlays/7294.csv

curl http://geocommons.com/overlays/7294.json?include_attributes=1&hex_geometry=1

Create Dataset

You can currently upload data using two methods: via files from your hard drive, or via a URL from the Internet.

Create Dataset by Upload

Required Parameters Upload: (none)

ParameterDescriptionExample
dataset[shp]Name of your file(s) you are uploadingdataset[shp]=@elect_precincts.shp;

shp files require shp/shx/dbf files

Optional Parameters:

ParameterDescriptionExample
titlename of datasetUnemployment in the USA 2010
descriptiondescription of what the dataset isThis dataset shows the increase in unemployment in the USA between 2009-2010
authorwho created the datasetBureau of Labor Statistics
tagswords that describe the dataset and relate it to othersunemployment,labor,workforce
metadata_urllink to url containing metadatahttp://www.example.com
citation_urllink to the organization the data is fromhttp://www.exampleorg.com
contact_nameperson to contact about the dataJohn Doe
contact_addressaddress of the organization the data is from123 Main Street, Somewhere VA
contact_phonephone number of organization creating the data555-555-5555
process_notesadditional notes about how you created the datasetRan data through Google Refine to remove duplicates before uploading

Returns:

TypeDescriptionExample
Locationreturns the URI of the file requestedhttp://geocommons.com/overlays/7294.json

Curl Examples:

Download sample data for examples from here:

curl -i -X POST -u "username:password" -F "dataset[dbf]=@sample_file.dbf;" -F "dataset[shp]=@sample_file.shp" -F "dataset[shx]=@sample_file.shx;" http://geocommons.com/datasets.json
cat 98633.csv | curl -i -X POST -u "username:password" --data-binary @- -H "Content-Type: text/csv" http://geocommons.com/datasets.json

Create Dataset from URL

URL’s can only be registered once in GeoIQ. So if the URL has already been registered by a user, you will receive a redirect to this existing dataset. You can make a copy of that dataset if you want to modify the metadata.

Required Parameters Upload:

ParameterDescriptionExample
urlurl linking to the data feedhttp://api.flickr.com/services/feeds/geo/?tags=glitter&lang=en-us&format=kml_nl

Optional Parameters:

ParameterDescriptionExample
typetype of file being uploadedcsv,kml,atom
titlename of datasetUnemployment in the USA 2010
descriptiondescription of what the dataset isThis dataset shows the increase in unemployment in the USA between 2009-2010
authorwho created the datasetBureau of Labor Statistics
tagswords that describe the dataset and relate it to othersunemployment,labor,workforce
metadata_urllink to url containing metadatahttp://www.example.com
citation_urllink to the organization the data is fromhttp://www.exampleorg.com
contact_nameperson to contact about the dataJohn Doe
contact_addressaddress of the organization the data is from123 Main Street, Somewhere VA
contact_phonephone number of organization creating the data555-555-5555
process_notesadditional notes about how you created the datasetRan data through Google Refine to remove duplicates before uploading

default is false for option parameters use 0 or 1 (0 is false)

Returns:

TypeDescriptionExample
Locationreturns the URI of the file requestedhttp://geocommons.com/overlays/7294.json

Curl Examples:

curl -i -X POST -u "user:password" -d "url=http://api.flickr.com/services/feedsgeo/?tags=glitter&lang=en-us&format=kml_nl" http://geocommons.com/datasets.xml

Update Dataset

Allows you to update the contents of the metadata for a dataset and define attributes types

Metadata Dataset Update

Authentication:

Requires basic authentication for both GeoCommons and GeoIQ appliances.

Required Parameters: (none)

Optional Parameters:

ParameterDescriptionExample
typetype of file being uploadedcsv,kml,atom
titlename of datasetUnemployment in the USA 2010
descriptiondescription of what the dataset isThis dataset shows the increase in unemployment in the USA between 2009-2010
authorwho created the datasetBureau of Labor Statistics
tagswords that describe the dataset and relate it to othersunemployment,labor,workforce
metadata_urllink to url containing metadatahttp://www.example.com
citation_urllink to the organization the data is fromhttp://www.exampleorg.com
contact_nameperson to contact about the dataJohn Doe
contact_addressaddress of the organization the data is from123 Main Street, Somewhere VA
contact_phonephone number of organization creating the data555-555-5555
process_notesadditional notes about how you created the datasetRan data through Google Refine to remove duplicates before uploading

Returns:

TypeDescriptionExample
HTTP Responsereturns response indicating success or failure201 Created

Curl Examples:

curl -i -X PUT -u "username:password" http://geocommons.com/datasets/98735.json?title=changing%20title

Update Dataset Feed

It is possible to ping GeoIQ when new updates are available.

Authentication:

Requires basic authentication for both GeoCommons and GeoIQ appliances. The user must be either the owner or an authorized user with edit access.

Delete Dataset

You can currently Delete datasets by sending a DELETE HTTP request to the dataset endpoint. Deleted datasets are not recoverable.

Authentication:

Basic authentication is required for all delete requests.

Required Parameters: (none)

Optional Parameters: (none)

Returns:

TypeDescriptionExample
HTTP Responsereturns a HTTP response 202 AcceptedHTTP/1.1 202 Accepted

Curl Examples:

curl -i -X GET -u "user:password" http://geocommons.com/datasets/98737/fetch.json
 

Comments are closed.