简体   繁体   English

解决嵌入地图中的10个最大航点

[英]Working around 10 Maximum Waypoints in Embed Maps

I'm volunteering my time to write an html5 app for a local NPO that frequently delivers food. 我自愿花时间为经常提供食物的本地NPO编写html5应用程序。 The app is fairly simple - a delivery volunteer comes to the center where they can download their delivery routes. 该应用程序非常简单-送货志愿者来到中心,在那里他们可以下载送货路线。 They are then allowed to customize their routes (drag and drop) or to re-order waypoints for optimum delivery (eg finish near their house, their office, or back at the center using maps web service API). 然后允许他们自定义路线(拖放)或重新排序航点以实现最佳交付(例如,使用地图Web服务API在他们的房子,办公室附近或在中心返回终点)。

Here's the problem. 这是问题所在。 All of this is working beautifully using the google maps web api. 使用google maps网络api,所有这些都能很好地工作。 However, the google embedded map (in an iframe) is only showing 10 waypoints, when the average route has 13. Furthermore, if a user clicks to see the larger map, it only shows 10 of the 13 stops they have. 但是,当平均路线只有13个时,google嵌入式地图(在iframe中)仅显示10个航路点。此外,如果用户单击以查看较大的地图,则仅显示他们拥有的13个站点中的10个。

According to the agreement, I need to display a google map, but only showing some of the stops would be confusing to the users. 根据协议,我需要显示一个谷歌地图,但是仅显示一些停靠站会使用户感到困惑。

Is there a way around this limit? 有没有办法解决这个限制? Is it possible to manually build the route from javascript (based on the web api result) and still use the directions method in case a user clicks into the large maps and wants to print the full route. 是否可以从javascript(基于网络api结果)手动构建路线,并在用户单击大地图并想要打印完整路线的情况下仍使用directions方法。

I'm using the directions embed API: 我正在使用说明嵌入API:

googleurl/directions/?origin=XX&destination=XX&waypoints=XX|XX|XX|XX|XX|XX|XX|XX|XX|XX|XX|XX|XX&key=XXXXX

I never really found a workable solution, so instead of showing the route, I am attempting to add markers for the waypoints in numbered order. 我从未真正找到可行的解决方案,因此,我没有显示路线,而是尝试按编号顺序添加路标的标记。 It accomplishes my intent, meets the gmaps agreement, and gives the user an overview of the route. 它实现了我的意图,符合gmaps协议,并为用户提供了路线的概述。

I'm using dburles:google-maps for meteor/react. 我正在使用dburles:google-maps进行流星/反应。

if(!this.isLoading){
    Clients.find().forEach(function(document){
        var map = GoogleMaps.maps['mymap'];
        var marker = new google.maps.Marker({
            draggable: true,
            animation: google.maps.Animation.DROP,
            position: new google.maps.LatLng(document.lat, document.lng),
            map: map.instance,
            id: document._id,
            title: document.seq
        })
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM