Tagged: 

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #10459
    Michel Castaño
    Keymaster

    1. Organize your points starting with departure point, ending with arrival point and with checkpoints in between as in the example below:

     

    2. Organize them as in the following GET url. Make sure your API KEY has routes Enabled:

    https://maps.googleapis.com/maps/api/directions/json
    origin=-33.3089255,-70.7204965&destination=-33.4102076,-70.5709049
    &waypoints=-33.562885,-70.624062|-33.567043,-70.672501|-33.526806,-70.610039|-33.594982,-70.70269|-33.585438,-70.628098|-33.596413,-70.705208|-33.51741,-70.681351|-33.515694,-70.658295|-33.615452,-70.70726|-33.53669,-70.664352|-33.499542,-70.688522|-33.545845,-70.64592
    &departure_time=now
    &key=YOUR_API_KEY

    More information regarding Routes – Polylines here.

    3. Obtain the polyline from the response to the GET above:
    overview_polyline: {
    points: "tshjEdrsnLlHhWoApCoRpIwl@tRa@sDlErIcFbAbR{KhuBkt@hvCubAppFmkBjpBg}@xVoKhe@_D|f@kFvVcZ|OgLfEwK|Osj@dZwL|f@_Dv^hDxa@_Gt
    @eLhOiBpeA{@dIMpO_IpSzAnqBzt@hbFvmB~BxDaBa@d]ibBxRuwAvJgoAlC}ZfCiDpI_At[_Dly@}KxD}@eCeRoAmKNaLdJoApKqAjA|LpFaAdHZbAWwE|s@yErt@}JpxA{Drd@aBvQg@vFhCtBdU~D|YzEer@kMub@iIwUoE}CxXwYeT{TcP{N{DkKeBSqIxD}@bXskDaLeeB}CmJyMoJyv@}c@qC{BhAgM@GK~EyEjIaIlMxAjMniA|CfMfOdEn@pCr@lCjd@eBdWaK|yAaLxkAs_@hkBoKfXnEJ~\lNr\xQ~f@_Atb@z@nOjTp{AfKl_BnPxFCnBu]jJ_m@t@mFx@cGfItBbJlBvCdF}@|HsLsAoCu@aJwCqW_UyOoKm_@aWuI}GN{e@dPej@nJoi@OcfB|FauArCql@lBif@eDAuCka@_BkT_MRt@tK|Dbl@x}@cEhOs@dJx@aBtf@{Axd@yDvlAaP|wB_Jo@Azd@oPzmAoBxHhQzGx[fIaBhKwFz@}HmBmMyCiL}C_GpRyIjn@ar@eAokA{Jq{@wHyQkOi_@ms@sk@_gAsQsLq~Air@kMmFaGbJgLhQi@jChCyKdJaIdE_GqKmHsXmKwPeGtF{XxGy[xGyXgJ}B{ErBiJd@cDjOkA|FrCvD_@dEAjFhFnBvLnEjl@nThvAjk@~\xNx_@xm@z{@lcB|UDbs@tFvvClTprAfJt[BBsClGq@O_C~@iX|BoHbAuErBkHsBjHcAtEeBlFWCeBrXyRv@}g@rAe_H_g@sQyLy^sr@uj@yfAqRiPgk@uVaJiErBeWpBcJzCkAjBn@tHe]~Hw]jBsB\zC{Gl]sXdnAoa@tiAkW|^_HnKeLlD}x@_Yoa@cRcFqGlCcUuOeG_E}AvMfFpIbDaFzSzAzClHtCbZhLpKfEbD|Dh@nBxLdDji@lTgCjAnDsRvVk]na@gfAxSes@jMcp@~RqlAnKsgA^iDnJfAfLvAB~FzB_ClAeTpAeQr@kJ\mEsDFeGL_KIoBaAZsGn@cK@eb@iMc}Am_@eYgbAol@i@_`@q[{U{ZgKkh@eHwrA{n@svAgRmpA{UwRkH{]uHyPyA}KxAcg@~EuhAjL}[nD}YfXie@xVaE~AcByEuH|CuKab@gK}f@Mq@"
    },

     

    4. Create a payload with the points. and with the polyline created above:
    {
    "color": "#CD0A0A",
    "description": "Recorrido farmacias",
    "checkpoints": [
    {
    "name": "CD MEDIVEN",
    "buffer": 50,
    "lat": -33.3089255,
    "lon": -70.7204965
    },
    {
    "name": "FARMACIA GABRIELA",
    "buffer": 50,
    "lat": -33.562885,
    "lon": -70.624062
    },
    {
    "name": "FARMACIA SANTA ANITA",
    "buffer": 50,
    "lat": -33.567043,
    "lon": -70.672501
    },
    {
    "name": "FARMACIA BUENA SALUD LOCAL 1",
    "buffer": 50,
    "lat": -33.526806,
    "lon": -70.610039
    },
    {
    "name": "FARMACIA LOS ROBLES LOCAL N° 1",
    "buffer": 50,
    "lat": -33.594982,
    "lon": -70.70269
    },
    {
    "name": "FARMACIA CURMAN LOCAL Nº 1",
    "buffer": 50,
    "lat": -33.585438,
    "lon": -70.628098
    },
    {
    "name": "FARMACIA LIFEPHARMACY",
    "buffer": 50,
    "lat": -33.596413,
    "lon": -70.705208
    },
    {
    "name": "FARMACIA LA ERA ARCAYA",
    "buffer": 50,
    "lat": -33.51741,
    "lon": -70.681351
    },
    {
    "name": "FARMACIA C.A LOCAL N° 4 (LA CISTERNA)",
    "buffer": 50,
    "lat": -33.515694,
    "lon": -70.658295
    },
    {
    "name": "FARMACIAS ALEM",
    "buffer": 50,
    "lat": -33.615452,
    "lon": -70.70726
    },
    {
    "name": "FARMACIA BIENESTAR (LA CISTERNA)",
    "buffer": 50,
    "lat": -33.53669,
    "lon": -70.664352
    },
    {
    "name": "FARMACIA CARDENAL CARO",
    "buffer": 50,
    "lat": -33.499542,
    "lon": -70.688522
    },
    {
    "name": "FARMACIAS 24 LOCAL N° 2",
    "buffer": 50,
    "lat": -33.545845,
    "lon": -70.64592
    },
    {
    "name": "EJEMPLO TERMINO",
    "buffer": 50,
    "lat": -33.4102076,
    "lon": -70.5709049
    }
    ],
    "schedules": [
    {
    "active": true,
    "timezone": "America/Mexico_City",
    "repeat": "Fri",
    "valid_until": "2020-06-26T23:59:59",
    "checkpoints": [
    {
    "max_duration": 0,
    "min_duration": 0,
    "optional": false,
    "time": "12:30"
    },
    {
    "max_duration": 0,
    "min_duration": 0,
    "optional": false,
    "time": null
    },
    {
    "max_duration": 0,
    "min_duration": 0,
    "optional": false,
    "time": null
    },
    {
    "max_duration": 0,
    "min_duration": 0,
    "optional": false,
    "time": null
    },
    {
    "max_duration": 0,
    "min_duration": 0,
    "optional": false,
    "time": null
    },
    {
    "max_duration": 0,
    "min_duration": 0,
    "optional": false,
    "time": null
    },
    {
    "max_duration": 0,
    "min_duration": 0,
    "optional": false,
    "time": null
    },
    {
    "max_duration": 0,
    "min_duration": 0,
    "optional": false,
    "time": null
    },
    {
    "max_duration": 0,
    "min_duration": 0,
    "optional": false,
    "time": null
    },
    {
    "max_duration": 0,
    "min_duration": 0,
    "optional": false,
    "time": null
    },
    {
    "max_duration": 0,
    "min_duration": 0,
    "optional": false,
    "time": null
    },
    {
    "max_duration": 0,
    "min_duration": 0,
    "optional": false,
    "time": null
    },
    {
    "max_duration": 0,
    "min_duration": 0,
    "optional": false,
    "time": null
    },
    {
    "max_duration": 0,
    "min_duration": 0,
    "optional": false,
    "time": "13:30"
    }
    ]
    }
    ],
    "active": true,
    "path": {
    "buffer": 50,
    "encoding": "tshjEdrsnLlHhWoApCoRpIwl@tRa@sDlErIcFbAbR{KhuBkt@hvCubAppFmkBjpBg}@xVoKhe@_D|f@kFvVcZ|OgLfEwK|Osj@dZwL|f@_Dv^hDxa@_Gt
    @eLhOiBpeA{@dIMpO_IpSzAnqBzt@hbFvmB~BxDaBa@d]ibBxRuwAvJgoAlC}ZfCiDpI_At[_Dly@}KxD}@eCeRoAmKNaLdJoApKqAjA|LpFaAdHZbAWwE|s@yErt@}JpxA{Drd@aBvQg@vFhCtBdU~D|YzEer@kMub@iIwUoE}CxXwYeT{TcP{N{DkKeBSqIxD}@bXskDaLeeB}CmJyMoJyv@}c@qC{BhAgM@GK~EyEjIaIlMxAjMniA|CfMfOdEn@pCr@lCjd@eBdWaK|yAaLxkAs_@hkBoKfXnEJ~\lNr\xQ~f@_Atb@z@nOjTp{AfKl_BnPxFCnBu]jJ_m@t@mFx@cGfItBbJlBvCdF}@|HsLsAoCu@aJwCqW_UyOoKm_@aWuI}GN{e@dPej@nJoi@OcfB|FauArCql@lBif@eDAuCka@_BkT_MRt@tK|Dbl@x}@cEhOs@dJx@aBtf@{Axd@yDvlAaP|wB_Jo@Azd@oPzmAoBxHhQzGx[fIaBhKwFz@}HmBmMyCiL}C_GpRyIjn@ar@eAokA{Jq{@wHyQkOi_@ms@sk@_gAsQsLq~Air@kMmFaGbJgLhQi@jChCyKdJaIdE_GqKmHsXmKwPeGtF{XxGy[xGyXgJ}B{ErBiJd@cDjOkA|FrCvD_@dEAjFhFnBvLnEjl@nThvAjk@~\xNx_@xm@z{@lcB|UDbs@tFvvClTprAfJt[BBsClGq@O_C~@iX|BoHbAuErBkHsBjHcAtEeBlFWCeBrXyRv@}g@rAe_H_g@sQyLy^sr@uj@yfAqRiPgk@uVaJiErBeWpBcJzCkAjBn@tHe]~Hw]jBsB\zC{Gl]sXdnAoa@tiAkW|^_HnKeLlD}x@_Yoa@cRcFqGlCcUuOeG_E}AvMfFpIbDaFzSzAzClHtCbZhLpKfEbD|Dh@nBxLdDji@lTgCjAnDsRvVk]na@gfAxSes@jMcp@~RqlAnKsgA^iDnJfAfLvAB~FzB_ClAeTpAeQr@kJ\mEsDFeGL_KIoBaAZsGn@cK@eb@iMc}Am_@eYgbAol@i@_`@q[{U{ZgKkh@eHwrA{n@svAgRmpA{UwRkH{]uHyPyA}KxAcg@~EuhAjL}[nD}YfXie@xVaE~AcByEuH|CuKab@gK}f@Mq@"
    },
    "name": "Farmacias"
    }`

     

    5. Send a POST to /api/entities/{{vehicle.id}}/routes with the payload created above:

    Example: https://pegasus1.pegasusgateway.com/api/entities/2070/routes

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.