Monday, June 13, 2016

Custom OpenLayers directives with Angular

When I decided to go with Angular for this project, I knew I wanted to have OpenLayers be a directive of sort. Turns out David Rupert made just that with his angular-openlayers-directive project. It's really handy in getting the whole thing running with very little time.

We're using GeoServer as the backend, particularly, its flavor of WFS. angular-openlayers-directive does not have a way to handle this kind of WFS very well, so I created my own ol-layer-wfs directive to help out with this.

Note that this is my first Angular project, so please forgive me if it's not proper... Really just trying to get it working!

Here's the HTML.
Here's the Angular code. Note that we are "extending" the openlayers-directive module here and requiring the openlayers controller to get to the map object. I am also using the Angular link method, which I currently have no idea what it does, but seems to work and get the stuff I need loaded :)

In case you were wondering, the manhole properties look like this:

No comments:

Post a Comment