Tool for google maps using python
<p>I need to develop a tool (eg: calculate polygon area) and integrate it with Google Maps. I am not familiar with java. Can I do this using python? If yes, how can I go about integrating my code with Maps?</p>

<p>You can do it, using <strong>OpenStreetMap</strong> instead of Google map, in <strong>IPython/Jupyter Notebook</strong>, through <strong>ipyleaflet</strong> package.
Just write(or import) your script in Ipython Notebook(a python based env.) and then take a look at here;</p>

<p><a href="https://github.com/ellisonbg/ipyleaflet/tree/master/examples" rel="nofollow">https://github.com/ellisonbg/ipyleaflet/tree/master/examples</a></p>

<p>you will be able to draw whatever you want defining new <strong>Layer</strong> and so on...</p>

<h1>Here an example:</h1>

<h3>Open your Ipython Notebook and import these modules;</h3>

<pre><code>from ipyleaflet import (
     Map,
     Marker,
     TileLayer, ImageOverlay,
     Polyline, Polygon, Rectangle, Circle, CircleMarker,
     GeoJSON,
     DrawControl
)

m = Map(zoom=0)
dc = DrawControl()
def handle_draw(self, action, geo_json):
    print(action)
    print(geo_json)
dc.on_draw(handle_draw)
m.add_control(dc)
m
</code></pre>

<h3>The map will be appeared</h3>

<p><a href="https://i.stack.imgur.com/e5XhK.jpg" rel="nofollow"><img src="https://i.stack.imgur.com/e5XhK.jpg" alt="OpenStreetMap with drawing tools on the left hand side"></a></p>

<h3>Zoom by double clicking on the your interesting spot, then draw your polygon using "Draw a polygon" item.</h3>

<p><a href="https://i.stack.imgur.com/OeZhj.jpg" rel="nofollow"><img src="https://i.stack.imgur.com/OeZhj.jpg" alt="enter image description here"></a></p>

<h3>This is just a suggestion, you can use other methods to calculate the polygon's area</h3>

<pre><code>import pyproj    
import shapely
import shapely.ops as ops
from shapely.geometry.polygon import Polygon
from functools import partial
my_poly = dc.last_draw['geometry']['coordinates'][0]
geom = Polygon(my_poly)
geom_area = ops.transform(
partial(
    pyproj.transform,
    pyproj.Proj(init='EPSG:4326'),
    pyproj.Proj(
        proj='aea',
        lat1=geom.bounds[1],
        lat2=geom.bounds[3])),
geom)
print (geom_area.area, 'square meters, which is equal to',geom_area.area/1000000, 'square kilometers')
</code></pre>

<p>2320899322382.008 square meters, which is equal to 2320899.3223820077 square kilometers</p>

python