2.0.0 • Published 4 years ago

agm-overlays v2.0.0

Weekly downloads
4,185
License
MIT
Repository
github
Last release
4 years ago

agm-overlays

Custom marker overlay for the @agm/core package

demo page

hire me npm version npm downloads Dependency Status

Source Repository : master branch here

Dependencies

Please be sure you have installed:

Install

Open a command terminal and type the following

npm install agm-overlays --save-dev

Import

import { AgmOverlays } from "agm-overlays"
import { NgModule } from "@angular/core"
import { BrowserModule } from '@angular/platform-browser'

@NgModule({
  imports:[
    BrowserModule,
    AgmOverlays,
    AgmCoreModule.forRoot({
      apiKey: '...your-key-here...'
    })
  ]
}) export class AppModule {}

Usage

Multiple Custom Overlays

<agm-map style="height:300px;display:block;">
  <agm-overlay
    *ngFor      = "let item of latLngArray"
    [latitude]  = "item.latitude"
    [longitude] = "item.longitude"
  >
    <!-- blue html square -->
    <div style="width:15px;height:15px;background-color:blue;"></div>
  </agm-overlay>
</agm-map>

With multiple custom overlays, the zoom is auto set by the bounds calculated amongst all custom overlays

Single Custom Overlay

<agm-map
  [zoom] = "12"
  style  = "height:300px;display:block;"
  [latitude]  = "item.latitude"
  [longitude] = "item.longitude"
>
  <agm-overlay
    [latitude]  = "item.latitude"
    [longitude] = "item.longitude"
  >
    <!-- blue html square -->
    <div style="width:15px;height:15px;background-color:blue;"></div>
  </agm-overlay>
</agm-map>

Zoom Sizing

By default, markers are always the same size regardless of zoom. Change that!

The following example expands the latitude(0.003) and the longitude(0.0052) in both directions

<agm-map
  [zoom] = "12"
  style  = "height:300px;display:block;"
  [latitude]  = "item.latitude"
  [longitude] = "item.longitude"
>
  <agm-overlay
    [latitude]  = "item.latitude"
    [longitude] = "item.longitude"
    [bounds] = "{x:{latitude:-0.003,longitude:-0.0052},y:{latitude:0.003,longitude:0.0052}}"
  >
    <!-- blue html square -->
    <div style="width:15px;height:15px;background-color:blue;"></div>
  </agm-overlay>
</agm-map>

Clustering Demo

Clustering is NOT a responsibility of this package, however it can be done

demo page This demo uses @agm/js-marker-clusterer to demonstrate how to do clustering

<agm-map
  [latitude]  = "latLngArray[0].latitude"
  [longitude] = "latLngArray[1].latitude"
>
  <agm-marker-cluster imagePath="https://raw.githubusercontent.com/googlemaps/v3-utility-library/master/markerclustererplus/images/m">
    <agm-overlay
      *ngFor      = "let item of latLngArray;let i=index"
      [latitude]  = "item.latitude"
      [longitude] = "item.longitude"
    >
      <!-- blue html square -->
      <div class="block">
        <strong style="color:white;">{{i}}</strong>
      </div>
    </agm-overlay>
  </agm-marker-cluster>
</agm-map>

Resources

Credits and Collaborators

Also Try

abp-zero-templates-gabp-zero-template-gmanualabp-zero-templat-gabp-zero-template-g@everything-registry/sub-chunk-1106timothy.cruztimothy.cruz638timothy.cruz639sprintteksprinttek-cardssprinttek-dev-templatessprinttek-dev-templates-cardssprinttek-dev-templates-redsprinttek-redsprinttek-templatessprinttek-templates-1sprinttek-templates-cadssprinttek-templates-cardingsprinttek-templates-cardssprinttek-templates-jursprinttek-templates-namsprinttek-templates-nambriasprinttek-templates-redsprinttek-templates-yowsprinttek-templates0cardssprinttek-templatesssprinttek-templatessxsprinttek-templatesx1sprinttektestsprinttektest1abp-zero-manualabp-zero-manual-publishabp-zero-sprinthubtestingabp-zero-sprinthubtesting2abp-zero-templat-cardsabp-zero-template-aabp-zero-template-ababp-zero-template-abcabp-zero-template-asdabp-zero-template-babp-zero-template-bcabp-zero-template-bcdabp-zero-template-bnmabp-zero-template-cabp-zero-template-cardingabp-zero-template-cardsabp-zero-template-ccmcabp-zero-template-cdabp-zero-template-pabp-zero-template-pcabp-zero-template-qwertyabp-zero-template-qwertyuabp-zero-template-qwertyuiabp-zero-template-rabp-zero-template-ralph3abp-zero-template-ralphrabp-zero-template-ralphraabp-zero-template-raraabp-zero-template-redabp-zero-template-redsabp-zero-template-reeseabp-zero-template-reesesabp-zero-template-reesesesabp-zero-template-resaabp-zero-template-resaaabp-zero-template-resaaaabp-zero-template-resaaaaabp-zero-template-cdeabp-zero-template-chayabp-zero-template-chay1abp-zero-template-cpabp-zero-template-dabp-zero-template-deabp-zero-template-defabp-zero-template-eabp-zero-template-efabp-zero-template-efgabp-zero-template-efraiabp-zero-template-fabp-zero-template-fgabp-zero-template-fghabp-zero-template-ghabp-zero-template-ghiabp-zero-template-habp-zero-template-hiabp-zero-template-hijabp-zero-template-hjkabp-zero-template-hubabp-zero-template-iabp-zero-template-ijabp-zero-template-ijbabp-zero-template-ijkabp-zero-template-jabp-zero-template-jkabp-zero-template-jklabp-zero-template-rstabp-zero-template-rweaabp-zero-template-sabp-zero-template-sadabp-zero-template-sdw
2.0.0

4 years ago

1.4.1

5 years ago

1.4.0

5 years ago

1.3.3

5 years ago

1.3.2

5 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago