### Install and Initialize Precisely Python SDK Source: https://docs.precisely.com/docs/sftw/precisely-apis/main/en-us/webhelp/apis/PythonSDK/SettingupPythonSDK.html Commands to initialize a local project and install the Precisely API client. Includes options for both local project-specific installation and global deployment. ```bash pip init pip install com.precisely.apis pip install -g preciselyapis-client ``` -------------------------------- ### Initialize and Install Node.js SDK Source: https://docs.precisely.com/docs/sftw/precisely-apis/main/en-us/webhelp/apis/NodeJS/setting_up_node.js_sdk.html Commands to initialize a new Node.js project and install the Precisely API client library either locally or globally. ```bash npm init npm install preciselyapis-client npm install -g preciselyapis-client ``` -------------------------------- ### Address Autocomplete Service Example Source: https://docs.precisely.com/docs/sftw/precisely-apis/main/en-us/webhelp/apis/PythonSDK/SettingupPythonSDK.html This example demonstrates how to initialize the Address Autocomplete service, set API credentials, and perform a search query. ```APIDOC ## Address Autocomplete Service Example ### Description This example demonstrates how to initialize the Address Autocomplete service, set API credentials, and perform a search query using the `search_v2` method. ### Method POST (Implicitly used by the SDK for the API call) ### Endpoint `/address/autocomplete/v2` (This is the underlying endpoint, not directly called by the user) ### Parameters #### Path Parameters None #### Query Parameters - **search_text** (string) - Required - The text to search for addresses. - **country** (string) - Optional - The country code to filter results. #### Request Body None (Parameters are passed as arguments to the method) ### Request Example ```python #We are getting refrence to the installed preciselyapis package from com.precisely.apis.api.address_autocomplete_service_api import AddressAutocompleteServiceApi from com.precisely.apis.exceptions import ApiException def addressAutocompleteExample(): api = AddressAutocompleteServiceApi() api.api_client.oAuthApiKey = "PUT_YOUR_KEY_HERE" api.api_client.oAuthSecret = "PUT_YOUR_SECRET_HERE" api.api_client.generateAndSetToken() try: response = api.search_v2("times sq", country="usa") print(response) except ApiException as e: print(e.body) if _name_ == "_main_": addressAutocompleteExample() ``` ### Response #### Success Response (200) - **response** (object) - The response from the address autocomplete service, containing a list of suggested addresses. #### Response Example ```json { "suggestions": [ { "address": "123 Main St, Anytown, USA" }, { "address": "456 Oak Ave, Otherville, USA" } ] } ``` ``` -------------------------------- ### Sample Request for Capabilities Service (HTTP) Source: https://docs.precisely.com/docs/sftw/precisely-apis/main/en-us/webhelp/apis/Geocode/Capabilities/LI_Cap_GET_sampleresponse_JSON.html This is an example HTTP GET request to the Precisely Capabilities service to retrieve capabilities for Great Britain (GBR). It specifies the API endpoint and query parameters. ```HTTP GET https://api.precisely.com/geocode/v1/transient/premium/​capabilities?country=GBR HTTP/1.1 ``` -------------------------------- ### GET /dictionaries Source: https://docs.precisely.com/docs/sftw/precisely-apis/main/en-us/webhelp/apis/Geocode/UsingAPIs/GetDictionaries.html Retrieves a list of all installed and configured Geocode datasets available in the system. ```APIDOC ## GET /dictionaries ### Description Retrieves a list of all installed and configured Geocode datasets (Dictionaries). This endpoint provides metadata for each dataset, including type and country support. ### Method GET ### Endpoint /dictionaries ### Parameters #### Query Parameters - **country** (string) - Optional - Filter the list of datasets by a specific country code. ### Request Example GET /dictionaries?country=USA ### Response #### Success Response (200) - **datasets** (array) - A list of configured Geocode dataset objects. - **datasets.name** (string) - The name of the dataset. - **datasets.country** (string) - The country supported by the dataset. - **datasets.type** (string) - The type of the Geocode dataset. #### Response Example { "datasets": [ { "name": "USA_Street_Dataset", "country": "USA", "type": "Street" } ] } ``` -------------------------------- ### Search Travel Boundary by Address (HTTP GET) Source: https://docs.precisely.com/docs/sftw/precisely-apis/main/en-us/webhelp/apis/Zones/TravelBoundary/bytime/sample_url.html This example shows how to conduct a travel boundary search using a street address and country via an HTTP GET request. Key parameters include the address, country, cost, database, speed, and various optional settings for refining the search. ```HTTP https://api.precisely.com/zones/v1/travelboundary/bytime?address=4750%20Walnut%20St%2C%20Boulder%2C%20CO&country=USA&costs=5&costUnit=min&db=driving&defaultAmbientSpeed=15&ambientSpeedUnit=MPH&maxOffroadDistance=1&maxOffroadDistanceUnit=mi&destinationSrs=epsg%3A4326&majorRoads=true&returnHoles=false&returnIslands=false&simplificationFactor=0.5&bandingStyle=Donut&historicTrafficTimeBucket=None ``` -------------------------------- ### Query PSAP by Location using HTTP GET Source: https://docs.precisely.com/docs/sftw/precisely-apis/main/en-us/webhelp/apis/911/by_loc/sample_url.html This snippet shows a sample HTTP GET request to the Precisely 911 API. It demonstrates how to specify latitude and longitude parameters to find the relevant PSAP for a given location. No specific authentication or complex headers are shown in this basic example. ```http https://api.precisely.com/911/v1/psap/bylocation?latitude=35.0118&longitude=-81.9571 ``` -------------------------------- ### GET /travel-cost-matrix/by-address Source: https://docs.precisely.com/docs/sftw/precisely-apis/main/en-us/webhelp/apis/Routing/routing_desc.html Calculates travel time and distances between an array of start and end addresses. ```APIDOC ## GET /travel-cost-matrix/by-address ### Description Calculates the travel time and distances between an array of start and end addresses. ### Method GET ### Endpoint /travel-cost-matrix/by-address ### Parameters #### Query Parameters - **startAddresses** (array) - Required - A list of starting addresses. - **endAddresses** (array) - Required - A list of destination addresses. - **travelMode** (string) - Optional - The mode of travel: 'driving' or 'walking'. ### Request Example { "startAddresses": ["123 Main St, New York, NY"], "endAddresses": ["456 Oak St, Los Angeles, CA"] } ### Response #### Success Response (200) - **matrix** (array) - A matrix containing travel times and distances for all combinations. #### Response Example { "matrix": [ { "start": "123 Main St", "end": "456 Oak St", "distance": 2800, "time": 1500 } ] } ``` -------------------------------- ### GET /routing/v1/route/bylocation Source: https://docs.precisely.com/docs/sftw/precisely-apis/main/en-us/webhelp/apis/WADLs/routing_wadl.html Calculates a travel route between a starting coordinate point and an ending coordinate point. ```APIDOC ## GET /routing/v1/route/bylocation ### Description Calculates a route based on latitude and longitude coordinates rather than physical addresses. ### Method GET ### Endpoint https://api.precisely.com/routing/v1/route/bylocation ### Parameters #### Query Parameters - **startPoint** (string) - Required - The starting coordinate (lat,lon). - **endPoint** (string) - Required - The destination coordinate (lat,lon). ### Request Example GET /routing/v1/route/bylocation?startPoint=40.71,-74.00&endPoint=34.05,-118.24 ### Response #### Success Response (200) - **route** (object) - The calculated route details. #### Response Example { "route": { "distance": 2450.2, "time": 2400 } } ``` -------------------------------- ### Configure Authentication and Execute API Request Source: https://docs.precisely.com/docs/sftw/precisely-apis/main/en-us/webhelp/apis/NodeJS/setting_up_node.js_sdk.html Demonstrates how to import the SDK, configure OAuth2 credentials using an API Key and Secret, and execute a service call to the 911 PSAP API. Requires valid credentials from the Precisely developer account. ```javascript const PreciselyAPINodeJS = require('preciselyapis-client'); try { const oAuth = new PreciselyAPINodeJS.OAuth(); oAuth.oAuthApiKey="API_KEY"; oAuth.oAuthSecret="SECRET"; oAuth.getOAuthCredentials().then((data) => { var _911PSAPServiceApi = new PreciselyAPINodeJS._911PSAPServiceApi(data.body); _911PSAPServiceApi.getAHJPlusPSAPByAddress("950 Josephine Street Denver CO 80204").then((response) => { console.log("Result " + JSON.stringify(response.body)); }).catch((response) => { console.log("Error " + JSON.stringify(response.body)); }); }).catch((error) => { console.log("Error" + JSON.stringify(error)) }); } catch (error1) { console.log("Exception raised"+ error1); } ``` -------------------------------- ### Search Travel Boundary by Coordinates (HTTP GET) Source: https://docs.precisely.com/docs/sftw/precisely-apis/main/en-us/webhelp/apis/Zones/TravelBoundary/bytime/sample_url.html This example demonstrates how to perform a travel boundary search using geographic coordinates (longitude, latitude) via an HTTP GET request. It requires specifying the coordinates, cost parameters, database, speed settings, and other optional search criteria. ```HTTP https://api.precisely.com/zones/v1/travelboundary/bytime?point=-73.99753%2C40.76181%2Cepsg%3A4326&costs=5&costUnit=min&db=driving&defaultAmbientSpeed=15&ambientSpeedUnit=MPH&maxOffroadDistance=1&maxOffroadDistanceUnit=mi&destinationSrs=epsg%3A4326&majorRoads=true&returnHoles=false&returnIslands=false&simplificationFactor=0.5&bandingStyle=Donut&historicTrafficTimeBucket=None ``` -------------------------------- ### Implement Address Autocomplete Service Source: https://docs.precisely.com/docs/sftw/precisely-apis/main/en-us/webhelp/apis/PythonSDK/SettingupPythonSDK.html A Python implementation demonstrating how to authenticate with the Precisely API using an API Key and Secret, and how to call the Address Autocomplete service. It includes error handling for API exceptions. ```python from com.precisely.apis.api.address_autocomplete_service_api import AddressAutocompleteServiceApi from com.precisely.apis.exceptions import ApiException def addressAutocompleteExample(): api = AddressAutocompleteServiceApi() api.api_client.oAuthApiKey = "PUT_YOUR_KEY_HERE" api.api_client.oAuthSecret = "PUT_YOUR_SECRET_HERE" api.api_client.generateAndSetToken() try: response = api.search_v2("times sq", country="usa") print(response) except ApiException as e: print(e.body) if __name__ == "__main__": addressAutocompleteExample() ``` -------------------------------- ### Precisely Geocode API: Premium Tier Request Example Source: https://docs.precisely.com/docs/sftw/precisely-apis/main/en-us/webhelp/apis/Geocode/Geocode/LI_Geo_GET_sampleresponse_JSON.html Provides an example GET request URL for the Premium Geocode service. This tier offers the most comprehensive geocoding capabilities. ```HTTP https://api.precisely.com/geocode/v1/premium/geocode?country=USA&mainAddress=4750%20Walnut%20St.%2C%20 Boulder%20CO%2C%2080301&matchMode=Standard&fallbackGeo=true&fallbackPostal=true&maxCands=1&streetOffset=7&streetOffsetUnits=METERS&cornerOffset=7&cornerOffsetUnits=METERS ``` -------------------------------- ### Import Precisely SDK in iOS Source: https://docs.precisely.com/docs/sftw/precisely-apis/main/en-us/webhelp/apis/iOSSDK/ios_setup.html This code snippet shows how to import the Precisely SDK into your iOS view controller. Ensure the PreciselySDK.framework is correctly added to your project and build phases. ```objectivec #import ``` -------------------------------- ### Partial Business Data Example Source: https://docs.precisely.com/docs/sftw/precisely-apis/main/en-us/webhelp/apis/Places/POI_by_Address/sample_response_json.html This snippet shows a partial representation of business data, focusing on identification and contact information. It is useful for scenarios where only specific details are needed. ```json { "id": "1125461330", "name": "X-RAY ENGINEERING", "distance": { "unit": "METERS", "value": "196.767" }, "relevanceScore": "0.0", "contactDetails": { "address": { "formattedAddress": "71 CASTLE DR, STRATFORD, CT, 066142933", "mainAddressLine": "71 CASTLE DR", "addressLastLine": "STRATFORD, CT, 066142933", ``` -------------------------------- ### GET /travel-boundary Source: https://docs.precisely.com/docs/sftw/precisely-apis/main/en-us/webhelp/apis/Zones/TravelBoundary/bytime/query_param.html Calculates a travel boundary polygon based on a starting location, commute mode, and time or distance constraints. ```APIDOC ## GET /travel-boundary ### Description Calculates the reachable area (travel boundary) from a specified point or address within a given cost (time/distance). ### Method GET ### Endpoint /travel-boundary ### Parameters #### Query Parameters - **point** (string) - Required - Starting coordinates (longitude,latitude,srs). - **address** (string) - Required - Starting address (ignored if point is provided). - **costs** (string) - Required - Time/distance values for boundary calculation (comma-separated). - **costUnit** (string) - Optional - Unit for costs (min, msec, s, h). Default: 'min'. - **db** (string) - Optional - Commute mode (driving, walking). Default: 'driving'. - **country** (string) - Optional - 3-character ISO code or country name. Default: 'USA'. - **maxOffroadDistance** (number) - Optional - Max distance off-network. Default: 1. - **maxOffroadDistanceUnit** (string) - Optional - Unit for offroad distance (m, km, yd, ft, mi). Default: 'mi'. - **majorRoads** (boolean) - Optional - Include only major roads. Default: 'true'. - **returnHoles** (boolean) - Optional - Return unreachable areas within boundary. Default: 'false'. - **returnIslands** (boolean) - Optional - Return isolated reachable areas. Default: 'false'. - **simplificationFactor** (number) - Optional - Geometry complexity factor (0.0 - 1.0). Default: 0.5. - **bandingStyle** (string) - Optional - Banding style (Donut, Encompassing). Default: 'Donut'. - **historicTrafficTimeBucket** (string) - Optional - Traffic profile (None, AMPeak, PMPeak, OffPeak, Night). ### Request Example GET /travel-boundary?point=-45,75,epsg:4326&costs=10,20&costUnit=min ### Response #### Success Response (200) - **geometry** (object) - The calculated travel boundary polygon(s). #### Response Example { "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": { "type": "Polygon", "coordinates": [...] }, "properties": { "cost": 10 } } ] } ``` -------------------------------- ### GET /route Source: https://docs.precisely.com/docs/sftw/precisely-apis/main/en-us/webhelp/apis/Routing/TravelCostMatrix/bylocation/query_param.html Calculates routes between multiple start and end points with support for various vehicle types and optimization parameters. ```APIDOC ## GET /route ### Description Calculates the travel route, distance, and time between specified start and end points. Supports multi-point inputs and various vehicle-specific constraints. ### Method GET ### Endpoint /route ### Parameters #### Query Parameters - **startPoints** (string) - Required - Start locations in multi-point format (e.g., '-74.2,40.8,-73,42,epsg:4326'). - **endPoints** (string) - Required - End locations in multi-point format (e.g., '-76.2,40.8,-77,48,epsg:4326'). - **db** (string) - Optional - Mode of commute: 'driving' or 'walking'. Default: 'driving'. - **optimizeBy** (string) - Optional - Optimization criteria: 'time' or 'distance'. Default: 'time'. - **returnDistance** (boolean) - Optional - Whether to return travel distance. Default: 'true'. - **returnTime** (boolean) - Optional - Whether to return travel time. Default: 'true'. - **distanceUnit** (string) - Optional - Unit for distance: 'm', 'km', 'yd', 'ft', 'mi'. Default: 'm'. - **timeUnit** (string) - Optional - Unit for time: 'min', 'msec', 's', 'h'. Default: 'min'. - **vehicleType** (string) - Optional - Type of vehicle for routing constraints (e.g., 'STRAIGHT', 'SEMI_TRAILOR'). - **weight** (number) - Optional - Maximum vehicle weight. - **height** (number) - Optional - Maximum vehicle height. ### Request Example GET /route?startPoints=-74.2,40.8&endPoints=-76.2,40.8&db=driving ### Response #### Success Response (200) - **distance** (number) - Calculated travel distance. - **time** (number) - Calculated travel time. - **routeGeometry** (string) - Encoded path geometry. #### Response Example { "distance": 150.5, "distanceUnit": "km", "time": 120, "timeUnit": "min" } ``` -------------------------------- ### POST /websites/precisely_sftw_precisely-apis_main_en-us_webhelp Source: https://docs.precisely.com/docs/sftw/precisely-apis/main/en-us/webhelp/apis/LocalTax/tax_loc_batch/query_param.html This endpoint allows for tax calculation based on location and purchase amount, with options for preferences and output formatting. ```APIDOC ## POST /taxLocation ### Description Calculates tax for a given location and purchase amount. Supports various preferences to customize the output and processing. ### Method POST ### Endpoint /taxLocation ### Parameters #### Query Parameters - **taxLocation** (object) - Required - The location coordinates for which the tax is to be calculated. - **preferences** (object) - Optional - The option to set preferences. #### Request Body - **objectId** (integer) - Optional - Uniquely identifies PreciselyID. If provided, the associated objectId with each PreciselyID is returned in the response for reference. It should be a valid positive integer. If not provided, then the objectId is generated starting '1' and auto incremented. - **outputCasing** (string) - Optional - Specifies the casing of the output data. One of the following: 'M' (Default value) The output in mixed case. For example: 123 Main St Mytown FL 12345 'U' The output in upper case. For example: 123 MAIN ST MYTOWN FL 12345. - **defaultBufferWidth** (number) - Optional - Specifies the width of the polygon buffers to use for Boundary File processing. The buffer width is used to determine if a point is close to the edge of a polygon. The output field BufferRelation indicates whether or not the point is within the polygon's buffer area. Specify the border width in the units specified by the DistanceUnits option. If you do not specify a buffer width in this input field, the default is used. Default value: 0 Range: 0-5280 Feet. - **distanceUnits** (string) - Optional - Specifies the units in which to measure distance. One of the following: 'Miles', 'Kilometers', 'Feet' (Default value), 'Meters'. - **returnCensusFields** (string) - Optional - This preference Option sets flag for returning Census Fields 'Y' - Return Census fields 'N' – (Default value) Do not return Census fields. - **type** (string) - Required - Geometry Type which is “Point” in this case. - **coordinates** (array) - Required - Location Coordinates i.e. Longitude and Latitude of the Location. (WGS 84 datum/EPSG:4326 coordinate system). - **purchaseAmount** (number) - Required - The amount on which tax to be calculated. ### Request Example ```json { "objectId": 12345, "outputCasing": "M", "defaultBufferWidth": 100, "distanceUnits": "Feet", "returnCensusFields": "Y", "type": "Point", "coordinates": [-74.0060, 40.7128], "purchaseAmount": 1000.50 } ``` ### Response #### Success Response (200) - **field1** (type) - Description #### Response Example ```json { "taxDetails": { "taxAmount": 82.54, "currency": "USD" }, "objectId": 12345, "censusFields": { "population": 8000000 } } ``` ``` -------------------------------- ### GET /route Source: https://docs.precisely.com/docs/sftw/precisely-apis/main/en-us/webhelp/apis/Routing/Route/byaddress/query_param.html Calculates a route between a starting address and an ending address with optional intermediate waypoints and advanced configuration settings. ```APIDOC ## GET /route ### Description Calculates a route between a starting point and an ending point. Supports intermediate waypoints, travel mode selection, and various optimization parameters. ### Method GET ### Endpoint /route ### Parameters #### Query Parameters - **startAddress** (string) - Required - Specifies the starting point of the route. - **endAddress** (string) - Required - Specifies the ending point of the route. - **db** (string) - Optional - Mode of commute: 'driving' or 'walking'. Default: 'driving'. - **country** (string) - Optional - 3 character ISO code or country name. Default: 'USA'. - **intermediateAddresses** (string) - Optional - Pipe separated list of intermediate addresses (up to 25). - **returnIntermediatePoints** (boolean) - Optional - Whether to return intermediate points in the response. - **directionsStyle** (string) - Optional - 'None', 'Normal', or 'Terse'. Default: 'None'. - **segmentGeometryStyle** (string) - Optional - 'none', 'end', or 'all'. Default: 'none'. - **oip** (boolean) - Optional - Whether to optimize waypoints. Default: 'false'. - **optimizeBy** (string) - Optional - 'time' or 'distance'. Default: 'time'. - **returnDistance** (boolean) - Optional - Include distance in response. Default: 'true'. - **distanceUnit** (string) - Optional - 'm', 'km', 'yd', 'ft', 'mi'. Default: 'm'. - **returnTime** (boolean) - Optional - Include time in response. Default: 'true'. - **timeUnit** (string) - Optional - 'min', 'msec', 's', 'h'. Default: 'min'. - **language** (string) - Optional - Language code for directions. Default: 'en'. - **primaryNameOnly** (boolean) - Optional - Return only primary street names. Default: 'false'. - **majorRoads** (boolean) - Optional - Include only major roads. Default: 'false'. - **destinationSrs** (string) - Optional - Coordinate system of returned routes. Default: 'epsg:4326'. ### Request Example GET /route?startAddress=1global view, troy, ny&endAddress=2, Abc road, New Jersey&db=driving ### Response #### Success Response (200) - **routeData** (object) - Contains the calculated route geometry, distance, time, and directions based on requested parameters. #### Response Example { "status": "success", "distance": 150.5, "unit": "km", "time": 120, "timeUnit": "min" } ``` -------------------------------- ### Configure OAuth Credentials Source: https://docs.precisely.com/docs/sftw/precisely-apis/main/en-us/webhelp/apis/PythonSDK/SettingupPythonSDK.html Snippet for assigning API credentials to the OAuth object within the SDK configuration. ```python oAuth.oAuthApiKey="API_KEY"; oAuth.oAuthSecret="SECRET"; ``` -------------------------------- ### GET /routing/v1/route/byaddress Source: https://docs.precisely.com/docs/sftw/precisely-apis/main/en-us/webhelp/apis/WADLs/routing_wadl.html Calculates a travel route between a starting address and an ending address, supporting various optimization parameters and vehicle constraints. ```APIDOC ## GET /routing/v1/route/byaddress ### Description Calculates a route between two addresses. Supports intermediate stops, vehicle constraints (weight, height, length), and various output formats for distance and time. ### Method GET ### Endpoint https://api.precisely.com/routing/v1/route/byaddress ### Parameters #### Query Parameters - **startAddress** (string) - Required - The starting address for the route. - **endAddress** (string) - Required - The destination address for the route. - **db** (string) - Optional - Database identifier. - **country** (string) - Optional - Country code for the addresses. - **vehicleType** (string) - Optional - Type of vehicle for routing constraints. ### Request Example GET /routing/v1/route/byaddress?startAddress=123+Main+St&endAddress=456+Oak+Ave ### Response #### Success Response (200) - **route** (object) - The calculated route details including geometry, distance, and time. #### Response Example { "route": { "distance": 15.5, "time": 25 } } ``` -------------------------------- ### GET /routing/v1/travelcostmatrix/bylocation Source: https://docs.precisely.com/docs/sftw/precisely-apis/main/en-us/webhelp/apis/Routing/TravelCostMatrix/bylocation/sample_url.html Calculates the travel cost matrix by location. It takes start and end points, routing preferences, and returns cost, distance, and time information. ```APIDOC ## GET /routing/v1/travelcostmatrix/bylocation ### Description Calculates the travel cost matrix by location. It takes start and end points, routing preferences, and returns cost, distance, and time information. ### Method GET ### Endpoint /routing/v1/travelcostmatrix/bylocation ### Parameters #### Query Parameters - **startPoints** (string) - Required - Comma-separated list of start point coordinates and SRS (e.g., "77.5,38.8,epsg:4326"). - **endPoints** (string) - Required - Comma-separated list of end point coordinates and SRS (e.g., "77.5,39.8,epsg:4326"). - **db** (string) - Required - The routing database to use (e.g., "driving"). - **destinationSrs** (string) - Required - The Spatial Reference System for the destination points (e.g., "epsg:4326"). - **optimizeBy** (string) - Optional - The criteria to optimize by (e.g., "time"). - **returnDistance** (boolean) - Optional - Whether to return distance information (default: true). - **distanceUnit** (string) - Optional - The unit for distance (e.g., "m"). - **returnTime** (boolean) - Optional - Whether to return time information (default: true). - **timeUnit** (string) - Optional - The unit for time (e.g., "min"). - **majorRoads** (boolean) - Optional - Whether to consider major roads (default: false). - **returnOptimalRoutesOnly** (boolean) - Optional - Whether to return only optimal routes (default: true). - **historicTrafficTimeBucket** (string) - Optional - Time bucket for historic traffic data (e.g., "None"). - **useCvr** (string) - Optional - Use Commercial Vehicle Routing (e.g., "N"). - **looseningBarrierRestrictions** (string) - Optional - Loosen barrier restrictions (e.g., "Y"). - **vehicleType** (string) - Optional - The type of vehicle (e.g., "ALL"). - **weight** (number) - Optional - The weight of the vehicle. - **weightUnit** (string) - Optional - The unit for weight (e.g., "kg"). - **heightUnit** (string) - Optional - The unit for height. - **lengthUnit** (string) - Optional - The unit for length. - **widthUnit** (string) - Optional - The unit for width. ### Request Example ``` GET https://api.precisely.com/routing/v1/travelcostmatrix/bylocation?startPoints=77.5%2C38.8%2Cepsg%3A4326&endPoints=77.5%2C39.8%2Cepsg%3A4326&db=driving&destinationSrs=epsg%3A4326&optimizeBy=time&returnDistance=true&distanceUnit=m&returnTime=true&timeUnit=min&majorRoads=false&returnOptimalRoutesOnly=true&historicTrafficTimeBucket=None&useCvr=N&looseningBarrierRestrictions=Y&vehicleType=ALL&weight=10&weightUnit=kg&heightUnit=ft&lengthUnit=ft&widthUnit=ft ``` ### Response #### Success Response (200) - **results** (array) - An array of travel cost results. - **startLocation** (object) - The start location details. - **endLocation** (object) - The end location details. - **distance** (number) - The calculated distance. - **distanceUnit** (string) - The unit of the distance. - **time** (number) - The calculated travel time. - **timeUnit** (string) - The unit of the travel time. #### Response Example ```json { "results": [ { "startLocation": { "x": 77.5, "y": 38.8 }, "endLocation": { "x": 77.5, "y": 39.8 }, "distance": 111194.9, "distanceUnit": "m", "time": 7200, "timeUnit": "s" } ] } ``` ``` -------------------------------- ### Initialize Vector Maps with Precisely SDK Source: https://docs.precisely.com/docs/sftw/precisely-apis/main/en-us/webhelp/apis/JavaScriptSDK/Maps/geomap_vector.html A complete HTML example demonstrating how to initialize the Precisely Maps SDK and invoke the getMapsVector method to render a map with the 'iron' theme. ```html

