Overlay Class
Overlay Class
Overlays are some of the common elements superimposed on the map basemap, including
class name | instructions |
---|---|
nimap.Marker |
point marker |
nimap.Polyline |
polyline |
nimap.Polygon |
polygon |
nimap.Circle |
circular |
nimap .CircleMarker |
Circular mark, not zoomed in and out with the map |
nimap.OverlayGroup |
Overlay Collection |
nimap.ContextMenu |
Map right-click menu |
Marker Class
Point Marker
Constructor | Description |
---|---|
nimap.Marker(MarkerOptions) |
Structure point objects, set object properties via MarkerOptions |
MarkerOptions | Type | Description |
---|---|---|
element |
HTMLElement |
The DOM element is used as a point marker. Empty or not passed, the default is light blue, droplet-shaped SVG mark. |
anchor |
String |
A string indicating that the marker is in the coordinate orientation. Options include 'center', 'top', 'bottom', 'left', 'right', 'top-left', 'top-right', 'bottom-left', and 'bottom-right'. |
offset |
PointLike |
Relative element position is based on the offset of the pixel unit, for example: [50, 50]. Negative numbers are left or up. |
color |
String |
If no options.element is provided, the color used for the default tag. The default is light blue. |
draggable |
Boolean |
true means the tag can be dragged |
method | Return value | Description |
---|---|---|
addTo(map) |
Add tags to the map. |
|
setPopup(Popup) |
Bind the popup to the tag |
|
getPopup() |
Object |
Return an instance of the bound popup |
remove() |
Remove the marker from the map you have added to. |
|
getLngLat() |
LngLat |
Returns the geographic location of the point marker anchor. |
setLngLat( Boolean) |
Set the point to mark the geographic location of the anchor point and move the marker to that anchor point. |
|
getElement() |
HTMLElement |
Return the marked Html element |
togglePopup() |
Opens or closes the bound pop-up window, depending on the current state. |
|
setDraggable(Boolean) |
Controls whether it can be dragged and dropped, true is draggable. |
|
isDraggable() |
Boolean |
Returns whether the marker can be dragged, if it can be true |
getOffset() |
PointLike |
Return the offset of the tag |
setOffset(PointLike) |
Set the offset of the tag |
Events | Parameters | Description |
---|---|---|
dragstart |
Trigger when dragging starts |
|
drag |
Continuously triggered events while dragging |
|
dragend |
Trigger at the end of the drag |
Polyline Class
polyline
Constructor | Description |
---|---|
nimap.Polyline(PolylineOptions) |
Structure a polyline object |
PolylineOptions | Type | Description |
---|---|---|
path |
Array |
A node coordinate array for a polyline |
line-color |
String |
Set the color of the polyline, the default is #1ebc32 |
line-width |
Number |
Set the polyline width in pixels |
line-blur |
Number |
Set the line blur, in pixels: |
line -join |
String |
Drawing style of the inflection point. The default value is 'round' rounded corners, other optional values : 'miter' sharp corner, 'bevel' oblique angle |
line-cap |
String |
The drawing style of the line cap at both ends of the polyline. The default value is 'round' round head. Other optional values: 'butt' no head, 'square' square head |
method | Return value | Description |
---|---|---|
addTo(map) |
Add a polyline to the map. |
|
setPath(LngLatArray) |
Set the array of nodes that make up the polyline |
|
setOptions(PolylineOptions) |
Modify polyline attributes (including path nodes, line styles, etc. For details on properties, see the PolylineOptions list) |
|
show() |
Show polylines on the map |
|
hide() |
Hide polylines on the map |
Polygon Class
polygon
Constructor | Description |
---|---|
nimap.Polygon(PolygonOptions) |
Construct Polygon Objects |
PolygonOptions | Type | Description |
---|---|---|
path |
Array |
A node coordinate array for a polygon |
fill-color |
String |
Set the fill color of the polygon. The default is #2c5d88 |
fill-opacity |
Number |
Set polygon transparency |
fill-antialias |
Boolean |
Anti-aliasing, defaults to true |
fill -outline-color |
String |
Polygon stroke color, fill-antialias is true |
method | Return value | Description |
---|---|---|
addTo(map) |
Add a polygon to the map. |
|
setPath(LngLatArray) |
Set the array of nodes that make up the polyline |
|
setOptions(PolygonOptions) |
Modify polyline attributes (including path nodes, line styles, etc. See the PolygonOptions list for details) |
|
show() |
Show polygons on the map |
|
hide() |
Hide polygons on the map |