MDG Geocoding API
api
read_0
Returns the fips code at the level of geom
for the given single point loc
loc
is a keyword argument, and must be a floating point Longitude, Latitude coordinate pair.
Example format: /api/us/tract/?loc=-104.52,45.12
Path Parameters
The following parameters should be included in the URL path.
Parameter | Description |
---|---|
country required | |
geom required |
create_0
Returns the fips code at the level of geom
for each given point in the request body.
The request body must be a JSON formatted array of floating point Longitude, Latitude coordinate pairs.
Example request body:
[
"-104,45",
"-102,45",
"-97.5,42.3",
"97.5,42.3"
]
Responds with the appropriate FIPS code and coordinates for each point.
If a point did not match to a unit, null
is returned instead of the FIPS code.
Fips codes are guaranteed to be in the same order as supplied in the request.
Path Parameters
The following parameters should be included in the URL path.
Parameter | Description |
---|---|
country required | |
geom required |
read
Returns the fips code at the level of geom
for the given single point loc
loc
is a keyword argument, and must be a floating point Longitude, Latitude coordinate pair.
Example format: /api/us/tract/?loc=-104.52,45.12
Path Parameters
The following parameters should be included in the URL path.
Parameter | Description |
---|---|
geom required |
create
Returns the fips code at the level of geom
for each given point in the request body.
The request body must be a JSON formatted array of floating point Longitude, Latitude coordinate pairs.
Example request body:
[
"-104,45",
"-102,45",
"-97.5,42.3",
"97.5,42.3"
]
Responds with the appropriate FIPS code and coordinates for each point.
If a point did not match to a unit, null
is returned instead of the FIPS code.
Fips codes are guaranteed to be in the same order as supplied in the request.
Path Parameters
The following parameters should be included in the URL path.
Parameter | Description |
---|---|
geom required |
center > read
Given an identifier, find the center of the corresponding census area.
"Center" is defined as the center of mass of the polygon that represents the census area. "Mass" is thought of in terms of area.
For US geometry, geometry_identifier
is the FIPS code.
Returns JSON list of floats, where the first float is longitude and the second is latitude.
URL Parameters
/api/center/<country>/<geom>/?geometry_identifier=<identifier code>
country
: The country that points lie within
- [
us
,eng_ni
,gbr
,ca
,au
,mex
,swd
,bra
]
geom
: The geographical unit to geocode to
- For US: [
tract
,tract_2021
,block_group
,block
] - For England and Northern Ireland: [
region
,lad
,msoa
] - For Great Britain: [
region
,lad
,msoa
] - For Canada: [
province
,census_division
,census_subdivision
,dissemination_area
,dissemination_block
] - For Australia: [
state
,sa2
,sa4
] - For Mexico: [
state
,district
,block
] - For Sweden: [
region
,municipality
,deso
] - For Brazil: [
state
,immediate_region
,sub_district
]
Example
A GET to the following URL
/api/center/us/tract/?geometry_identifier=08069000100
Path Parameters
The following parameters should be included in the URL path.
Parameter | Description |
---|---|
country required | |
geom required |
combined > list
Returns the code for all available geometries for the given single point at addr
or loc
.
addr
is a keyword argument and must be a valid address or place name.
Example format: /api/us/combined/?addr=115 N College Avenue, Fort Collins CO
loc
is a keyword argument and must include longitude and latitude
Example format: /api/us/combined/?loc=-105,45
Path Parameters
The following parameters should be included in the URL path.
Parameter | Description |
---|---|
country required |
getpolygons > read
Given a bounding box, return all polygons that intersect that box.
URL Parameters
/api/getpolygons/<country>/<geom>/?NW_lon=<float>&NW_lat=<float>&SE_lon=<float>&SE_lat=<float>
To access this API endpoint, you supply a bounding box. You specify this bounding box by giving the latitude and longitude of the northwest corner and southeast corner.
- NW_lon: Northwest longitude
- NW_lat: Northwest latitude
- SE_lon: Southeast longitude
- SE_lat: Southeast latitude
You must also supply a country/geom pair.
country
: The country that points lie within
- [
us
,eng_ni
,gbr
,ca
,au
,mex
,swd
,bra
]
geom
: The geographical unit to geocode to
- For US: [
tract
,tract_2021
,block_group
,block
] - For England and Northern Ireland: [
region
,lad
,msoa
] - For Great Britain: [
region
,lad
,msoa
] - For Canada: [
province
,census_division
,census_subdivision
,dissemination_area
,dissemination_block
] - For Australia: [
state
,sa2
,sa4
] - For Mexico: [
state
,district
,block
] - For Sweden: [
region
,municipality
,deso
] - For Brazil: [
state
,immediate_region
,sub_district
]
Example URL:
/api/getpolygons/us/block/?NW_lon=-105.11364&NW_lat=40.61028&SE_lon=-105.07759&SE_lat=40.59627
Return value
This API returns a list of objects. Each object has the following fields:
identifier
: the geometry fips code or identifierpolygon
: a geojson object
Truncation
If too many polygons would be returned by a query, the list will be truncated. If the list is truncated, the list will end with an object like the following:
{'identifier': 'truncated-response'}
To see the current value of limit
, look at GetPolygonsByBoundsAPIView.limit
Path Parameters
The following parameters should be included in the URL path.
Parameter | Description |
---|---|
country required | |
geom required |
global > neighborhood > list
Returns the country code and fips code at the neighborhood level for the given single point loc
.
loc
is a keyword argument, and must be a floating point Longitude, Latitude coordinate pair.
Example format: /api/global/neighborhood/?loc=-104.52,45.12
global > neighborhood > create
Returns the country code and fips code at the neighborhood level for each given point in the request body.
The request body must be a JSON formatted array of floating point Longitude, Latitude coordinate pairs.
Example request body:
[
"-104,40",
"-.1,51.507",
"-80.03,45.34",
"151,-33",
"-102.58,22.777",
"0,0"
]
Responds with the appropriate country code and geometry code for each point.
If a point did not match to a unit, null
is returned instead of the geometry code.
Geocode results are guaranteed to be in the same order as supplied in the request.
user
users > create
Viewset to handle all user interactions
url path: /user/
Request Body
The request body should be a "application/json"
encoded object, containing the following items.
Parameter | Description |
---|---|
username required | Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only. |
email |
users > read
Viewset to handle all user interactions
url path: /user/
Path Parameters
The following parameters should be included in the URL path.
Parameter | Description |
---|---|
id required | A unique integer value identifying this user. |
users > update
Viewset to handle all user interactions
url path: /user/
Path Parameters
The following parameters should be included in the URL path.
Parameter | Description |
---|---|
id required | A unique integer value identifying this user. |
Request Body
The request body should be a "application/json"
encoded object, containing the following items.
Parameter | Description |
---|---|
username required | Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only. |
email |
users > partial_update
Viewset to handle all user interactions
url path: /user/
Path Parameters
The following parameters should be included in the URL path.
Parameter | Description |
---|---|
id required | A unique integer value identifying this user. |
Request Body
The request body should be a "application/json"
encoded object, containing the following items.
Parameter | Description |
---|---|
username | Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only. |
email |
users > delete
Viewset to handle all user interactions
url path: /user/
Path Parameters
The following parameters should be included in the URL path.
Parameter | Description |
---|---|
id required | A unique integer value identifying this user. |