Skip to main content

Custom Locations

This is an enterprise service. Send an inquiry to Unacast about your interest.

Obtain foot traffic for custom locations on demand. This API allows you to submit requests for foot traffic reports on your custom polygons.

These APIs are currently only available over gRPC. Below in the examples you will find the currently supported language clients. Other language clients can be provided on request.

Constraints

  • US locations are supported
  • Up to 500 locations can be provided per report
  • Supported Foot Traffic Metric IDs:
    • foot_traffic_week_202306, foot_traffic_month_202306, catchment_area_distance_home, catchment_area_distance_work, catchment_area_origin_home, catchment_area_origin_home_h3, catchment_area_origin_work, catchment_area_origin_work_h3, day_of_week, day_of_week_hour, demography_others, demography_residents, demography_total, demography_workers, visit_length

Examples

Python

pre-requisites

  • install the python-language client: pip install unacatlib
import datetime
from unacatlib.byo_external import BYOApiClient, ReportJob

# Sample geo json, currently accepting only geojson of **FeatureCollection** of **Polygon** types.
poi_geo_json='{"type":"FeatureCollection","features":[{"type":"Feature","id":"locA","properties":{"name":"locA","centroid":[-74.00874727686667,40.71410573458434]},"locations":{"type":"Polygon","coordinates":[[[-74.0099746556507,40.71442614438396],[-74.0073353621116,40.713173783426534],[-74.00689547985507,40.713621057901264],[-74.00963133291393,40.71483275001867],[-74.00989955380204,40.71447493719124],[-74.0099746556507,40.71442614438396]]]}},{"type":"Feature","id":"deb_test_l2","properties":{"name":"deb_test_l2","centroid":[-74.0080541940918,40.71076007287371]},"locations":{"type":"Polygon","coordinates":[[[-74.00913780647981,40.710896703152365],[-74.00936311202584,40.71034368619049],[-74.00820439778916,40.7097906646358],[-74.00662725896701,40.711189474978625],[-74.00693839519724,40.71157983541126],[-74.00913780647981,40.710896703152365]]]}}]}'

def run():

with BYOApiClient(
server_address="<provided-by-unacast>",
billing_account='<provided-by-unacast>',
token="<provided-by-unacast>",
) as client:
job: ReportJob = client.create_us_report(
pois=poi_geo_json,
metric_ids=["demography_total","traffic_trends_day","visit_length"],
start_date=datetime.date(year=2022, month=1, day=1),
end_date=datetime.date(year=2022, month=3, day=31)
)

job.wait_for_completion()

# Some status checks here, i.e if success read metric report or do something else on error.
if not job.is_success:
print("Job failed")
else:
for metric_id in job.metric_ids:
metric_values = client.read_us_report(report_id=job.id, metric_id=metric_id)
print({"schema": metric_values.schema.to_json(), "values": list(map(lambda mv: mv.to_json(), metric_values.values))})

run()