npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

visicom-data-api

v1.0.4

Published

A js/ts wrapper for Visicom Data API (dAPI)

Readme

Visicom Data API SDK

Welcome to the Visicom Data API SDK. This SDK provides easy-to-use access to Visicom's geospatial services, including buffer zones, location queries, traveling salesman problem (TSP) optimization, and more.


#Official Documentation


Installation

npm install visicom-data-api

Quick Start

import { VisicomDataApi } from 'visicom-data-api';

const API_KEY = 'YOUR_API_KEY';
const {
 Buffer,
  Location,
  Distance,
  DistanceMatrix,
  Geocode,
  Feature,
  SnapToRoad,
  TSP,
} = new VisicomDataApi(API_KEY).getServices();

Builder Usage

The SDK supports a builder pattern to manually construct a request URL. RequestService is one of (TSP, Location, Buffer, Distance, DistanceMatrix, Geocode, Feature, SnapToRoad). When called, builder will provide a methods to build a url refered only to exact service.

Use QueryBuilder directly to build requests manually.

import {QueryBuilder} from 'visicom-data-api';

const requestUrl = new QueryBuilder(apiKey)
  .getBuilder(RequestServices.TSP)
  .waypoints(points)
  .locks(locks)
  .roundTrip(true)
  .mode('driving')
  .toString();

Request Config Reassign

Each service (except Buffer) has a setConfig methods. This method will override configs for the whole service.

Example

Distance.setConfig({geometry: "path"})

This call will override geometry config param and keep other params untouched.

Another option to reassign request config is to provide them directly in method signature. In this case params will be applied individually on a single method and will have highest priority than params applied inside setConfig call.

Example

Distance.getDistance("POIA1KIGKN", [30.52239, 50.44777], { geometry: "path" }).then((data) => {
  console.log("Distance (getDistance <with geometry>):", JSON.stringify(data));
});

CSV Download

Such services as Geocode, Feature and Location(in future releases) has an option to download data as csv. Data will be returned in Blob data-type for both Browser and Node environment.

Example

 Geocode.getAddressPointsByNameNearby("Велика", [30.36277, 50.51605], 14, {
    format: "csv",
  }).then(async (data) => {
    const buffer = await (data as Blob).arrayBuffer();
    const text = new TextDecoder("utf-8").decode(buffer);

    console.log(
      "\nGeocode (getAddressPointsByNameNearby) <csv>\n" + text
    );
  });

Buffer Service

Buffer.getBufferZone

Retrieve a buffer zone (circular zone) around a point or an object.

Buffer.getBufferZone(near: GeoJSON.Position[] | string, radius: number): Promise<BufferI>

Parameters

| Name | Type | Description | |--------|--------------------------|-------------------------------------------------------------------------| | near | string \| GeoJSON.Position[] | ID of an object (string) or an array of [longitude, latitude] coordinates. | | radius | number | Buffer radius in meters. Maximum allowed: 10000 meters. |

Example Usage

Buffer.getBufferZone("STR3K0MXUAGD", 250).then((data) => {
  console.log("Buffer Zone:", JSON.stringify(data));
});

Buffer.getBufferZone([
  [30.395736694335934, 50.49235413426535],
  [30.550060272216797, 50.49748661913787]
], 250).then((data) => {
  console.log("Buffer Zone:", JSON.stringify(data));
});

Constraints

  • If near is an array or WKT, it must have no more than 250 points. Otherwise, a TooManyPointsError is thrown.
  • radius must be less than or equal to 10000 meters. Otherwise, an ExcisedLimitError is thrown.

Location Service

Location.getLocationBySinglePoint

Retrieve nearby objects based on a single point, azimut, and distance.

Location.getLocationBySinglePoint(start: GeoJSON.Position, azimut: number, distance: number): Promise<LocationI>

Parameters

| Name | Type | Description | |-----------|-------------------|----------------------------------------------------------------| | start | GeoJSON.Position | Start point as [longitude, latitude]. | | azimut | number | Azimut angle in degrees from the start point. | | distance| number | Distance in meters to search within. |

