The API uses Django REST Framework. Responses are returned in the format of the original request, but if you'd like to see a json response from a browser, add the parameter format=json. Results are returned in pages (by default, each page is of size 10). If the request is valid, the json results will contain:
- count: a total count of the matching results
- next: URL to the next page of results
- previous: URL to the previous page of results
- results: an array of the requested JSON objects.
Here are the URLs and details about how to use them:
- .../api-ds/ Datasets
- .../api-mp/ MapPoints
- .../api-poly/ MapPolygons
- .../api-tag/ Tag
- .../api-newtag/ New Tags
###Datasets A Dataset is a group of MapPoints or MapPolygons. This contains the common information for the set of geometries.
A response includes the following elements:
idis the unique id of this Dataset. It can be used to match a dataset with MapPoints or MapPolygons or to filter those elements.nameis the name of the set of points.cachedis the date the Dataset was last updated (excluding updates to Dataset information or tags alone).field1_en,field2_en,field3_enare the English names of the data included in each MapPoint or MapPolygon asfield1,field2,field3. This is the name you should use for display.tagsis an array of JSON objects of all approved tags that appear on any MapPoint or MapPolygon in this Dataset. The array contains:tagis the text of the tag.idis the id of the tag.
###MapPoints A MapPoint is an individual location on the map.
A response includes the following elements:
datasetis a link to the information about the dataset to which this MapPoint belongsidis a unique system id for this MapPointnameis the name of the MapPointlatitude,longitudeare the latitude and longitude location of the MapPointstreet,city,state,zipcode,countyare elements of the street address of the MapPointfield1,field2,field3are the data matching the field description in the corresponding Datasettagsis an array of JSON objects of all approved tags for this MapPoint. The array contains:tagis the text of the tag.idis the id of the tag.
MapPoints can be filtered using the following parameters:
tag,tagsThese can be used interchangably. Accepts a tag, a tag id number, a list of tags or a list of tag ids. By default, MapPoints that match any of the tags will be included in the results (OR Boolean result).matchIf this parameter isall, only MapPoints matching all of the tags will be included (AND Boolean result)datasetUsing the Dataset id, return only those MapPoints matching a specific Dataset.max_lat,min_lat,max_lon,min_lonCreate a bounding box and return only MapPoints within that box.city,state,countyMatch any of these exactly using string matching on these fields.zipcode,zip,zip_codeMatch thezip_codeexactly. Only the first five characters will be matched.
###MapPolygons A MapPolygon is a polygon on a map. The response is in GeoJSON format. For more information, see the GeoJSON spec.
typeshould always beFeaturegeometryis an object with the geometric details in it.typeshould always beMultiPolygonwhen requesting a MapPolygoncoordinatesis an array of polygon coordinate arrays.
propertiesIn GeoJSON format, addition information is contained inside thepropertieselement.idis a unique system id for this MapPolygon.datasetThe id of the Dataset to which this MapPolygon belongs. Note: this is different that the same field for MapPoints.remote_idis the id of the MapPolygon used by the original source of the data. This can be used to match MapPolygons with outside data sources.nameis the English name of this MapPolygon.latitude,longitudeare the latitude and longitude location of the rough center of the MapPolygonfield1,field2are the data matching the field description in the corresponding DatasettagsAn array of JSON objects of all approved tags for this MapPoint. The array contains:tagThe text of the tag.idThe id of the tag.
MapPolygons can be filtered using similar parameters to MapPoints:
tag,tagsThese can be used interchangably. Accepts a tag, a tag id number, a list of tags or a list of tag ids. By default, MapPolygons that match any of the tags will be included in the results (OR Boolean result).matchIf this parameter isall, only MapPolygons matching all of the tags will be included (AND Boolean result)datasetUsing the Dataset id, return only those MapPolygons matching a specific Dataset.max_lat,min_lat,max_lon,min_lonCreate a bounding box and return only MapPolygons at least partially within that box.
###Tags GET and POST are allowed for this URL, but GET is only intended to be used for debugging purposes. This URL is for linking an existing tag with an existing approved MapPoint or MapPolygon. A POST request with a defined MapPoint and a defined MapPolygon will fail. A POST request with neither will also fail.
Currently, no authentication is required to POST.
A POST request should include:
mappointORmappolygonby id numbertagby id number
###New Tags GET and POST are allowed for this URL, but GET is only intended to be used for debugging purposes. This URL is for linking an existing tag or a new tag with an existing approved MapPoint or MapPolygon. A POST request with a defined MapPoint and a defined MapPolygon will fail. A POST request with neither will also fail.
Currently, no authentication is required to POST. Eventually, a logged in user will be required to POST. A new tag will not be approved until done manually.
A POST request should include:
mappointORmappolygonby id numbertagby tag text