15  REST for Estimate Queries

An estimate query computes an estimated value for a feature attribute whose actual value is not known. The estimate is based on the known values of the same attribute in the areas surrounding the feature for which the estimate is requested. An appropriate estimation method is chosen depending on the type of the attribute that is being estimated.

Consider, for example, the case of estimating the number of households within a given ZIP code when the attributes of the ZIP code geometry table do not include the number of households within the area of each ZIP code. One solution is to get an estimate calculated from the number-of-households attribute of the census block groups whose geometries fall within the target ZIP code.

The following steps illustrate how to specify a simple estimate operation, in this case estimating the number of households within a given ZIP code:

1.  Start with the host, version, and API key (substitute your own key):

http://query.mapfluence.com/2.0/MFDOCS

2.  Add the query statement:

/estimate.json

3.  Add the query definition in the form of a query string, in this case specifying the following properties:
- select=umi.us_census00.stats.cnt_hh: the attribute table column for which values are to be estimated, in this case the number of households from the US Census 2000 Data Tables.
- in=umi.us_census00.zcta_geometry.07932@2010-01-01T01:00:00Z: the geometry of the area for which the estimate is to be calculated, in this case ZIP code 07932.
- using=umi.us_census00.blkgrp_geometry: the geometry table that will be used to find what features are spatially contained within the geometry specified with the in property.
- date=2010-01-01T01:00:00Z: A filter that narrows the attribute records used in the estimation to those whose time span includes the specified datetime.

?select=umi.us_census00.stats.cnt_hh&in=umi.us_census00.zcta_geometry.07932@2010-01-01T01:00:00Z&using=umi.us_census00.blkgrp_geometry&date=2010-01-01T01:00:00Z

4.  Put all the pieces together and you have the complete REST path for the query:

http://query.mapfluence.com/2.0/MFDOCS/estimate.json?select=umi.us_census00.stats.cnt_hh&in=umi.us_census00.zcta_geometry.07932@2010-01-01T01:00:00Z&using=umi.us_census00.blkgrp_geometry&date=2010-01-01T01:00:00Z

This query returns the following JSON key/value pair (to see the complete response body, open a browser window and enter the URL into the address field):

{
  "umi.us_census00.stats.cnt_hh": 2936
}

Notes:
» An alternative to specifying the in geometry with GeoJSON is to use a feature ID (see /catalog/feature/<ID> at http://developer.urbanmapping.com/docs/mapfluence/rest/2.0/reference/catalog/Feature).
» For complete details on the purpose and valid values of spatial query properties, both required and optional, refer to the /estimate.json page of the Mapfluence REST API Reference at http://developer.urbanmapping.com/docs/mapfluence/rest/2.0/reference/query/EstimateQuery.

Top