Skip to content

Commit 1d3d52a

Browse files
committed
Services Module
1 parent 6a2c3b5 commit 1d3d52a

26 files changed

Lines changed: 430 additions & 352 deletions

File tree

‎Samples/3D-layer/three.js/three.js.html‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,10 @@
194194
});
195195
}
196196

197-
window.GetMap = GetMap;
197+
window.getMap = getMap;
198198
</script>
199199
</head>
200-
<body onload="window.GetMap()">
200+
<body onload="window.getMap()">
201201
<div id="map" style="position:relative;width:100%;min-width:290px;height:600px;background-color:gray"></div>
202202

203203
<fieldset style="width:calc(100% - 30px);min-width:290px;margin-top:10px;">

‎Samples/Animations/Animate a Line/Animate a Line.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@
145145
}
146146
</style>
147147
</head>
148-
<body onload='GetMap()'>
148+
<body onload='getMap()'>
149149
<div id='myMap'></div>
150150

151151
<button id="pause">pause</button>

‎Samples/Animations/HTML Marker Pulse Animation/HTML Marker Pulse Animation.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
}
8989
</style>
9090
</head>
91-
<body onload='GetMap()'>
91+
<body onload='getMap()'>
9292
<div id="myMap" style="position:relative;width:100%;min-width:290px;height:600px;"></div>
9393

9494
<fieldset style="width:calc(100% - 30px);min-width:290px;margin-top:10px;">

‎Samples/Animations/Simple HTML Marker Animation/Simple HTML Marker Animation.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
}
8484
</style>
8585
</head>
86-
<body onload='GetMap()'>
86+
<body onload='getMap()'>
8787
<div id="myMap" style="position:relative;width:100%;min-width:290px;height:600px;"></div>
8888

8989
<fieldset style="width:calc(100% - 30px);min-width:290px;margin-top:10px;">

‎Samples/Animations/Simple Symbol Animation/Simple Symbol Animation.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
}
9393
</script>
9494
</head>
95-
<body onload='GetMap()'>
95+
<body onload='getMap()'>
9696
<div id="myMap" style="position:relative;width:100%;min-width:290px;height:600px;"></div>
9797

9898
<fieldset style="width:calc(100% - 30px);min-width:290px;margin-top:10px;">

‎Samples/Demos/Car vs Truck Route/Car vs Truck Route.html‎

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<meta name="description" content="This sample compares the route a truck has to take to the route a car can take." />
1111
<meta name="keywords" content="Microsoft maps, map, gis, API, SDK, truck, car, routing, route, directions" />
1212
<meta name="author" content="Microsoft Azure Maps" />
13-
<meta name="version" content="1.0" />
13+
<meta name="version" content="2.0" />
1414
<meta name="screenshot" content="screenshot.jpg" />
1515

1616
<!-- Add references to the Azure Maps Map control JavaScript and CSS files. -->
@@ -34,24 +34,37 @@
3434
{ from: '40.429993,-79.998690', to: '40.414211,-80.009550', height: '', width: '', length: '', weight: '', load: ['USHazmatClass3'], description: 'Flammable load', streetsideLink: 'https://binged.it/2hd6P3s' }
3535
];
3636