Example Usage

Location.getLocationBySinglePoint([30.55631, 50.43474], 255, 5000).then((data) => {
  console.log("Location (getLocationBySinglePoint):", JSON.stringify(data));
});

Location.getLocationByGeometry

Retrieve nearby objects based on a geometry (polygon), a string identifier, or coordinates.

Location.getLocationByGeometry(start: GeoJSON.Polygon | GeoJSON.Position | string, azimut: number, distance: number): Promise<LocationI>

Parameters

| Name | Type | Description | |-----------|---------------------------------------|----------------------------------------------------------------| | start | GeoJSON.Polygon \| GeoJSON.Position \| string | Start object: a polygon, a point, or an object ID. | | azimut | number | Azimut angle in degrees from the start. | | distance| number | Distance in meters to search within. |

Example Usage

Location.getLocationByGeometry(polygon, 255, 5000).then((data) => {
  console.log("Location (getLocationByGeometry):", JSON.stringify(data));
});

Constraints

  • If start is a polygon or WKT, it must not contain more than 250 points. Otherwise, a TooManyPointsError is thrown.

TSP (Traveling Salesman Problem) Service

Request Configs

| Property | Type | Description | | ----------------- | ---------- | -------------------------------------------- | | shouldRoundTrip | boolean | If true, route will return to the origin. | | mode | "driving" \| "driving-shortest" \| "direct" | Mode of transportation or optimization type. |

TSP.getRoute

Retrieve an optimized route through a set of points.

TSP.getRoute(points: GeoJSON.Position[], config?: TSPRequestConfig): Promise<TSPRoute>

Parameters

| Name | Type | Description | |----------|-------------------------|------------------------------------------| | points | GeoJSON.Position[] | List of coordinates [longitude, latitude]. Max 50 points. | | config | TSPRequestConfig (optional) | Optional configuration (roundTrip, mode). |

Example Usage

TSP.getRoute([
  [28.71483, 50.29734],
  [34.46411, 44.89917],
  [31.27979, 51.50313],
  [37.76207, 47.98739],
  [24.01646, 49.8392],
  [32.41791, 50.90552],
]).then((data) => {
  console.log("TSP (getRoute)", JSON.stringify(data));
});

TSP.getRouteWithLocks

Retrieve an optimized route with fixed intermediate locks.

TSP.getRouteWithLocks(points: GeoJSON.Position[], locks: GeoJSON.Position[], config?: TSPRequestConfig): Promise<TSPRoute>

Example Usage

TSP.getRouteWithLocks([
  [28.71483, 50.29734],
  [34.46411, 44.89917],
  [31.27979, 51.50313],
  [37.76207, 47.98739],
  [24.01646, 49.8392],
  [32.41791, 50.90552],
], [
  [30.36277, 50.51605],
  [30.49667, 50.49508],
  [30.59761, 50.45226],
  [30.51383, 50.44789],
]).then((data) => {
  console.log("TSP (getRouteWithLocks)", JSON.stringify(data));
});

Constraints

  • A maximum of 50 waypoints are allowed. Otherwise, a TooManyPointsError will be thrown.

Distance Service

The Distance service allows you to calculate distances between two points with optional locks and waypoints. You can also specify the travel mode and the response geometry type.

Request Configs

| Property | Type | Description | | ---------- | ----------------- | ----------------------------------------- | | geometry | "path" \| "no" | Geometry type to use in the calculation (default no). | | mode | "driving" \| "driving-shortest" \| "direct" | Transportation or routing mode. | | accuracy | number | Desired accuracy level (e.g., in meters). |

Distance.getDistance

Retrieve direct distance between two points.

Distance.getDistance(start: GeoJSON.Position | string, end: GeoJSON.Position | string, config?: DistanceRequestConfig): Promise<DistanceWithGeometry | DistanceI>

Parameters

