Die vorliegende Übersetzung wurde maschinell erstellt. Im Falle eines Konflikts oder eines Widerspruchs zwischen dieser übersetzten Fassung und der englischen Fassung (einschließlich infolge von Verzögerungen bei der Übersetzung) ist die englische Fassung maßgeblich.
So zeigen Sie 3D-Funktionen auf einer Karte an
Mit Amazon Location Service können Sie Karten dreidimensionale Funktionen hinzufügen, z. B. Terrain3D um Höhendaten als dreidimensionale Oberfläche anzuzeigen oder Buildings3D um Stadtstrukturen mit Höhe und Volumen darzustellen.
Erstellen Sie eine Karte mit dreidimensionalen Geländedetails
Dieses Beispiel zeigt, wie eine Karte mit einem Terrain3D Parameter erstellt wird.
- index.html
-
<!DOCTYPE html>
<html lang="en">
<head>
<title>3D Terrain</title>
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel='stylesheet' href='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.css' />
<script src='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.js'></script>
</head>
<body style="margin: 0; padding: 0;">
<div id="map" style="width: 100%; height: 100vh;"></div>
<script>
const apiKey = "Add Your Api Key";
const mapStyle = "Standard";
const awsRegion = "us-east-1";
const map = new maplibregl.Map({
container: 'map',
style: `https://maps.geo.${awsRegion}.amazonaws.com/v2/styles/${mapStyle}/descriptor?terrain=Terrain3D&key=${apiKey}`,
center: [7.6583, 45.9763],
zoom: 12,
pitch: 60, // Tilt angle (0-85 degrees)
validateStyle: false, // Disable style validation for faster map load
});
</script>
</body>
</html>
- style.css
-
body {
margin: 0;
padding: 0;
}
#map {
width: 100%;
height: 100vh;
}
Erstellen Sie eine Karte mit dreidimensionalen Gebäudedetails
Dieses Beispiel zeigt, wie eine Karte mit Buildings3D Parametern erstellt wird.
- index.html
-
<!DOCTYPE html>
<html lang="en">
<head>
<title>3D Buildings</title>
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel='stylesheet' href='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.css' />
<script src='https://unpkg.com/maplibre-gl@5.x/dist/maplibre-gl.js'></script>
</head>
<body style="margin: 0; padding: 0;">
<div id="map" style="width: 100%; height: 100vh;"></div>
<script>
const apiKey = "Add Your Api Key";
const mapStyle = "Standard";
const awsRegion = "us-east-1";
const map = new maplibregl.Map({
container: 'map',
style:
`https://maps.geo.${awsRegion}.amazonaws.com/v2/styles/${mapStyle}/descriptor?buildings=Buildings3D&key=${apiKey}`,
center: [7.6583, 45.9763],
zoom: 12,
pitch: 60, // Tilt angle (0-85 degrees)
validateStyle: false, // Disable style validation for faster map load
});
</script>
</body>
</html>
- style.css
-
body {
margin: 0;
padding: 0;
}
#map {
width: 100%;
height: 100vh;
}