showPolygon
Command
Creates PolygonStyle from received parameters if it does not exist already and display it on MapView
BND_MESSAGE extra of an Intent with the action ACTION_RNC_BROADCAST, to BeNav's activity or receiver: see Sending commands.Draws filled, outlined areas on the map: zones rather than points. Where a POI marks a place, a polygon marks a region: a delivery sector, a site boundary, a low-emission zone, an area a vehicle is not meant to enter.
Each polygon carries an id, its outline, a fill colour and a border, all chosen by the client application, and both colours support transparency so the map stays readable underneath.
Worth knowing
- Polygons are drawn, not enforced. BeNav shows the area; it does not route around it or warn on entry. Acting on a vehicle's position relative to a zone is the client application's job.
- An outline needs at least three points.
- Sending the command with no polygons clears every polygon.
Example: making sector boundaries visible
A waste-collection operator divides a city into rounds. Each driver's application pushes that driver's sector as a translucent polygon, so the boundary is visible on the navigation map as they work along it, and a driver who has drifted into the next sector can see it immediately rather than finding out from the office.
Command#
{
"id": "testId",
"jsonrpc": "2.0",
"method": "showPolygon",
"params": {
"polygons": [
{
"borderColor": "#A0FF0000",
"borderWidth": 2,
"id": "Polygon A - Red Border Blue Fill",
"points": [
{
"lat": "43.686005",
"long": "7.277801"
},
{
"lat": "43.698906",
"long": "7.266634"
},
{
"lat": "43.707594",
"long": "7.269547"
},
{
"lat": "43.712419",
"long": "7.292609"
},
{
"lat": "43.689691",
"long": "7.299650"
}
],
"solidColor": "#A10000FF"
},
{
"borderColor": "#FF00FF00",
"borderWidth": 5,
"id": "Polygon B - Green Border Yellow Fill Thick",
"points": [
{
"lat": "43.712419",
"long": "7.292609"
},
{
"lat": "43.720000",
"long": "7.295000"
},
{
"lat": "43.725000",
"long": "7.310000"
},
{
"lat": "43.715000",
"long": "7.320000"
},
{
"lat": "43.700000",
"long": "7.315000"
}
],
"solidColor": "#80FFFF00"
},
{
"borderColor": "#FFFF00FF",
"borderWidth": 1,
"id": "Polygon C - Magenta Border Green Fill Thin",
"points": [
{
"lat": "43.670000",
"long": "7.270000"
},
{
"lat": "43.686005",
"long": "7.277801"
},
{
"lat": "43.689691",
"long": "7.299650"
},
{
"lat": "43.675000",
"long": "7.300000"
},
{
"lat": "43.665000",
"long": "7.285000"
}
],
"solidColor": "#6000FF00"
},
{
"borderColor": "#FF0000FF",
"borderWidth": 8,
"id": "Polygon D - Blue Border Orange Fill Very Thick",
"points": [
{
"lat": "43.698906",
"long": "7.250000"
},
{
"lat": "43.707594",
"long": "7.269547"
},
{
"lat": "43.698906",
"long": "7.266634"
},
{
"lat": "43.695000",
"long": "7.255000"
}
],
"solidColor": "#C0FFA500"
},
{
"borderColor": "#80000000",
"borderWidth": 3,
"id": "Polygon E - Black Border Purple Fill Medium",
"points": [
{
"lat": "43.715000",
"long": "7.265000"
},
{
"lat": "43.725000",
"long": "7.270000"
},
{
"lat": "43.730000",
"long": "7.285000"
},
{
"lat": "43.720000",
"long": "7.295000"
},
{
"lat": "43.712419",
"long": "7.292609"
}
],
"solidColor": "#90800080"
}
]
}
}Specific parameters:
idUnique identifier for the PolygonborderColorhex value, color the polygon's bordersolidColorhex value, inner color of the polygonborderWidthwidth (in pixels) of the polygon's border
points and solidColor are mandatory; id and borderColor are optional and borderWidth defaults to 3. An optional useRealUnitsForBorder (false by default) expresses borderWidth in real-world units instead of pixels. Polygon points use the keys lat and long.
Behaviour of the polygons list:
paramspresent butpolygonsomitted: hides every polygon currently displayed.polygonspresent but empty: rejected with-9 empty.list. A command with noparamskey at all is rejected with-32700 parse.error.
Errors: 16 invalid.polygon (fewer than 3 points), 17 invalid.polygon.color and 18 invalid.polygon.border.color (unparsable hex colour).
Response#
Generic response