Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ngx-google-map-helper

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-google-map-helper

An angular package for using drawing control options of Google Map API

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
26
increased by333.33%
Maintainers
1
Weekly downloads
 
Created
Source

Google Map Drawing Controls for Angular (NgxGoogleMapHelper)

Build Status Fork

An angular package for using drawing control options of Google Map API. It provides following features,

  • Google Map API Drawing Controls (Marker, Rectangle, Polyline, Polygon, Circle)
  • Custom Buttons (Save, Undo, Delete...)
  • Output Events (OverlayCompleted, MapClicked..)

You can check it online through here NGXGoogleMapHelper Demo

Installation

NgxGoogleMapHelper requires Angular v7+ to run.

Install using npm,

$ npm install ngx-google-map-helper --save

Usage

Import

Add NgxGoogleMapHelperModule to your module file:

imports: [
    ... , //your modules
    NgxGoogleMapHelperModule.forRoot({
      apiKey: 'XXXXXXXXXXXXXXXXXXXXXX'
    })
  ]

Example

After importing NgxGoogleMapHelperModule in your module file just use the ngx-google-map-helper component as below,


<ngx-google-map-helper 
    [locationAccess] = true 
    [showControl] = true 
    [mapHeight] = "'1000px'" 
    [mapWidth] = "'50%'"> </ngx-google-map-helper>
</form>

Options

You can go through Google Map API here. Google Map Javscript API

OptionTypeDescriptionValuesDefault
mapHeightstringSets the height of the map'100px','100%'...'500px'
mapWidthstringSets the width of the map'100px','100%'...'100%'
zoomintSets the zoom of mapany number10
centerLatLangSets the center of mapobject of LatLang{lat: -34.397, lng: 150.644}
mapTypestringSets the type of map['ROADMAP', 'SATELLITE', 'HYBRID', 'TERRAIN']'ROADMAP'
showErrorsbooleanShows custom error messages on consoletrue,falsetrue
locationAccessbooleanAllow to get the location of the usertrue,falsetrue
placeMarkerOnClickbooleanPlaces a marker on map in every clicktrue,falsefalse
showControlbooleanShows google map drawing controlstrue,falsetrue
positionstringSets the location of drawing tools.Refer drawing tools positions of Google Map API.'TOP_CENTER' , 'TOP_RIGHT' , 'BOTTOM_LEFT',...'TOP_CENTER'
showModesstring[]Shows only specified drawing controls. When null shows all.'marker' , 'circle' , 'polygon' , 'polyline' , 'rectangle'All
commonOptionOverLayOptionSets the properties of all drawing options.object of OverLayOption{fillColor:'#005696' ,fillOpacity:0.2, strokeColor:'#005696' ,strokeWeight:3, clickable:true, editable:true, draggable:true,zIndex:1}
circleOptionOverLayOptionOverrides only the circle overlay properties.object of OverLayOptionsame as common option default
polygonOptionOverLayOptionOverrides only the polygon overlay properties.object of OverLayOptionsame as common option default
polylineOptionOverLayOptionOverrides only the polyline overlay properties.object of OverLayOptionsame as common option default
rectangleOptionOverLayOptionOverrides only the rectangle overlay properties.object of OverLayOptionsame as common option default
markerOptionMarkerOptionOverrides only the marker properties.object of MarkerOption{animation: 'DROP',draggable: true,title: '',icon: null}
customButtonsbooleanShows custom buttons - Undo,Save,Clear ...true,falsetrue
onlyCustomButtonsstring[]Shows only the specified custom buttons.By default shows all.'undo','clear','delete', 'save','saveAll'All
googleMapObjectsbooleanIf true, returns google map objects rather than custom objects.true,falsefalse
shapesShape[]Pass overlays as a shape object to show the overlay on mapShape objects[]

Events

Please note that this events return shape objects only when googleMapObjects = true (by default true), if its false it will return google map event.

EventDescriptionOutput
mapClickedEvent fires when user click on the map.LatLng Object
overlayCompletedEvent fires as soon as overlay drawing is finished.Shape Object
overlaySelectedEvent fires when an overlay is selectedShape Object
saveSeletedEvent fires when save custom button is clicked.Shape Object
saveAllEvent fires when saveAll custom button is clicked.Array of Shape Objects

Development

Want to contribute?

  • Fork repository.
  • Update ./projects/ngx-google-map-helper
  • Build & Test the library.
  • Update ./src/app with new functionality.
  • Update README.md accordingly.
  • Pull request.
Instructions
  • Download or clone the repository.
  • Install dependencies $ npm install
  • Start the app $ npm start
  • Build the app $ npm run build or $ ng build
  • Build the library after change run either $ npm run package or $ ng build NgxGoogleMapHelper

verify app is working after $ npm start ,

http://localhost:4200

License

MIT Free Software

Keywords

FAQs

Package last updated on 02 Apr 2019

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc