我如何沿着路线获得所有行政部门/边界?

发布于 2025-01-27 14:44:47 字数 237 浏览 1 评论 0原文

位置的V8端点获取路线

目前,我们正在使用以下 ://developer.here.com/documentation/routing-api/api-reference-swagger.html

对于每条路线,我们希望获得所有行政部门/区域/边界,例如州,县,城市, ,等(美国)。我们将如何做到这一点?

我们已经考虑过在这里与OpenStreetMap同时使用Polylines,但我希望已经有一个解决方案了吗?

We're currently getting routes using the v8 endpoint seen at:

https://developer.here.com/documentation/routing-api/api-reference-swagger.html

For each route, we'd like to get all administrative divisions/regions/boundaries such as states, counties, cities, etc (for United States). How might we go about doing this?

We've thought about using HERE polylines in tandem with OpenStreetMap but I would hope that there might already be a solution for this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

戈亓 2025-02-03 14:44:47

您可以使用MAP TILE API在背景中显示映射,如此示例所示: https://demo.support.here.com/examples/v3.1/simple_routing

(function(){
/*
作者
(c)在这里2019年
*/

var mapContainer = document.getElementById('mapContainer');

// check if the site was loaded via secure connection
var secure = (location.protocol === 'https:') ? true : false;

var platform = new H.service.Platform({
        useHTTPS: secure,
        apikey: api_key
    }),
    defaultLayers = platform.createDefaultLayers(),
    router = platform.getRoutingService(),

    map = new H.Map(mapContainer, defaultLayers.vector.normal.map,
        {
            center: center,
            zoom: zoom,
            pixelRatio: window.devicePixelRatio || 1
        }
    );

// Do not draw under control panel
map.getViewPort().setPadding(0, 0, 0, $('.ctrl-panel').width());

// add behavior control
new H.mapevents.Behavior(new H.mapevents.MapEvents(map));

// Enable the default UI
var ui = H.ui.UI.createDefault(map, defaultLayers);

window.addEventListener('resize', function() { map.getViewPort().resize(); });

function calculateRoute()
{
    var calculateRouteParams = {

        'waypoint0' : '52.516222,13.388900',
        'waypoint1' : '52.517175,13.395129',
        'mode': 'fastest;car;traffic:disabled',
        'representation': 'display'
    },
    onResult = function(result) {
        var lineString = new H.geo.LineString(),
            routeShape = result.response.route[0].shape,
            polyline;

        routeShape.forEach(function(point) {
            var parts = point.split(',');
            lineString.pushLatLngAlt(parts[0], parts[1]);
        });

        var polyline = new H.map.Polyline(lineString,
            {
                style:
                {
                    lineWidth: 10,
                    strokeColor: "rgba(0, 128, 0, 0.7)"
                }
            });

        map.addObject(polyline);
        map.getViewModel().setLookAtData({
            tilt: 45,
            bounds: polyline.getBoundingBox()
        });
    },
    onError = function(error) {
        console.log(error);
    }
    router.calculateRoute(calculateRouteParams, onResult, onError);
}

var displayReady = function(e)
{
    map.removeEventListener("mapviewchangeend", displayReady);
    calculateRoute();
};

map.addEventListener("mapviewchangeend", displayReady);

})

you can use map tile api to to show map in the background as shown in this sample example : https://demo.support.here.com/examples/v3.1/simple_routing

(function(){
/*
author
(C) HERE 2019
*/

var mapContainer = document.getElementById('mapContainer');

// check if the site was loaded via secure connection
var secure = (location.protocol === 'https:') ? true : false;

var platform = new H.service.Platform({
        useHTTPS: secure,
        apikey: api_key
    }),
    defaultLayers = platform.createDefaultLayers(),
    router = platform.getRoutingService(),

    map = new H.Map(mapContainer, defaultLayers.vector.normal.map,
        {
            center: center,
            zoom: zoom,
            pixelRatio: window.devicePixelRatio || 1
        }
    );

// Do not draw under control panel
map.getViewPort().setPadding(0, 0, 0, $('.ctrl-panel').width());

// add behavior control
new H.mapevents.Behavior(new H.mapevents.MapEvents(map));

// Enable the default UI
var ui = H.ui.UI.createDefault(map, defaultLayers);

window.addEventListener('resize', function() { map.getViewPort().resize(); });

function calculateRoute()
{
    var calculateRouteParams = {

        'waypoint0' : '52.516222,13.388900',
        'waypoint1' : '52.517175,13.395129',
        'mode': 'fastest;car;traffic:disabled',
        'representation': 'display'
    },
    onResult = function(result) {
        var lineString = new H.geo.LineString(),
            routeShape = result.response.route[0].shape,
            polyline;

        routeShape.forEach(function(point) {
            var parts = point.split(',');
            lineString.pushLatLngAlt(parts[0], parts[1]);
        });

        var polyline = new H.map.Polyline(lineString,
            {
                style:
                {
                    lineWidth: 10,
                    strokeColor: "rgba(0, 128, 0, 0.7)"
                }
            });

        map.addObject(polyline);
        map.getViewModel().setLookAtData({
            tilt: 45,
            bounds: polyline.getBoundingBox()
        });
    },
    onError = function(error) {
        console.log(error);
    }
    router.calculateRoute(calculateRouteParams, onResult, onError);
}

var displayReady = function(e)
{
    map.removeEventListener("mapviewchangeend", displayReady);
    calculateRoute();
};

map.addEventListener("mapviewchangeend", displayReady);

})

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文