![New axobject-query Maintainer Faces Backlash Over Controversial Decision to Support Legacy Node.js Versions](https://cdn.sanity.io/images/cgdhsj6q/production/86e6ebdea652d20da070ebbda20134b839972db7-1024x1024.webp?w=800&fit=max&auto=format)
Security News
New axobject-query Maintainer Faces Backlash Over Controversial Decision to Support Legacy Node.js Versions
A JavaScript library maintainer is under fire after merging a controversial PR to support legacy versions of Node.js.
measuretool-googlemaps-v3
Advanced tools
Readme
A handy measurement widget for Google Maps API v3. The functionalities are implemented as close as to what current Google Maps offers.
Make sure the geometry
library is referenced in the Google Maps JavaScript API loading script.
libraries=geometry
To create the measurement widget, pass in a Google Map instance.
var measureTool = new MeasureTool(map);
MeasureToolOptions
You could also pass in a MeasureToolOptions
as the second argument to customize to your preference.
var measureTool = new MeasureTool(map, {
showSegmentLength: true,
unit: MeasureTool.UnitTypeId.IMPERIAL // or just use 'imperial'
});
The MeasureTool
comes with a context menu out of box for saving your time to create your own. However, if you'd like to bind the MeasureTool
to your own UI, you could specify contextMenu
to false
when constructing the MeasureTool
. The MeasureTool
exposes two public methods start()
and end()
to start and end measuring. For example,
<button onclick="measureTool.start()">start</button>
<button onclick="measureTool.end()">end</button>
var measureTool = new MeasureTool(map, {
contextMenu: false
// some other options...
});
Constructor | Description |
---|---|
MeasureTool(map:google.maps.Map , opts?:MeasureToolOptions ) | Creates a new measure tool for the google.maps.Map instance. |
Methods | Description |
---|---|
addListener(eventName: string , handler:Function ) | Return Value: None - addes the given listener function to the given event name. |
end() | Return Value: None - ends measuring. |
removeListener(eventName: string ) | Return Value: None - removes the given listener. |
start() | Return Value: None - starts measuring. |
setOption(option: string , value: string ) | Return Value: None - updates a confirguration option and re-generates the drawn shape. |
Properties | Description |
---|---|
area | Type: number - the total area of the enclosed polygon, the unit is m² for metric unit and ft² for imperial unit. |
areaText | Type: string - the formatted total area with unit of the enclosed polygon. |
length | Type: number - the total length of the path drawn, the unit is m for metric unit and ft for imperial unit. |
lengthText | Type: string - the formatted total length with unit of the path drawn. |
Events | Description |
---|---|
measure_change | Arguments: MeasureEvent - This event is fired when a measure step is completed |
measure_end | Arguments: MeasureEvent - This event is fired when the user ends measuring |
measure_start | Arguments: None - This event is fired when the user starts measuring |
Properties | Description |
---|---|
showSegmentLength | Type: boolean - display segment length along the path. Enabled by default. |
tooltip | Type: boolean - display tooltip when hover the drawing path. Enabled by default. |
unit | Type: UnitTypeId - the unit type to use for the measured length and area. Defaults to MeasureTool.UnitTypeId.METRIC . |
Properties | Description |
---|---|
result | Type: MeasureResult - The result of the measuring. |
Properties | Description |
---|---|
area | Type: number - the total area of the enclosed polygon, the unit is m² for metric unit and ft² for imperial unit. |
areaText | Type: string - the formatted total area with unit of the enclosed polygon. |
length | Type: number - the total length of the path drawn, the unit is m for metric unit and ft for imperial unit. |
lengthText | Type: string - the formatted total length with unit of the path drawn. |
Identifiers for common UnitType. Specify these by value, or by using the constant's name. For example, 'metric'
or MeasureTool.UnitTypeId.METRIC
.
Constant | Description |
---|---|
IMPERIAL | This unit type shows measured length in US foot (ft) and mile (mi), and area in US square foot (ft²) and square mile (mi²). |
METRIC | This unit type shows measured length in meter (m) and kilometer (km), and area in square meter (m²) and square kilometer (km²). |
FAQs
A handy measurement widget for Google Maps API v3. The functionalities are implemented as close as to what current Google Maps offers.
The npm package measuretool-googlemaps-v3 receives a total of 1,692 weekly downloads. As such, measuretool-googlemaps-v3 popularity was classified as popular.
We found that measuretool-googlemaps-v3 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A JavaScript library maintainer is under fire after merging a controversial PR to support legacy versions of Node.js.
Security News
Results from the 2023 State of JavaScript Survey highlight key trends, including Vite's dominance, rising TypeScript adoption, and the enduring popularity of React. Discover more insights on developer preferences and technology usage.
Security News
The US Justice Department has penalized two consulting firms $11.3 million for failing to meet cybersecurity requirements on federally funded projects, emphasizing strict enforcement to protect sensitive government data.