| Name | Type | Description | |-----------|----------------------------------|-------------------------------------------| | start | GeoJSON.Position \| string | Start point coordinates or object ID. | | end | GeoJSON.Position \| string | End point coordinates or object ID. | | config | DistanceRequestConfig (optional) | Optional travel configuration. |

Example

Distance.getDistance("POIA1KIGKN", [30.52239, 50.44777]).then((data) => {
  console.log("Distance (getDistance):", JSON.stringify(data));
});

Distance.getDistance("POIA1KIGKN", [30.52239, 50.44777], { geometry: "path" }).then((data) => {
  console.log("Distance (getDistance <with geometry>):", JSON.stringify(data));
});

Distance.getDistanceWithWaypoints

Retrieve distance passing through optional waypoints.

Distance.getDistanceWithWaypoints(start: GeoJSON.Position | string, end: GeoJSON.Position | string, waypoints: GeoJSON.Position[] | string[], config?: DistanceRequestConfig): Promise<DistanceWithGeometry | DistanceI>

Parameters

| Name | Type | Description | |-------------|-------------------------------------------|-------------------------------------------------------| | start | GeoJSON.Position \| string | Start point coordinates or object ID. | | end | GeoJSON.Position \| string | End point coordinates or object ID. | | waypoints | GeoJSON.Position[] \| string[] | Intermediate points between start and end (max 25). | | config | DistanceRequestConfig (optional) | Optional travel configuration. |

Example

Distance.getDistanceWithWaypoints("POIA1KIGKN", [30.52239, 50.44777], [[30.54173, 50.44497]]).then((data) => {
  console.log("Distance (getDistanceWithWaypoints):", JSON.stringify(data));
});

Constraints

  • Max 25 waypoints.

Distance.getDistanceWithLocks

Retrieve distance using fixed intermediate locks.

Distance.getDistanceWithLocks(start: GeoJSON.Position | string, end: GeoJSON.Position | string, locks: GeoJSON.Position[] | string[], config?: DistanceRequestConfig): Promise<DistanceWithGeometry | DistanceI>

Parameters

| Name | Type | Description | |----------|-------------------------------------------|------------------------------------------------------| | start | GeoJSON.Position \| string | Start point coordinates or object ID. | | end | GeoJSON.Position \| string | End point coordinates or object ID. | | locks | GeoJSON.Position[] \| string[] | Points that must be strictly visited (max 25). | | config | DistanceRequestConfig (optional) | Optional travel configuration. |

Example

Distance.getDistanceWithLocks("POIA1KIGKN", [30.52239, 50.44777], [[30.54173, 50.44497]]).then((data) => {
  console.log("Distance (getDistanceWithLocks):", JSON.stringify(data));
});

Constraints

  • Max 25 locks.

Distance.getDistanceWithLocksAndWaypoints

Retrieve distance with both locks and waypoints.

Distance.getDistanceWithLocksAndWaypoints(start: GeoJSON.Position | string, end: GeoJSON.Position | string, locks: GeoJSON.Position[] | string[], waypoints: GeoJSON.Position[] | string[], config?: DistanceRequestConfig): Promise<DistanceWithGeometry | DistanceI>

Parameters

| Name | Type | Description | |-------------|-------------------------------------------|-----------------------------------------------------------| | start | GeoJSON.Position \| string | Start point coordinates or object ID. | | end | GeoJSON.Position \| string | End point coordinates or object ID. | | locks | GeoJSON.Position[] \| string[] | Locked points that must be visited (max 25). | | waypoints | GeoJSON.Position[] \| string[] | Intermediate flexible points between start and end (max 25). | | config | DistanceRequestConfig (optional) | Optional travel configuration. |

Example

Distance.getDistanceWithLocksAndWaypoints(
  "POIA1KIGKN",
  [30.52239, 50.44777],
  [[30.54173, 50.44497]],
  [[30.54473, 50.42497]],
  { geometry: "path" }
).then((data) => {
  console.log("Distance (getDistanceWithLocksAndWaypoints):", JSON.stringify(data));
});

