![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
@cedarstudios/cedarmaps
Advanced tools
A node.js and browser JavaScript client to CedarMaps services.
A node.js and browser JavaScript client to CedarMaps services.
$ npm i @cedarstudios/cedarmaps
In order to use CedarMaps' API, you MUST have an access token. Get one from CedarMaps website (Menu link: "درخواست اکانت رایگان"). It may take a couple of hours until your request is processed and your credentials are emailed to you.
const cedarMaps = require('@cedarstudios/cedarmaps');
const client = cedarMaps('<YOUR ACCESS TOKEN>'); // Get your token from cedarmaps.com
Signature: client.forwardGeocoding(queryString, searchIndex, filters, callback)
Options | Value | Description |
---|---|---|
queryString (required) | String | a query, expressed as a string, like 'ونک'. This string MUST be URI encoded. Use encodeURIComponent('ونک') for example. |
searchIndex (required) | String | Available profiles:
|
filters | Object | Example: { distance: 0.5, limit: 5 } . Available filters:
|
callback (required) | Function | A callback with passed params: (error, result) . |
Sample usage:
client.forwardGeocoding(encodeURIComponent('ونک'), 'cedarmaps.streets', {type: 'roundabout'}, (err, res) => {console.log(res);});
Signature: client.reverseGeocoding(location, options, callback)
Queries the reverse geocoder with a location and returns the address in desired format.
Options | Value | Description |
---|---|---|
location (required) | Mixed | A point can be formatted in one of the forms below:
|
options | Object |
|
callback (required) | Function | A callback with passed params: (error, result) . |
Sample usage:
client.reverseGeocoding([35.76312468, 51.40292645], {verbosity: true}, (err, res) => { console.log(res) });
Signature: client.distance(points, callback)
Travel-time and distance between up to 100 pairs of origin and destination, in one single request.
Options | Value | Description |
---|---|---|
points (required) | Array | An Array of {lat,lon} pairs. Example: [{ lat: 35.76312468, lon: 51.40292645 }, { lat: 35.76288091, lon: 51.37305737}] |
callback (required) | Function | A callback with passed params: (error, result) . |
Reponse object description:
Key | Description |
---|---|
distance | The total distance of the route, in Meters. |
time | The total time of the route, in Milliseconds. |
bbox | The bounding box of the route, format: minLon, minLat, maxLon, maxLat. |
Sample usage:
client.distance([{ lat: 35.76312468, lon: 51.40292645 }, { lat: 35.76288091, lon: 51.37305737}], (err, res) => {console.log(res)});
Signature: client.direction(points, options, callback)
Calculates the optimal driving routes between two or more points. (Shortest path)
Note: The number of provided points must be even.
Options | Value | Description |
---|---|---|
points (required) | Array | An Array of {lat,lon} pairs. Example: [{ lat: 35.76312468, lon: 51.40292645 }, { lat: 35.76288091, lon: 51.37305737}] |
options | Object | The only available option for now is instructions (Boolean) which adds driving instructions object to the response. |
callback (required) | Function | A callback with passed params: (error, result) . |
Sample usage:
client.direction([{ lat: 35.76312468, lon: 51.40292645 }, { lat: 35.76288091, lon: 51.37305737 }], {instructions: true}, (err, res) => { console.log(err, res) })
Reponse object description:
Key | Description |
---|---|
distance | The total distance of the route, in Meters. |
time | The total time of the route, in Milliseconds. |
bbox | The bounding box of the route, format: minLon, minLat, maxLon, maxLat. |
geometry | The geometry of the route as a GeoJSON LineString. |
Here's the intructions
object description:
Note: The last item in instructions array is the stop item with distance
and time
values of 0
.
Key | Description |
---|---|
text | Descriptive text of the instruction. |
street_name | The name of the street to turn onto in order to follow the route. |
distance | The distance for this instruction, in Meters. |
time | The duration for this instruction, in Milliseconds. |
interval | An array containing the first and the last index (relative to geometry.coordinates) of the points for this instruction. This is useful to know for which part of the route the instructions are valid. |
sign | A number representing actions that should be taken to follow the instructions. You may use this number for determining the action icon in your interface, or voice instructions, etc.:
|
Signature: client.tile(profile)
TileJSON is a format that manages the complexities of custom maps. It organizes zoom levels, center points, legend contents, and more, into a format that makes it easy to display a map.
In order to get CedarMaps tiles you need to have their specification and then pass these info to your favorite map libarary (Leaflet, OpenLayers, etc.).
For instance, in our cedarmaps-web-sdk-raster you use this TileJSON url for displaying map tiles.
Options | Value | Description |
---|---|---|
profile (required) | String | Only available option is cedarmaps.streets for now. |
Sample Response:
{
"tilejson": "2.2.0",
"name": "cedarmaps.streets",
"version": "3.0",
"description": "CedarMaps covers the whole world in general and Iran in details",
"tiles": [
"https://api.cedarmaps.com/v1/tiles/cedarmaps.streets/{z}/{x}/{y}.png?access_token=<your access token>"
],
"attribution": "<a href=\"https://www.cedarmaps.com\">CedarMaps</a>",
"minzoom": 0,
"maxzoom": 17,
"bounds": [-180, -90, 180, 90]
}
Sample usage:
client.tile('cedarmaps.streets', (err, res) => { console.log(err, res)});
If you have any questions while implementing Cedar Maps Web SDK, please feel free to open a new issue.
FAQs
A node.js and browser JavaScript client to CedarMaps services.
The npm package @cedarstudios/cedarmaps receives a total of 4 weekly downloads. As such, @cedarstudios/cedarmaps popularity was classified as not popular.
We found that @cedarstudios/cedarmaps demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.