Maps SDK Test Page

``` -------------------------------- ### GET /earthquake/events Source: https://docs.precisely.com/docs/sftw/precisely-apis/main/en-us/webhelp/apis/Risks/risks_fire_history_v2/query_param.html Retrieves earthquake events based on provided query parameters. Users can filter by postcode, start date, end date, and the maximum number of events to return. ```APIDOC ## GET /earthquake/events ### Description Retrieves earthquake events based on provided query parameters. Users can filter by postcode, start date, end date, and the maximum number of events to return. ### Method GET ### Endpoint /earthquake/events ### Parameters #### Query Parameters - **postCode** (string) - Required - The 5-digit postcode. - **startDate** (long) - Optional - Specifies earthquake events occurred after startDate (UTC time in milliseconds). The value is time elapsed since January 1, 1970 UTC. If not provided, then the number event occurrences specified in maxCandidates parameter are returned in descending order from the startDate. - **endDate** (long) - Optional - Specifies earthquake events occurred before endDate (UTC time in milliseconds). The value is time elapsed since January 1, 1970 UTC. If not provided, then the number event occurrences specified in maxCandidates parameter are returned in descending order from the endDate. - **maxCandidates** (integer) - Optional - Specifies the number of fire occurrences that can be retrieved. Default: 5 Maximum Value: 50 ### Request Example ```json { "example": "GET /earthquake/events?postCode=SW1A0AA&startDate=1678886400000&endDate=1678972800000&maxCandidates=10" } ``` ### Response #### Success Response (200) - **events** (array) - An array of earthquake event objects. - **magnitude** (float) - The magnitude of the earthquake. - **occurredAt** (long) - The UTC time in milliseconds when the earthquake occurred. - **location** (object) - The location of the earthquake. - **latitude** (float) - The latitude of the earthquake. - **longitude** (float) - The longitude of the earthquake. #### Response Example ```json { "example": { "events": [ { "magnitude": 2.5, "occurredAt": 1678957200000, "location": { "latitude": 51.5074, "longitude": -0.1278 } }, { "magnitude": 1.9, "occurredAt": 1678870800000, "location": { "latitude": 51.5100, "longitude": -0.1300 } } ] } } ``` ``` -------------------------------- ### API Request URL Example Source: https://docs.precisely.com/docs/sftw/precisely-apis/main/en-us/webhelp/apis/AboutDocument/typographic_conventions.html Demonstrates the structure of a RESTful API request URL for retrieving points of interest by address. It includes query parameters for location, search radius, and sorting preferences. ```http https://api.precisely.com/places/v1/poi/byaddress?address=2935%20Broadbridge%20Ave%2C%20Stratford%2C%20CT&country=USA&searchRadius=3218.688&searchRadiusUnit=meters&maxCandidates=20&sortBy=relevance&fuzzyOnName=Y&page=1 ``` -------------------------------- ### HTTP GET Request for Key Lookup Source: https://docs.precisely.com/docs/sftw/precisely-apis/main/en-us/webhelp/apis/Geocode/sample_url.html This snippet shows a sample URL for performing a key lookup using the Precisely API. It requires an API key and specifies the type of lookup. The response will contain information related to the provided key. ```http https://api.precisely.com/geocode/v1/keylookup?key=P00003PZ0BUF&type=PB_Key ``` -------------------------------- ### GET /routing/v1/travelcostmatrix/byaddress Source: https://docs.precisely.com/docs/sftw/precisely-apis/main/en-us/webhelp/apis/Routing/TravelCostMatrix/byaddress/sample_url.html Retrieves the travel cost matrix between specified start and end addresses. Supports various parameters for customization, including database, optimization, and return values. ```APIDOC ## GET /routing/v1/travelcostmatrix/byaddress ### Description Calculates the travel cost matrix between a list of start addresses and a list of end addresses. This endpoint provides information such as distance and time for each route, with options to customize the calculation based on various parameters. ### Method GET ### Endpoint /routing/v1/travelcostmatrix/byaddress ### Parameters #### Query Parameters - **startAddresses** (string) - Required - Comma-separated list of starting addresses. - **endAddresses** (string) - Required - Comma-separated list of ending addresses. - **country** (string) - Required - The country for the addresses (e.g., USA). - **db** (string) - Optional - The routing database to use (e.g., driving). - **destinationSrs** (string) - Optional - The Spatial Reference System for the destination coordinates (e.g., epsg:4326). - **optimizeBy** (string) - Optional - The criteria for optimization (e.g., time). - **returnDistance** (boolean) - Optional - Whether to return distance information (default: true). - **distanceUnit** (string) - Optional - The unit for distance (e.g., m). - **returnTime** (boolean) - Optional - Whether to return time information (default: true). - **timeUnit** (string) - Optional - The unit for time (e.g., min). - **majorRoads** (boolean) - Optional - Whether to consider major roads (default: false). - **returnOptimalRoutesOnly** (boolean) - Optional - Whether to return only optimal routes (default: true). - **historicTrafficTimeBucket** (string) - Optional - Time bucket for historic traffic data (e.g., None). - **useCvr** (string) - Optional - Use Commercial Vehicle Routing (e.g., N). - **looseningBarrierRestrictions** (string) - Optional - Loosen barrier restrictions (e.g., Y). - **vehicleType** (string) - Optional - Type of vehicle (e.g., ALL). - **weight** (number) - Optional - Weight of the vehicle. - **weightUnit** (string) - Optional - Unit for weight (e.g., kg). - **heightUnit** (string) - Optional - Unit for height (e.g., ft). - **lengthUnit** (string) - Optional - Unit for length (e.g., ft). - **widthUnit** (string) - Optional - Unit for width (e.g., ft). ### Request Example ``` https://api.precisely.com/routing/v1/travelcostmatrix/byaddress?startAddresses=4750%20Walnut%20St%2C%20Boulder%2C%20CO&endAddresses=2935%20Broadbridge%20Ave%2C%20Stratford%2C%20CT&country=USA&db=driving&destinationSrs=epsg%3A4326&optimizeBy=time&returnDistance=true&distanceUnit=m&returnTime=true&timeUnit=min&majorRoads=false&returnOptimalRoutesOnly=true&historicTrafficTimeBucket=None&useCvr=N&looseningBarrierRestrictions=Y&vehicleType=ALL&weight=10&weightUnit=kg&heightUnit=ft&lengthUnit=ft&widthUnit=ft ``` ### Response #### Success Response (200) - **results** (array) - An array of travel cost objects, each containing distance, time, and route information. - **distance** (number) - The calculated distance for the route. - **time** (number) - The calculated time for the route. - **distanceUnit** (string) - The unit of distance returned. - **timeUnit** (string) - The unit of time returned. #### Response Example ```json { "results": [ { "distance": 1500000.5, "time": 1800.75, "distanceUnit": "m", "timeUnit": "min" } ] } ``` ``` -------------------------------- ### Contact and Location Data Example Source: https://docs.precisely.com/docs/sftw/precisely-apis/main/en-us/webhelp/apis/Places/POI_by_Address/sample_response_json.html This snippet shows how contact details, including address and phone number, are structured. It also includes geographical information like coordinates and distance. ```json { "id": "1126530861", "name": "125 MARINA DRIVE, LLC", "distance": { "unit": "METERS", "value": "152.639" }, "relevanceScore": "0.0", "contactDetails": { "address": { "formattedAddress": "425 MARINA DR, STRATFORD, CT, 066142935", "mainAddressLine": "425 MARINA DR", "addressLastLine": "STRATFORD, CT, 066142935", "areaName1": "CONNECTICUT", "areaName3": "STRATFORD", "postCode": "066142935", "country": "USA" }, "phone": "(203) 386-9140", "countryAccessCode": "001" }, "poiClassification": { "sic": { "businessLine": "MARINAS, NSK", "sicCode": "44930000", "sicCodeDescription": "MARINAS", "primarySicCode": "4493" }, "category": { "categoryCode": "14050703001", "tradeDivision": "DIVISION E. - TRANSPORTATION AND PUBLIC UTILITIES", "tradeGroup": "WATER TRANSPORTATION", "subClass": "MARINAS", "class": "SERVICES INCIDENTAL TO WATER TRANSPORTATION" }, "alternateIndustryCode": "713930" }, "salesVolume": [ { "currencyCode": "USD", "worldBaseCurrencyCode": "0020", "value": "107994" } ], "employeeCount": { "inLocalBranch": "2", "inOrganization": "2" }, "yearStart": "2014", "goodsAgentCode": "G", "goodsAgentCodeDescription": "NOT AVAILABLE OR NONE", "legalStatusCode": "0", "organizationStatusCode": "0", "organizationStatusCodeDescription": "SINGLE LOCATION - NO OTHER ENTITIES REPORT TO IT", "subsidaryIndicator": "0", "subsidaryIndicatorDescription": "NOT A SUBSIDIARY", "globalUltimateIndicator": "N", "familyMembers": "0", "hierarchyCode": "0", "geometry": { "type": "Point", "coordinates": [ -73.15092, 41.210435 ] } } ```