Constraints

  • Max 25 locks.
  • Max 25 waypoints.

Distance Matrix Service

The Distance Matrix service allows you to calculate pairwise distances between multiple origin and destination points, optionally using locks.

Request Configs

| Property | Type | Description | | -------- | --------------- | ---------------------------------- | | mode | "driving" \| "driving-shortest" \| "direct" | Transportation mode for distances. |

DistanceMatrix.getPairedPointsDistance

Retrieve the distances between each origin and destination point.

DistanceMatrix.getPairedPointsDistance(origins: GeoJSON.Position[] | string[], destinations: GeoJSON.Position[] | string[], config?: DistanceMatrixRequestConfig): Promise<DistanceMatrixI>

Parameters

| Name | Type | Description | |---------------|---------------------------|-------------------------------------------------------| | origins | GeoJSON.Position[] \| string[] | List of origin points (coordinates or IDs). | | destinations| GeoJSON.Position[] \| string[] | List of destination points (coordinates or IDs). | | config | DistanceMatrixRequestConfig (optional) | Travel mode configuration. |

Example

DistanceMatrix.getPairedPointsDistance(
  [
    [30.36277, 50.51605],
    [30.49667, 50.49508],
    [30.59761, 50.45226],
    [30.51383, 50.44789],
  ],
  [
    [30.36277, 50.51605],
    [30.49667, 50.49508],
    [30.59761, 50.45226],
    [30.51383, 50.44789],
  ]
).then((data) => {
  console.log("DistanceMatrix (getPairedPointsDistance):", JSON.stringify(data));
});

DistanceMatrix.getPairedPointsDistanceWithLocks

Retrieve the distances between origin and destination points using fixed intermediate locks.

DistanceMatrix.getPairedPointsDistanceWithLocks(origins: GeoJSON.Position[] | string[], destinations: GeoJSON.Position[] | string[], locks: GeoJSON.Position[], config?: DistanceMatrixRequestConfig): Promise<DistanceMatrixI>

Parameters

| Name | Type | Description | |---------------|---------------------------|-------------------------------------------------------| | origins | GeoJSON.Position[] \| string[] | List of origin points (coordinates or IDs). | | destinations| GeoJSON.Position[] \| string[] | List of destination points (coordinates or IDs). | | locks | GeoJSON.Position[] | List of intermediate fixed locks coordinates. | | config | DistanceMatrixRequestConfig (optional) | Travel mode configuration. |

Example

DistanceMatrix.getPairedPointsDistanceWithLocks(
  [
    [30.16277, 50.31605],
    [30.49667, 50.49108],
    [30.59761, 50.45226],
    [30.51353, 50.94789],
  ],
  [
    [30.36277, 50.51605],
    [30.49667, 50.49508],
    [30.59761, 50.45226],
    [30.51383, 50.44789],
  ],
  [
    [30.16277, 50.31605],
    [30.49667, 50.49108],
    [30.59761, 50.45226],
    [30.51353, 50.94789],
  ],
  { mode: DistanceModes.DIRECT }
).then((data) => {
  console.log("DistanceMatrix (getPairedPointsDistanceWithLocks):", JSON.stringify(data));
});

Geocode Service

The Geocode service provides functionality to search addresses, places, streets, and administrative areas by name, coordinates, or within/intersected objects.

Request Configs

| Property | Type | Description | | ----------------- | ----------------------------- | ------------------------------------------------------------------------- | | category_action | "exclude" | "include" | Determines how categories are treated in the query (default include). | | format | "csv" \| "json" | Specifies the desired response format (default json). | | lang | "uk" \| "en" | Preferred language for results (default uk). | | country_codes | string[] | Filter results by specific country codes (ISO format, currently available ua). | | categories | GeneralCategories[] \| null | List of categories to filter results. Can be null to disable filtering. | | limit | number | Maximum number of results to return (default 250). | | order | "relevance" \| "distance" | Sorting method for results (default relevance). |

