Download the PHP package cedarmaps/cedarmaps-php-sdk without Composer
On this page you can find all versions of the php package cedarmaps/cedarmaps-php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cedarmaps/cedarmaps-php-sdk
More information about cedarmaps/cedarmaps-php-sdk
Files in cedarmaps/cedarmaps-php-sdk
Package cedarmaps-php-sdk
Short Description A PHP Wrapper for CedarMaps API
License MIT
Homepage https://github.com/sinaabadi/cedarmaps-php-sdk
Informations about the package cedarmaps-php-sdk
cedar-maps
A mapping service and highly detailed and spatially accurate GIS vector data application that covers the whole country of Iran.
Install
Getting Started
Getting Access Token
You should have a client_id
and client_secret
in order to get an access_token.
API
getForwardGeocoding(query, index, filters)
input
query: string
, URL-encoded text [REQUIRED]
index: Pick from CedarMaps::Constants['INDEXES'] for example CedarMaps::Constants['INDEXES']['STREET_INDEX']
filters:
Param | Type | Description |
---|---|---|
limit | integer | Max is 30 |
distance | float | Unit is km, 0.1 means 100 meters |
location | Array: ['lat' => |
Center point of a nearby search. should be accompanied with distance param |
type | Array | Pick from CedarMaps::Constants['FORWARD_GEOCODE']['TYPE'] |
ne | Array: ['lat' => |
Specifies north east of the bounding box - should be accompanied with sw param |
sw | Array: ['lat' => |
Specifies south west of the bounding box - should be accompanied with ne param |
Sample Response:
getReverseGeocoding(lat, lon, index)
It gives you an address based on a provided LatLng pair.
input
lat: number
, Latitude [REQUIRED]
long: number
, Longitude [REQUIRED]
index: Pick from CedarMaps::Constants['INDEXES'] for example CedarMaps::Constants['INDEXES']['STREET_INDEX']
Sample Response:
getDistance(points)
This method calculates the distance between points in meters. It can be called with up to 100 different points in a single request.
input
points: array
, Array of point Arrays ['lat' => <SOME_LATITUDE>,'lon' => SOME_LONGITUDE]
[REQUIRED]
Response Elements:
Param | Description |
---|---|
distance | The overall distance of the route, in meter |
time | The overall time of the route, in ms |
bbox | The bounding box of the route, format: minLon, minLat, maxLon, maxLat |
Sample Response:
getDirection(points, options)
This method calculates the optimal driving routes between two or more points.
input
points: Array
, Array: ['lat' => <SOME_LATITUDE>,'lon' => SOME_LONGITUDE]
[REQUIRED]
options: Array of options like ['instructions' => true]
Currently the only option is instructions
that is boolean
Example
Response Elements:
Param | Description |
---|---|
distance | The overall distance of the route, in meter |
time | The overall time of the route, in ms |
bbox | The bounding box of the route, format: minLon, minLat, maxLon, maxLat |
geometry | The geometry of the route as a GeoJSON LineString |
Sample Response:
Turn-by-turn Navigation
In order to get turn-by-turn instructions you should include {instructions:true} as option.
Response elements when instructions option provided:
Param | Description |
---|---|
instructions | Instructions for this route. The last instruction is always the Finish instruction and takes 0ms and 0meter |
instructions[].text | A description what the user has to do in order to follow the route |
instructions[].street_name | The name of the street to turn onto in order to follow the route |
instructions[].distance | The distance for this instruction, in meter |
instructions[].time | The duration for this instruction, in ms |
instructions[].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 |
instructions[].sign | A number which specifies the sign to show
|
Sample Response when instructions option provided:
getTileJson(mapId)
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.
input
mapId: string
, Cedar map ID [REQUIRED]
Sample Response:
Constants
License
MIT © Cedar Maps