necesito ayuda
Trabajo con la API de mapas aquí. Intento mostrar los contornos alrededor de una ciudad y tengo esto como un error.
const shape = res.response.isoline[0].component[0].shape.map(z => z.split(','));aquí está la pieza completa de código
const requestIsolineShape = opciones => { const params = { 'modo': fastest;${options.mode};traffic:enabled , 'inicio': geo!${options.center.lat},${options.center.lng} , 'rango': opciones.rango, 'rangotipo': opciones.rangoTipo, 'salida': ${options.date}T${options.time}:00 , };
return new Promise((resolver, rechazar) => { router.calculateIsoline( params, res => { const forma = res.response.isoline[0].component[0].shape.map(z => z.split( ',')); resolve( forma ); }, err => rechazar(err) ); }); } ;
Verifique dos veces en la consola (pestaña Red) del navegador qué parámetros se envían al servicio de isolínea de enrutamiento y verifique la respuesta.
Parece que está utilizando la API de enrutamiento v7.2, entonces juegue con el patio de recreo en https://refclient.ext.here.com/ - haga clic allí en "Nueva pestaña +"
Mejor solución si cambia a la nueva versión 8 de la API de enrutamiento y usa este servicio que se integra directamente a la API de JS: https://developer.here.com/documentation/maps/3.1.30.7/api_reference/H.service.RoutingService8.html #calcularIsoline
Ejemplo:
let routingParams = { 'routingMode': 'fast', 'transportMode': 'car', 'origin':'52.5,13.4', 'range[type]': 'time', 'range[values]': '900', }; // Define a callback function to process the routing response let onResult = function(result) { if (result.isolines.length) { result.isolines[0].polygons.forEach((polygon) => { // Create a linestring to use as a point source for the isoline const linestring = H.geo.LineString.fromFlexiblePolyline(polygon.outer); // Create a polygon and a marker representing the isoline const isolinePolygon = new H.map.Polygon(linestring, { style: { strokeColor: 'blue', lineWidth: 3 } }); // Create a marker for the start point const isolineCenter = new H.map.Marker(result.departure.place.location); // Add the polygon and marker to the map map.addObjects([isolinePolygon, isolineCenter]); // Center and zoom the map so that the whole isoline polygon is // in the viewport map.getViewModel().setLookAtData({bounds: isolinePolygon.getBoundingBox()}); }); } }; // Assumption: the platform is instantiated. // Get an instance of the routing service let router = platform.getRoutingService(null, 8); // Call the Isoline Routing API to calculate an isoline router.calculateIsoline( routingParams, onResult, console.error );Área de juegos para v8: https://demo.routing.ext.here.com/