My objective is to make a tool to calculate the area of any user defined polygon on the map using a python code. I tried doing this with OpenStreetMap.

My approach is: Open a map and select points on the map which will be the vertices of the polygon. Export the lat long of these vertices into a python code which will calculate the area of the polygon. Integrate this python code into the map so that the area which is the output of the python code is displayed on the map. Is this approach right?

The edit option allows us to draw polygons. enter image description here

But when I try exporting this, it leaves the page. How do I get an xml file (or preferably the coordinates) of only the polygon that is marked?

enter image description here

I have marked a polygon in umap. How do I export the coordinates?

  • Have you evaluated other options, such as Google maps api? If you know Python, using jscript would not be that hard.
    – fatih_dur
    Oct 11, 2016 at 13:41
  • I would prefer doing it using python. Oct 11, 2016 at 13:53

1 Answer 1


The screenshot in your question shows the OSM editor iD. This is really an editor intended to add raw data to the OSM database. It is not intended for marking things on the map or for creating custom polygons.

If you really want to create arbitrary polygons and export them in OSM XML format then consider using JOSM. JOSM allows you to edit local OSM XML files. Please don't upload these changes to the global OSM database.

Alternatively consider using umap or something similar.

  • According to this answer umap offers an option to download your raw data. It is located behind the "Embed and share this map" button.
    – scai
    Oct 11, 2016 at 15:54
  • This works. Thanks :) Can I integrate a python code, which calculates the area from these exported coordinates, into umap so that the output of the code is displayed on the map? Oct 11, 2016 at 17:05
  • No idea, sorry. I've never used umap myself.
    – scai
    Oct 12, 2016 at 6:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.