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

How to add OL's Panel and DrawControl to Map ? #4

Open
gowram opened this issue Nov 12, 2013 · 2 comments
Open

How to add OL's Panel and DrawControl to Map ? #4

gowram opened this issue Nov 12, 2013 · 2 comments
Labels

Comments

@gowram
Copy link

gowram commented Nov 12, 2013

Hi Matt,

I would like to add Panel and Draw Controls for vector layer,
I am currently working on functionality for User would be able to draw features and add properties which eventually converted to GeoJSON format.

Is it possible and how to achieve ?

Thanks
Rama

@mpriour
Copy link
Owner

mpriour commented Nov 12, 2013

You can add any control and specify its options it in the map directive markup. see:

To add a geolocation control:

<div ol-map controls="zoom,navigation,attribution,geolocate" control-opts="{geolocate:{geolocationOptions:{enableHighAccuracy: true, maximumAge: 30000}}">
</div>

Alternatively, you could get a reference to the map object and from there you can add on whatever you like to the map directly.

I don't currently have any examples showing how to get the map object reference, but you would do it by creating a simple controller and it would share the same variable name in the controller scope as the olmap directive in the markup.

ex:

<div ng-controller="MyController">
  <div ol-map="mymap">
        <az-layer name="Street" lyr-type="tiles"></az-layer>
  </div>
</div>
function MyController(){
  this.mymap = null
}

MyController.prototype.doSomething = function(){
  this.mymap.setCenter([-97,35], 10);
}

@gowram
Copy link
Author

gowram commented Nov 18, 2013

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants