Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible to do KML layers? #50

Closed
mklnz opened this issue May 23, 2016 · 3 comments
Closed

Possible to do KML layers? #50

mklnz opened this issue May 23, 2016 · 3 comments

Comments

@mklnz
Copy link

mklnz commented May 23, 2016

I'm wondering how to do KML layers using this addon?
https://developers.google.com/maps/documentation/javascript/examples/layer-kml

Perhaps using just some plaun javascript for now?

@asennikov
Copy link
Owner

so yeah, we don't have support for that feature yet, but you can do it in some hacky way with custom "functional" components:

{{#g-map lat=lat lng=lng zoom=13 as |mapContext|
  {{your-kml-component map=mapContext.map kmlUrl="http://example.com/layer.kml}}
{{/g-map}}

and then your-kml-component component could be something like:

import Ember from 'ember';

export default Ember.Component.extend({
  init() {
    this._super(...arguments);
    this.setKmlLayer();
  },
  mapHasBeenSet: Ember.observer('map', function() {
    Ember.run.once(this, 'setKmlLayer');
  }),
  setKmlLayer() {
    const map = this.get('map');
    const url = this.get('kmlUrl');

    if (Ember.isPresent(map) && Ember.isPresent(url)) {
      const layer = new google.maps.KmlLayer({ url, map });
      this.set('layer', layer);
    }
  }
});

@asennikov
Copy link
Owner

also looks like this feature could be added really easy, so if you can make it work maybe you can consider contributing to the project by adding {{g-map-kml-layer}} component 😃

@mklnz
Copy link
Author

mklnz commented May 25, 2016

@asennikov Great, thanks for the tip. I will give it a try and see how I go.

@mklnz mklnz closed this as completed May 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants