Skip to content

Commit 468c0cb

Browse files
committed
Update tutorial-ev-routing.md
1 parent c7b4b40 commit 468c0cb

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

articles/azure-maps/tutorial-ev-routing.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ constantSpeedConsumptionInkWhPerHundredkm="50,8.2:130,21.3"
119119

120120

121121
# Get boundaries for the electric vehicle's reachable range.
122-
routeRangeResponse = await (await session.get("https://atlas.microsoft.com/route/range/json?subscription-key={Your-Azure-Maps-Subscription-key}&api-version=1.0&query={}&travelMode={}&vehicleEngineType={}&currentChargeInkWh={}&maxChargeInkWh={}&timeBudgetInSec={}&routeType={}&constantSpeedConsumptionInkWhPerHundredkm={}"
122+
routeRangeResponse = await (await session.get("https://atlas.microsoft.com/route/range/json?subscription-key={}&api-version=1.0&query={}&travelMode={}&vehicleEngineType={}&currentChargeInkWh={}&maxChargeInkWh={}&timeBudgetInSec={}&routeType={}&constantSpeedConsumptionInkWhPerHundredkm={}"
123123
.format(subscriptionKey,str(currentLocation[0])+","+str(currentLocation[1]),travelMode, vehicleEngineType, currentChargeInkWh, maxChargeInkWh, timeBudgetInSec, routeType, constantSpeedConsumptionInkWhPerHundredkm))).json()
124124

125125
polyBounds = routeRangeResponse["reachableRange"]["boundary"]
@@ -153,7 +153,7 @@ To search for electric vehicle charging stations within the reachable range, run
153153

154154
```python
155155
# Search for electric vehicle stations within reachable range.
156-
searchPolyResponse = await (await session.post(url = "https://atlas.microsoft.com/search/geometry/json?subscription-key={Your-Azure-Maps-Subscription-key}&api-version=1.0&query=electric vehicle station&idxSet=POI&limit=50".format(subscriptionKey), json = boundsData)).json()
156+
searchPolyResponse = await (await session.post(url = "https://atlas.microsoft.com/search/geometry/json?subscription-key={}&api-version=1.0&query=electric vehicle station&idxSet=POI&limit=50".format(subscriptionKey), json = boundsData)).json()
157157

158158
reachableLocations = []
159159
for loc in range(len(searchPolyResponse["results"])):
@@ -186,9 +186,9 @@ rangeData = {
186186
}
187187

188188
# Upload the range data to Azure Maps Data service.
189-
uploadRangeResponse = await session.post("https://us.atlas.microsoft.com/mapData?subscription-key={Your-Azure-Maps-Subscription-key}&api-version=2.0&dataFormat=geojson".format(subscriptionKey), json = rangeData)
189+
uploadRangeResponse = await session.post("https://us.atlas.microsoft.com/mapData?subscription-key={}&api-version=2.0&dataFormat=geojson".format(subscriptionKey), json = rangeData)
190190

191-
rangeUdidRequest = uploadRangeResponse.headers["Location"]+"&subscription-key={Your-Azure-Maps-Subscription-key}".format(subscriptionKey)
191+
rangeUdidRequest = uploadRangeResponse.headers["Location"]+"&subscription-key={}".format(subscriptionKey)
192192

193193
while True:
194194
getRangeUdid = await (await session.get(rangeUdidRequest)).json()
@@ -215,9 +215,9 @@ poiData = {
215215
}
216216

217217
# Upload the electric vehicle charging station data to Azure Maps Data service.
218-
uploadPOIsResponse = await session.post("https://us.atlas.microsoft.com/mapData?subscription-key={Your-Azure-Maps-Subscription-key}&api-version=2.0&dataFormat=geojson".format(subscriptionKey), json = poiData)
218+
uploadPOIsResponse = await session.post("https://us.atlas.microsoft.com/mapData?subscription-key={}&api-version=2.0&dataFormat=geojson".format(subscriptionKey), json = poiData)
219219

220-
poiUdidRequest = uploadPOIsResponse.headers["Location"]+"&subscription-key={Your-Azure-Maps-Subscription-key}".format(subscriptionKey)
220+
poiUdidRequest = uploadPOIsResponse.headers["Location"]+"&subscription-key={}".format(subscriptionKey)
221221

222222
while True:
223223
getPoiUdid = await (await session.get(poiUdidRequest)).json()
@@ -260,7 +260,7 @@ pins = "custom|an15 53||udid-{}||https://raw.githubusercontent.com/Azure-Samples
260260
encodedPins = urllib.parse.quote(pins, safe='')
261261

262262
# Render the range and electric vehicle charging points on the map.
263-
staticMapResponse = await session.get("https://atlas.microsoft.com/map/static/png?api-version=1.0&subscription-key={Your-Azure-Maps-Subscription-key}&pins={}&path={}&bbox={}&zoom=12".format(subscriptionKey,encodedPins,path,str(minLon)+", "+str(minLat)+", "+str(maxLon)+", "+str(maxLat)))
263+
staticMapResponse = await session.get("https://atlas.microsoft.com/map/static/png?api-version=1.0&subscription-key={}&pins={}&path={}&bbox={}&zoom=12".format(subscriptionKey,encodedPins,path,str(minLon)+", "+str(minLat)+", "+str(maxLon)+", "+str(maxLat)))
264264

265265
poiRangeMap = await staticMapResponse.content.read()
266266

@@ -290,7 +290,7 @@ locationData = {
290290
}
291291

292292
# Get the travel time and distance to each specified charging station.
293-
searchPolyRes = await (await session.post(url = "https://atlas.microsoft.com/route/matrix/json?subscription-key={Your-Azure-Maps-Subscription-key}&api-version=1.0&routeType=shortest&waitForResults=true".format(subscriptionKey), json = locationData)).json()
293+
searchPolyRes = await (await session.post(url = "https://atlas.microsoft.com/route/matrix/json?subscription-key={}&api-version=1.0&routeType=shortest&waitForResults=true".format(subscriptionKey), json = locationData)).json()
294294

295295
distances = []
296296
for dist in range(len(reachableLocations)):
@@ -310,7 +310,7 @@ To get the route to the charging station and to parse the response to create a g
310310

311311
```python
312312
# Get the route from the electric vehicle's current location to the closest charging station.
313-
routeResponse = await (await session.get("https://atlas.microsoft.com/route/directions/json?subscription-key={Your-Azure-Maps-Subscription-key}&api-version=1.0&query={}:{}".format(subscriptionKey, str(currentLocation[0])+","+str(currentLocation[1]), closestChargeLoc))).json()
313+
routeResponse = await (await session.get("https://atlas.microsoft.com/route/directions/json?subscription-key={}&api-version=1.0&query={}:{}".format(subscriptionKey, str(currentLocation[0])+","+str(currentLocation[1]), closestChargeLoc))).json()
314314

315315
route = []
316316
for loc in range(len(routeResponse["routes"][0]["legs"][0]["points"])):
@@ -332,9 +332,9 @@ To get an image for the rendered route on the map, run the following script:
332332

333333
```python
334334
# Upload the route data to Azure Maps Data service .
335-
routeUploadRequest = await session.post("https://atlas.microsoft.com/mapData?subscription-key={Your-Azure-Maps-Subscription-key}&api-version=2.0&dataFormat=geojson".format(subscriptionKey), json = routeData)
335+
routeUploadRequest = await session.post("https://atlas.microsoft.com/mapData?subscription-key={}&api-version=2.0&dataFormat=geojson".format(subscriptionKey), json = routeData)
336336

337-
udidRequestURI = routeUploadRequest.headers["Location"]+"&subscription-key={Your-Azure-Maps-Subscription-key}".format(subscriptionKey)
337+
udidRequestURI = routeUploadRequest.headers["Location"]+"&subscription-key={}".format(subscriptionKey)
338338

339339
while True:
340340
udidRequest = await (await session.get(udidRequestURI)).json()
@@ -367,7 +367,7 @@ minLat -= latBuffer
367367
maxLat += latBuffer
368368

369369
# Render the route on the map.
370-
staticMapResponse = await session.get("https://atlas.microsoft.com/map/static/png?api-version=1.0&subscription-key={Your-Azure-Maps-Subscription-key}&&path={}&pins={}&bbox={}&zoom=16".format(subscriptionKey,path,pins,str(minLon)+", "+str(minLat)+", "+str(maxLon)+", "+str(maxLat)))
370+
staticMapResponse = await session.get("https://atlas.microsoft.com/map/static/png?api-version=1.0&subscription-key={}&&path={}&pins={}&bbox={}&zoom=16".format(subscriptionKey,path,pins,str(minLon)+", "+str(minLat)+", "+str(maxLon)+", "+str(maxLat)))
371371

372372
staticMapImage = await staticMapResponse.content.read()
373373

0 commit comments

Comments
 (0)