angular / components

Component infrastructure and Material Design components for Angular
https://material.angular.io
MIT License
24.39k stars 6.76k forks source link

feat(GoogleMap): Add google controls integration #22526

Open labeled opened 3 years ago

labeled commented 3 years ago

Feature Description

The google maps api has the ability to add controls the map. It would be nice to have an 'angular' way to push components into the controls api. See https://developers.google.com/maps/documentation/javascript/examples/control-custom for examples.

Use Case

This would give developers capability to add buttons like location to the existing maps instead of overlaying a custom element over the map.

b00ling commented 3 years ago

Feature Description

The google maps api has the ability to add controls the map. It would be nice to have an 'angular' way to push components into the controls api. See https://developers.google.com/maps/documentation/javascript/examples/control-custom for examples.

Hi, is there a 'not only angular' way at the moment?

labeled commented 3 years ago

Yeah currently you create an html object using javascript and inject it into the map using something like this.

map.controls[google.maps.ControlPosition.TOP_CENTER].push(centerControlDiv);

It would be nice to use an angular component and have it used on the map instead of vanilla javascript.

Thanks,

___ Travis Peterson Full Stack Developer Altec Industries 1255 Port Terminal Dr Duluth MN, 55802 (c) 763-442-0747 (w) 218-733-1215

On Thu, Jul 15, 2021 at 8:13 AM b00ling @.***> wrote:

Feature Description

The google maps api has the ability to add controls the map. It would be nice to have an 'angular' way to push components into the controls api. See https://developers.google.com/maps/documentation/javascript/examples/control-custom for examples.

Hi, is there a 'not only angular' way at the moment?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/angular/components/issues/22526#issuecomment-880683758, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIHHEMPFK3YIPS6XMMHCPTTX3NHDANCNFSM43KVMFUQ .

ynoval commented 3 years ago

We need to add a Layers Manager as you have when works with Google Earth Engine Code. We did :

//Just HTML element const containerEl = document.getElementById('containerLayers');

// Create Element (Angular Component MapLayerComponent with selector app-map-layers) const layersElement: NgElement & WithProperties = document.createElement( 'app-map-layers' ) as any;

// Listen ChangeLayer event (when user select/ unselect a layer in the component) layersElement.addEventListener('changeLayer', (event: any) => { if (event.detail.action === 'SHOW') { this.showLayer(event.detail.layer); } else { this.hideLayer(event.detail.layer); } });

    // Pass layers to the component
    layersElement.mapLayers = this.mapLayers;
    // Add to the DOM (container)
    containerEl.innerHTML = '';
    containerEl.appendChild(layersElement);
    this.mapInstance.googleMap.controls[google.maps.ControlPosition.TOP_RIGHT].push(containerEl);

Hope this can help.

angular-robot[bot] commented 2 years ago

Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends.

Find more details about Angular's feature request process in our documentation.

angular-robot[bot] commented 2 years ago

Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.

We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.

You can find more details about the feature request process in our documentation.