General Categories

Categories list

| Enum Key | Value | Description | | --------------------- | ---------------- | --------------------------------------- | | COUNTRY | adm_country | Country-level administrative units | | DISTRICT | adm_district | General administrative districts | | ADM_LEVEL_1 | adm_level1 | First-level administrative units | | ADM_LEVEL_2 | adm_level2 | Second-level administrative units | | ADM_LEVEL_3 | adm_level3 | Third-level administrative units | | PLACE | adm_place | Specific places or localities | | SETTLEMENT | adm_settlement | Towns, villages, urban-type settlements | | ADDRESS | adr_address | Full address entities | | STREET | adr_street | Street-level features | | HISTORICAL_DISTRICT | hst_district | Historically defined districts | | MAIN_ROAD | roa_road | Major or national roads |

Could be overwritten individually for each method

Geocode.getAddressPointsByName("Велика житомирська", {
  categories: [GeneralCategories.PLACE],
}).then((data) => {
  console.log("Geocode (getAddressPointsByName)", JSON.stringify(data));
});

or for the whole service

Geocode.setCategories([GeneralCategories.PLACE]);

Geocode.getAddressPointsByName

Search address points by name.

Geocode.getAddressPointsByName(address: string, config?: GeocodeRequestConfig): Promise<FeatureArray>

Parameters

| Name | Type | Description | |----------|-------------------------|---------------------------------------| | address| string | Address text to search. | | config | GeocodeRequestConfig (optional) | Optional configuration. |

Example

Geocode.getAddressPointsByName("Велика житомирська").then((data) => {
  console.log("Geocode (getAddressPointsByName)", JSON.stringify(data));
});

Geocode.getAddressPointsByNameNearby

Search address points by name near a specific coordinate.

Geocode.getAddressPointsByNameNearby(address: string, coordinates: GeoJSON.Polygon | GeoJSON.Position | string, zoomLevel?: number, config?: GeocodeRequestConfig): Promise<FeatureArray>

Parameters

| Name | Type | Description | |---------------|---------------------------------------|---------------------------------------------| | address | string | Address text to search. | | coordinates | GeoJSON.Polygon \| GeoJSON.Position \| string | Center point or polygon. | | zoomLevel | number (optional) | Optional zoom level (default: 0). | | config | GeocodeRequestConfig (optional) | Optional configuration. |

Example

Geocode.getAddressPointsByNameNearby("Велика", [30.36277, 50.51605]).then((data) => {
  console.log("Geocode (getAddressPointsByNameNearby)", JSON.stringify(data));
});

Geocode.getAddressNameByPoint

Retrieve address information by point.

Geocode.getAddressNameByPoint(coordinate: GeoJSON.Position, config?: GeocodeRequestConfig): Promise<FeatureArray>

Parameters

| Name | Type | Description | |--------------|-------------------------|------------------------------------| | coordinate | GeoJSON.Position | Coordinate point to lookup. | | config | GeocodeRequestConfig (optional) | Optional configuration. |

Example

Geocode.getAddressNameByPoint([30.16277, 50.31605]).then((data) => {
  console.log("Geocode (getAddressNameByPoint)", JSON.stringify(data));
});

Geocode.getAddressPointsByNameInsideObject

Search address points by name inside a specified polygon.

Geocode.getAddressPointsByNameInsideObject(address: string, containerObject: GeoJSON.Polygon | GeoJSON.Position | string, config?: GeocodeRequestConfig): Promise<FeatureArray>

Parameters

| Name | Type | Description | |-------------------|---------------------------------------|--------------------------------------------| | address | string | Address text to search. | | containerObject | GeoJSON.Polygon \| GeoJSON.Position \| string | Container object for search. | | config | GeocodeRequestConfig (optional) | Optional configuration. |

Example

Geocode.getAddressPointsByNameInsideObject(
  "Велика",
  "POLYGON((30.395737 50.492354,30.550060 50.497487,30.598640 50.426565,30.516586 50.383786,30.380116 50.433126,30.395737 50.492354))"
).then((data) => {
  console.log("Geocode (getAddressPointsByNameInsideObject)", JSON.stringify(data));
});

Geocode.getAddressPointsByNameNearbyInRadius

Search address points by name near a specific coordinate within a defined radius.

Geocode.getAddressPointsByNameNearbyInRadius(address: string, coordinates: GeoJSON.Polygon | GeoJSON.Position | string, zoomLevel?: number, radius?: number, config?: GeocodeRequestConfig): Promise<FeatureArray>

Parameters

| Name | Type | Description | |---------------|---------------------------------------|---------------------------------------------| | address | string | Address text to search. | | coordinates | GeoJSON.Polygon \| GeoJSON.Position \| string | Center point or polygon. | | zoomLevel | number (optional) | Optional zoom level (default: 0). | | radius | number (optional) | Search radius in meters (default: 1000). | | config | GeocodeRequestConfig (optional) | Optional configuration. |

Example

Geocode.getAddressPointsByNameNearbyInRadius("Велика", [30.36277, 50.51605]).then((data) => {
  console.log("Geocode (getAddressPointsByNameNearbyInRadius)", JSON.stringify(data));
});

Geocode.getAddressPointsByNameWithGeometry

Retrieve geometry information for address points by name.

Geocode.getAddressPointsByNameWithGeometry(address: string, config?: GeocodeRequestConfig): Promise<FeaturePointWithGeometry[]>

Parameters

| Name | Type | Description | |-----------|-------------------------|---------------------------------------| | address | string | Address text to search. | | config | GeocodeRequestConfig (optional) | Optional configuration. |

Example

Geocode.getAddressPointsByNameWithGeometry("Велика").then((data) => {
  console.log("Geocode (getAddressPointsByNameWithGeometry)", JSON.stringify(data[0]));
});

Geocode.getAddressPointsByNameWithIntersectedObject

Search address points by name within a specified intersected object.

Geocode.getAddressPointsByNameWithIntersectedObject(address: string, intersectedObject: GeoJSON.Polygon | GeoJSON.Position | string, config?: GeocodeRequestConfig): Promise<FeatureArray>

Parameters

| Name | Type | Description | |---------------------|---------------------------------------|--------------------------------------------| | address | string | Address text to search. | | intersectedObject | GeoJSON.Polygon \| GeoJSON.Position \| string | Object for intersection search. | | config | GeocodeRequestConfig (optional) | Optional configuration. |

Example

Geocode.getAddressPointsByNameWithIntersectedObject("Велика", polygon).then((data) => {
  console.log("Geocode (getAddressPointsByNameWithIntersectedObject)", JSON.stringify(data));
});

Feature Service

The Feature service provides functionality to retrieve detailed information about features by their ID or by a given URL.

Request Configs

| Property | Type | Description | | -------- | ---------------- | ---------------------------------- | | format | "json" \| "csv" | Desired format of the response (default json). | | lang | "uk" \| "en" | Language preference for responses (default uk). |

Feature.getFeatureById

Retrieve a feature by its ID.

Feature.getFeatureById(id: string, config?: FeatureRequestConfig): Promise<FeaturePointWithGeometry>

Parameters

| Name | Type | Description | |---------|----------------------------|---------------------------------| | id | string | Unique identifier of the feature. | | config| FeatureRequestConfig (optional) | Optional configuration. |

Example

Feature.getFeatureById("POIA1KIGKN").then((data) => {
  console.log("Feature (getFeatureById):", JSON.stringify(data));
});

Feature.getFeatureGeometryById

Retrieve a feature's geometry by its ID.

Feature.getFeatureGeometryById(id: string, config?: FeatureRequestConfig): Promise<FeaturePointWithGeometry>

Parameters

| Name | Type | Description | |---------|----------------------------|---------------------------------| | id | string | Unique identifier of the feature. | | config| FeatureRequestConfig (optional) | Optional configuration. |

Example

Feature.getFeatureGeometryById("POIA1KIGKN").then((data) => {
  console.log("Feature (getFeatureGeometryById):", JSON.stringify(data));
});

Feature.getFeatureByGeocodeUrl

Retrieve a feature by providing a direct geocode URL.

Feature.getFeatureByGeocodeUrl(url: string): Promise<FeaturePointWithGeometry>

Parameters

| Name | Type | Description | |-------|----------|--------------------------------------| | url | string | Direct URL to the feature endpoint. |

Example

Feature.getFeatureByGeocodeUrl("https://api.visicom.ua/data-api/5.0/uk/feature/POIA1KIGKN.json").then((data) => {
  console.log("Feature (getFeatureByGeocodeUrl):", JSON.stringify(data));
});

Snap To Road Service

The Snap To Road service allows you to match input coordinates to the nearest road network with optional interpolation.

Request Configs

| Property | Type | Description | | ---------------- | ----------------- | ------------------------------------------------------------ | | shouldSeparate | boolean | If true, results will be returned as separate line segments. | | mode | "driving" \| "walking" | Snapping mode or algorithm to apply (default driving). |

SnapToRoad.snapToRoadSinglePoint

Snap a single point to the nearest road.

SnapToRoad.snapToRoadSinglePoint(point: GeoJSON.Position, interpolate?: boolean, config?: SnapToRoadRequestConfig): Promise<SnapToRoadFeaturePoint>

Parameters

| Name | Type | Description | |----------------|-----------------------------|------------------------------------------------------| | point | GeoJSON.Position | Coordinate to snap to road. | | interpolate | boolean (optional) | Whether to interpolate snapped geometry (default: false). | | config | SnapToRoadRequestConfig (optional) | Optional configuration settings. |

Example

SnapToRoad.snapToRoadSinglePoint([30.36277, 50.51605]).then((data) => {
  console.log("SnapToRoad (snapToRoadSinglePoint):", JSON.stringify(data));
});

SnapToRoad.snapToRoadMultiplePoints

Snap multiple points individually to the nearest roads.

SnapToRoad.snapToRoadMultiplePoints(points: GeoJSON.Position[], config?: SnapToRoadRequestConfig): Promise<SnapToRoadFeatureCollection>

Parameters

| Name | Type | Description | |------------|------------------------|--------------------------------------------------| | points | GeoJSON.Position[] | Array of coordinates to snap. | | config | SnapToRoadRequestConfig (optional) | Optional configuration settings. |

Example

SnapToRoad.snapToRoadMultiplePoints([
  [30.36277, 50.51605],
  [30.49667, 50.49508],
  [30.59761, 50.45226],
  [30.51383, 50.44789]
]).then((data) => {
  console.log("SnapToRoad (snapToRoadMultiplePoints):", JSON.stringify(data));
});

SnapToRoad.snapToRoadMultiplePointsInterpolated

Snap multiple points with interpolation to create smooth paths.

SnapToRoad.snapToRoadMultiplePointsInterpolated(points: GeoJSON.Position[], config?: SnapToRoadRequestConfig): Promise<SnapToRoadFeatureCollectionInterpolated>

Parameters

| Name | Type | Description | |------------|------------------------|--------------------------------------------------| | points | GeoJSON.Position[] | Array of coordinates to snap with interpolation.| | config | SnapToRoadRequestConfig (optional) | Optional configuration settings. |

Example

SnapToRoad.snapToRoadMultiplePointsInterpolated([
  [30.36277, 50.51605],
  [30.49667, 50.49508],
  [30.59761, 50.45226],
  [30.51383, 50.44789]
]).then((data) => {
  console.log("SnapToRoad (snapToRoadMultiplePointsInterpolated):", JSON.stringify(data));
});

Notes

  • Coordinates must follow [longitude, latitude] order.
  • All methods return Promises; use .then() or async/await.
  • Make sure your API key has appropriate permissions.

License

ISC © Visicom


Enjoy using the Visicom Data API SDK.