问题描述
here.com技术人员应该解决的非常简单的问题
这个例子基本上不在他们的书中。在多段线图形中出现错误。..标记显示为端点,但未显示任何路线。
此处显示脚本和错误。我在脚本中什么都看不到。谢谢
错误::
mapsjs-core.js:410七巧板[错误]:样式:样式'1_translucent-pattern-lines'(程序键“ program”)的错误编译程序{blend:“ translucent”,blend_order:4,crop_by_tile:true ,混合:Array(1),名称:“ 1_translucent-pattern-lines”,…}错误:错误:WebGL程序错误: VALIDATE_STATUS:假 错误:0 -顶点着色器- 精密高压浮子; #定义TANGRAM_EPSILON 0.00001 #define TANGRAM_LAYER_DELTA 0.00006103515625 #定义TANGRAM_TILE_SCALE vec3(4096。,4096.,u_meters_per_pixel * 256.) ****************************************************** ******************************
PHP页面:
<pre>
<?
$start=$_REQUEST[start];
$stop=$_REQUEST[stop];
?>
<html>
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=yes">
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<title>Map with Driving Route from A to B</title>
<link rel="stylesheet" type="text/css" href="https://js.api.here.com/v3/3.1/mapsjs-ui.css" />
<link rel="stylesheet" type="text/css" href="demo.css" />
<link rel="stylesheet" type="text/css" href="styles.css" />
<link rel="stylesheet" type="text/css" href="../template.css" />
<script src="https://js.api.here.com/v3/3.1/mapsjs-core.js" type="text/javascript" charset="utf-8"></script>
<script src="https://js.api.here.com/v3/3.1/mapsjs-service.js" type="text/javascript" charset="utf-8"></script>
<script src="https://js.api.here.com/v3/3.1/mapsjs-ui.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" type="text/css" href="https://js.api.here.com/v3/3.1/mapsjs-ui.css" />
<script>
var map;
var defaultLayers;
function loadMap(){
// Instantiate a map and platform object:
// set up containers for the map + panel
var mapContainer = document.getElementById('map'),routeInstructionsContainer = document.getElementById('panel');
//Step 1: initialize communication with the platform
// In your own code,replace variable window.apikey with your own apikey
var platform = new H.service.Platform({
apikey: 'pS8olsYVma7fp7eSLQPKyti8pxo-Wc4FUQZROgZxz8U'
});
defaultLayers = platform.createDefaultLayers();
//Step 2: initialize a map - this map is centered over Berlin
map = new H.Map(mapContainer,defaultLayers.vector.normal.map,{
zoom: 15,center: { lat: 25.9689321,lng: -80.1529978 }
});
// Get an instance of the geocoding service:
var service = platform.getSearchService();
// Call the geocode method with the geocoding parameters,// the callback and an error callback function (called if a
// communication error occurs):
var start;
var stop;
// Call the geocode method with the geocoding parameters,// the callback and an error callback function (called if a
// communication error occurs):
service.geocode({
q: '<?=$start?>'
},(result) => {
// Add a marker for each location found
result.items.forEach((item) => {
// alert('addr==='+JSON.stringify(item.position,null,4));
start=item.position.lat+','+item.position.lng;
});
},alert);
var ui = H.ui.UI.createDefault(map,defaultLayers);
//ui.setControl('zoom').setEnabled(true);
// Create the parameters for the routing request:
var routingParameters = {
'routingMode': 'fast','transportMode': 'car',// The start point of the route:
'origin': '50.1120423728813,8.68340740740811',// The end point of the route:
'destination': '52.5309916298853,13.3846220493377',// Include the route shape in the response
'return': 'polyline'
};
// Define a callback function to process the routing response:
var onResult = function(result) {
// ensure that at least one route was found
if (result.routes.length) {
result.routes[0].sections.forEach((section) => {
// Create a linestring to use as a point source for the route line
let linestring = H.geo.LineString.fromFlexiblePolyline(section.polyline);
// Create a polyline to display the route:
let routeLine = new H.map.Polyline(linestring,{
style: { strokeColor: 'blue',lineWidth: 3 }
});
// Create a marker for the start point:
let startMarker = new H.map.Marker(section.departure.place.location);
// Create a marker for the end point:
let endMarker = new H.map.Marker(section.arrival.place.location);
// Add the route polyline and the two markers to the map:
map.addObjects([routeLine,startMarker,endMarker]);
// Set the map's viewport to make the whole route visible:
map.getViewModel().setLookAtData({bounds: routeLine.getBoundingBox()});
});
}
};
// Get an instance of the routing service version 8:
var router = platform.getRoutingService(null,8);
// Call calculateRoute() with the routing parameters,// the callback and an error callback function (called if a
// communication error occurs):
router.calculateRoute(routingParameters,onResult,function(error) {
alert(error.message);
});
}
document.addEventListener('DOMContentLoaded',function() {
console.log('DOM is ready');
loadMap();
});
</script>
</head>
<body id="markers-on-the-map">
<div id="map"></div>
<div id="panel"></div>
<div>
<form name="form" action="map4.php" method="post">
Start Address <input type="text" name="start" size=30 value="<?=$start?>"><br>
Stop Address <input type="text" name="stop" size=30 value="<?=$stop?>"><br>
<input type="submit" name="submit" value="Map Route">
</form>
</div>
</body>
</html>
</pre>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)