geometry engine

Fun with GeometryEngine

The GeometryEngine in the ArcGIS API for JavaScript is a very cool and powerful feature inside the API. I highly recommend you check out these series of blog posts on the Esri blogs to check out some of it’s uses in an application setting.

I wanted to play around with using the GeometryEngine to see what other kind of interactive stuff I could do with it. I also really like Ramda, so I wanted to play around with that too. If you are not familiar with Ramda, I talked about it here, but it’s basically like underscore, but better.

So without too much fussing around, let’s dive right in to some code.

JS Bin on

First off we are going to grab some methods off Ramda and the GeometryEngine that we plan on using.

Next we do some basic stuff like set up a QueryTask, Map and MapView, along with some symbols and graphics layer.

Now we can do some cool stuff and set up some functions we can use to do the heavy lifting for us.

So, we’ve basically used methods like compose and map to create a series of helper methods that can be easily stitched together to build our app.

Now we put everything to work, we first get all the points in the extent of the view. We can then listen for the mousemove event of the view and every time we move the mouse create a buffer of that location and display any points that fall within that buffer on the map.

This is a pretty simple task to show, but it demonstrates how you can use methods like buffer and intersect to do some useful clientside tasks. These barely touch the surface of what you can do with the GeometryEngine, so I encourage you to check out the docs for more info and I’ll be posting up some more samples later on.

Plus it’s really fun to use Ramda with something like the GeometryEngine to transform the data in a workflow!

You can see a full demo here!


Share on Google+0Tweet about this on TwitterShare on Facebook0Share on LinkedIn11Share on Reddit0