37+
// Your Azure Maps client id for accessing your Azure Maps account.
38+
var azureMapsClientId = 'e6b6ab59-eb5d-4d25-aa57-581135b927f0';
39+
40+
// URL to your authentication service that retrieves an Microsoft Entra ID Token.
41+
var tokenServiceUrl = 'https://samples.azuremaps.com/api/GetAzureMapsToken';
42+
43+
// Function to retrieve an Azure Maps access token.
44+
function getToken(resolve, reject, map) {
45+
fetch(tokenServiceUrl).then(response => {
46+
if (response.ok) {
47+
return response.text();
48+
}
49+
throw new Error('Failed to retrieve Azure Maps token.');
50+
}).then(token => resolve(token)).catch(error => reject(error));
51+
}
52+
3753
function getMap() {
3854
//Initialize a map instance.
3955
map = new atlas.Map('myMap', {
4056
view: 'Auto',
4157

42-
//Add authentication details for connecting to Azure Maps.
58+
// Add authentication details for connecting to Azure Maps.
4359
authOptions: {
44-
//Use Microsoft Entra ID authentication.
60+
// Use Microsoft Entra ID authentication.
4561
authType: 'anonymous',
46-
clientId: 'e6b6ab59-eb5d-4d25-aa57-581135b927f0', //Your Azure Maps client id for accessing your Azure Maps account.
47-
getToken: function (resolve, reject, map) {
48-
//URL to your authentication service that retrieves an Microsoft Entra ID Token.
49-
var tokenServiceUrl = 'https://samples.azuremaps.com/api/GetAzureMapsToken';
50-
51-
fetch(tokenServiceUrl).then(r => r.text()).then(token => resolve(token));
52-
}
62+
clientId: azureMapsClientId,
63+
getToken: getToken
5364

54-
//Alternatively, use an Azure Maps key. Get an Azure Maps key at https://azure.com/maps. NOTE: The primary key should be used as the key.
65+
// Alternatively, use an Azure Maps key.
66+
// Get an Azure Maps key at https://azure.com/maps.
67+
// NOTE: The primary key should be used as the key.
5568
//authType: 'subscriptionKey',
5669
//subscriptionKey: '[YOUR_AZURE_MAPS_KEY]'
5770
}

Samples/Drawing Tools Module/Draw and search polygon area/Draw and search polygon area.html renamed to Samples/Drawing Tools Module/Draw and search polygon area_experimental/Draw and search polygon area.html

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,29 @@
129129
var center = searchArea.getCoordinates();
130130

131131
//Search for POI's within a radius.
132-
searchURL.searchPOI(atlas.service.Aborter.timeout(3000), query, {
133-
lon: center[0],
134-
lat: center[1],
135-
radius: searchArea.getProperties().radius,
136-
limit: 100,
137-
view: 'Auto'
138-
}).then(showResults, error => {
132+
var searchPOIRequest = searchPOIUrl
133+
.replace('{query}', query)
134+
.replace('{lon}', center[0])
135+
.replace('{lat}', center[1])
136+
.replace('{radius}', searchArea.getProperties().radius)
137+
.replace('{limit}', 100);
138+
139+
processRequest(searchPOIRequest).then((response) => {
140+
datasource.add(response);
141+
}).catch((error) => {
139142
alert(error);
140143
});
144+
145+
146+
//searchURL.searchPOI(atlas.service.Aborter.timeout(3000), query, {
147+
// lon: center[0],
148+
// lat: center[1],
149+
// radius: searchArea.getProperties().radius,
150+
// limit: 100,
151+
// view: 'Auto'
152+
//}).then(showResults, error => {
153+
// alert(error);
154+
//});
141155
} else {
142156
var body = searchArea.toJson();
143157

Samples/Drawing Tools Module/Draw and search polygon area/screenshot.jpg renamed to Samples/Drawing Tools Module/Draw and search polygon area_experimental/screenshot.jpg

File renamed without changes.

‎Samples/Drawing Tools Module/Snap drawn line to roads/Snap drawn line to roads.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<meta name="description" content=" This sample shows how to snap a line drawn using the drawing tools to the road network. " />
1111
<meta name="keywords" content="Microsoft maps, map, gis, API, SDK, services, module, route, directions, snap to roads, snapping, gps traces, gps trace, snap to road" />
1212
<meta name="author" content="Microsoft Azure Maps" />
13-
<meta name="version" content="1.0" />
13+
<meta name="version" content="2.0" />
1414
<meta name="screenshot" content="screenshot.jpg" />
1515

1616
<!-- Add references to the Azure Maps Map control JavaScript and CSS files. -->

‎Samples/HTML Markers/CSS Styled HTML Marker/CSS Styled HTML Marker.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150
}
151151
</style>
152152
</head>
153-
<body onload='GetMap()'>
153+
<body onload='getMap()'>
154154
<div id="myMap" style="position:relative;width:100%;min-width:290px;height:600px;"></div>
155155

156156
<fieldset style="width:calc(100% - 30px);min-width:290px;margin-top:10px;">

0 commit comments

Comments
 (0)