azimuthjs icon indicating copy to clipboard operation
azimuthjs copied to clipboard

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

Open gowram opened this issue 11 years ago • 2 comments

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

gowram avatar Nov 12 '13 06:11 gowram

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

  • http://mpriour.github.io/azimuthjs/examples/olMap_layers.html
  • http://mpriour.github.io/azimuthjs/#ol_layers_options

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);
}

mpriour avatar Nov 12 '13 14:11 mpriour

Thanks.

gowram avatar Nov 18 '13 03:11 gowram