Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the advanced auxiliary features of R language

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the knowledge of "how to use the advanced auxiliary features of R language". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Additional attributes:

Measurement tool: Leaflet Measure

# adding this tool allows you to easily click on a visual map to measure the distance between two points. If it is a closed area, you can directly calculate the real area of the closed area.

Gridlines: Graticule

# Grid lines can provide longitude and latitude location references for geographic space in plane coordinate systems.

The dividing line between day and night: Terminator (day/night indicator)

# # the day-night demarcation line can provide the day-night demarcation condition in different areas of the day.

Mini Mini Map: Minimap

The mini window mini-map provides a positioning window to let you know the approximate orientation of the location in the main layout over a larger geographical area, which is equivalent to the mini navigation map in the game.

Secondary button: EasyButton

The auxiliary button can provide one-click initialization scale bar and one-button positioning function.

Custom js attribute: Custom JavaScript with htmlwidgets::onRender

You can use the interface tool between leaflet and HTML to set more rich properties for the map layout.

Measurement tool: Leaflet Measure

Library (leaflet)

M%addTiles ()

M% >% fitBounds (- 73.9 fitBounds 40.75) >% addMeasure ()

When the small pop-up window on the upper right opens, you can select the create ranging option to measure the geographical distance between two points by clicking the mouse. If there are more than three points, the area of the closed polygon will be measured.

M% >%

FitBounds (13.76134, 52.675499, 13.0884, 52.33812)% >% # sets the geographic area range to which the layout is rendered

AddMeasure (

Position = "bottomleft", # ranging menu location

PrimaryLengthUnit = "meters", # measured point distance output unit

PrimaryAreaUnit = "sqmeters", # measured area output unit of closed polygon

ActiveColor = "# 3D535D", #

CompletedColor = "# 7D4479")

Gridlines: Graticule

Leaflet ()% >% addTiles ()% >% setView (0pen0Person2)% >% addGraticule ()

Leaflet ()% >% addTiles ()% >% setView (0re0Person2)% >%

AddGraticule (interval = 10, style = list (color = "# FF0000", weight = 1))

And the gridline system is a controllable element, which is controlled by treating it as a separate layer and then grouping it into groups.

Leaflet ()% >% addTiles ()% >% setView (0re0Person2)% >%

AddGraticule (group = "Graticule")% >%

AddLayersControl (overlayGroups = c ("Graticule"), options=layersControlOptions (collapsed = FALSE))

The dividing line between day and night: Terminator (day/night indicator)

Leaflet ()% > addTiles ()% > addTerminator ()

The day-night demarcation line supports custom date and grouping functions:

Leaflet ()% >%

AddTiles ()% >%

AddTerminator (

Resolution=10

Time = "2013-06-20T21:00:00Z"

Group = "daylight")% >%

AddLayersControl (

OverlayGroups = "daylight"

Options = layersControlOptions (collapsed = FALSE))

Mini navigation map: Minimap

Leaflet ()% >% setView (0penny 0pr 3)% >%

AddProviderTiles (providers$Esri.WorldStreetMap)% >%

AddMiniMap ()

The map background in the mini navigation map also supports customization:

Leaflet ()% >% setView (0penny 0pr 3)% >%

AddProviderTiles (providers$Esri.WorldStreetMap)% >%

AddMiniMap (tiles = providers$Esri.WorldStreetMap,toggleDisplay = TRUE)

Accessibility menu:

Library (htmltools)

Library (htmlwidgets)

Leaflet ()% > addTiles ()% >

AddEasyButton (easyButton (# add one click to restore the initial window Belgium

Icon= "fa-globe", title= "Zoom to Level 1"

OnClick=JS ("function (btn, map) {map.setZoom (1);}"))% >%

AddEasyButton (easyButton (# add one-click positioning function (depending on your location)

Icon= "fa-crosshairs", title= "Locate Me"

OnClick=JS ("function (btn, map) {map.locate ({setView: true});}")

Dynamic effects:

The following code shows how to call the js tool control to turn on the point aggregation function on the map by opening the menu tool, and turn off the point aggregation function by turning off the menu tool button.

Leaflet ()% > addTiles ()% >

AddMarkers (data=quakes

ClusterOptions = markerClusterOptions ()

ClusterId = "quakesCluster")% >%

AddEasyButton (easyButton (

States = list (

EasyButtonState (# status 1: open the menu to enable point aggregation

StateName= "unfrozen-markers"

Icon= "ion-toggle"

Title= "Freeze Clusters"

OnClick = JS ("

Function (btn,map) {

Var clusterManager =

Map.layerManager.getLayer ('cluster',' quakesCluster')

ClusterManager.freezeAtZoom ()

Btn.state ('frozen-markers')

} ")

),

EasyButtonState (# status 2: close menu, end point aggregation function

StateName= "frozen-markers"

Icon= "ion-toggle-filled"

Title= "UnFreeze Clusters"

OnClick = JS ("

Function (btn, map) {

Var clusterManager =

Map.layerManager.getLayer ('cluster',' quakesCluster')

ClusterManager.unfreeze ()

Btn.state ('unfrozen-markers')

} ")

)

)

))

Custom js attribute: Custom JavaScript with htmlwidgets::onRender

The base layer changes according to the layer style in the navigation window:

Mymap% setView (0B0Pol 3)

Esri%

AddLayersControl (baseGroups = names (esri))

Options = layersControlOptions (collapsed = FALSE))% >%

AddMiniMap (tiles = esri [[1], toggleDisplay = TRUE

Position = "bottomleft")% >%

Htmlwidgets::onRender ("

Function (el, x) {

Var myMap = this

MyMap.on ('baselayerchange'

Function (e) {

MyMap.minimap.changeLayer (L.tileLayer.provider (e.name))

})

} ")

This is the end of the content of "how to use the advanced auxiliary features of R language". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report