Skip to main content

Route

Route in an active element on map, pointing to some location. Routes can be rendered only inside RouteLayer.

Route is defined by component RouteGeometry, since rendered result is a geometry respecting given points and constraints of the map.

How to use it

import { Map, MouseControl } from 'mapy-cz-react';

<MapProvider center={{ lat: 50.096406, lng: 14.463071 }} id="map-example">
<Map>
<RouteLayer>
<RouteGeometry
coords={[
{ lng: 14.434, lat: 50.084 },
{ lng: 16.6, lat: 49.195 },
]}
/>
</RouteLayer>
</Map>
</MapProvider>;

Props

color = DEFAULT_ROUTE_COLOR, coords, id, routeType = ROUTE_TYPES.FAST, width = DEFAULT_ROUTE_WIDTH,

NameTypeDefaultDescriptionRequired
colorstringf00Color of route, accepted is any color in hex
coordsarrayundefinedArray of objects with attributes longitude and latitude defining route point position.✔️
routeTypestringROUTE_TYPES.FASTAny value from ROUTE_TYPES
widthnumber3Width of route geometry
idstringundefinedId of route

Example

Live Editor
Result
Loading...