# Using geometry functions¶

This notebook uses the `arcgis.geometry` module to compute the length of a path that the user draws on the map.

The particular scenario is of a jogger who runs in the Central Park in New York (without gizmos like GPS watches to distract him), and wants a rough estimate of his daily runs based on the path he takes. The notebook starts out with a satellite map of Central Park in New York:

In :
```from arcgis.gis import GIS
from arcgis.geocoding import geocode
from arcgis.geometry import lengths
```
In :
```gis = GIS()
```
In :
```map1 = gis.map()
map1.basemap = "satellite"
```
In :
```map1
```
Out: In :
```map1.height = '650px'
```
In :
```location = geocode("Central Park, New York")
map1.extent = location['extent']
```
In :
```map1.zoom = 14
```

We want the user to draw a freehand polyline to indicate the paths that he takes for his runs. When the drawing operation ends, we use the GIS's Geometry service to compute the length of the drawn path. We can do this by adding an event listener to the map widget that gets called when drawing is completed (i.e. on_draw_end). The event listener then computes the geodesic length of the drawn geometry using the geometry service and prints it out:

In :
```# Define the callback function that computes the length.
def calc_dist(map1, g):
print("Computing length of drawn polyline...")
length = lengths(g['spatialReference'], [g], "", "geodesic")
print("Length: " + str(length) + " m.")

# Set calc_dist as the callback function to be invoked when a polyline is drawn on the map
map1.on_draw_end(calc_dist)
```
In :
```map1.draw("polyline")
```

Now draw a polygon on the map representing the route taken by the jogger

In :
```map1.clear_graphics()
```

Feedback on this topic?