我被要求制作一个应用程序,帮助学生以最短的路线导航到学术区内的班级。然而问题是,如何创建这样的地图,其中有房间,楼层,如果可能的话,校园内所有建筑物的详细室内地图?
答案 0 :(得分:0)
我可以给一个网络示例;我不知道android编程
它包含1栋建筑,有几个房间。和按钮来挑选水平。也许它可以给你一些灵感。
我想你需要一些高程数据 对于导航,请考虑楼梯和电梯。
<!DOCTYPE html>
<html>
<head>
<title>Indoor Map</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<style>
html,
body {
height: 100%;
margin: 0;
padding: 0;
}
#map {
height: 80%;
}
</style>
<script>
var map;
var infowindow;
var buildingPolyLine;
var roomsPolylines = [];
var activeLevel = 0;
// VUB - Brussels university - Building G with a few rooms
var building = {
"name": "Building G",
"color": "#ff0000",
nodes: [
[50.8217232994024, 4.397075700799178],
[50.82232714536237, 4.3975462942398735],
[50.8224010730568, 4.397200047969818],
[50.82182496608163, 4.396712368707085]
]
};
var rooms = [{
"name": "Parking",
"level": "0",
"color": "#0000ff",
nodes: [
[50.82230750704816, 4.397481197138404],
[50.82235988170447, 4.397291001687336],
[50.822044870401214, 4.397048382465982],
[50.82199380856154, 4.39725003087915]
]
},
{
"name": "1G003",
"level": "1",
"color": "#0000ff",
nodes: [
[50.82234196105868, 4.397353604435921],
[50.82231750839912, 4.397428280481108],
[50.82223654023366, 4.397366375092133],
[50.822261380536176, 4.397290787105703]
]
},
{
"name": "1G009",
"level": "1",
"color": "#0000ff",
nodes: [
[50.82219283244282, 4.397244183713838],
[50.82216991951639, 4.397315503651953],
[50.82211850835268, 4.397274663667758],
[50.822140266976895, 4.397204862530089]
]
},
{
"name": "2G10",
"level": "2",
"color": "#0000ff",
nodes: [
[50.8223601104488, 4.397285516533884],
[50.82230697331296, 4.3974744915340125],
[50.82215986306273, 4.397342808561007],
[50.8222137798275, 4.3971696853441244]
]
}
];
// return a polyline. If you give 2 points, it will simply be a line
function makePolyline(points, color, close, title, visible) {
if (close) {
points.push(points[0]); // closed polyline, ...
}
var onMap = visible ? map : null;
return new google.maps.Polyline({
path: points,
//geodesic: true,
strokeColor: color, // '#FF0000',
strokeOpacity: 1.0,
strokeWeight: 2,
title: title,
map: onMap // we will let the Level buttons turn on the right rooms
});
}
function initMap() {
var myLocation = {
lat: 50.822,
lng: 4.397
};
map = new google.maps.Map(document.getElementById('map'), {
center: myLocation,
zoom: 17
});
// plot building
var points = [];
for (var i in building.nodes) {
points.push({
lat: building.nodes[i][0],
lng: building.nodes[i][1]
});
}
var buildingPolyLine = makePolyline(points, building.color, true, building.name, true);
// plot building
for (var j in rooms) {
points = [];
for (var i in rooms[j].nodes) {
points.push({
lat: rooms[j].nodes[i][0],
lng: rooms[j].nodes[i][1]
});
}
roomsPolylines.push(makePolyline(points, rooms[j].color, true, rooms[j].name, false));
}
// activate level 0
setLevel(0);
}
function setLevel(level) {
for (var j in rooms) {
if (level == rooms[j].level) {
roomsPolylines[j].setMap(map);
} else {
roomsPolylines[j].setMap(null);
}
}
}
</script>
</head>
<body>
<div id="map"></div>
Level
<input type="button" onclick="setLevel(0)" value="0" />
<input type="button" onclick="setLevel(1)" value="1" />
<input type="button" onclick="setLevel(2)" value="2" />
<script src="https://maps.googleapis.com/maps/api/js?callback=initMap" async defer></script>
</body>
</html>