Search code examples
pythongridviewgeolocation

How to plot a rectangular grid on word map?


I've the coordinates(Latitude, Longitude) of the 4 corners of all the 300 grids that I want to plot on the world map. How do I do it in python?

The grids' coordinates are stored in excel/Csv file with the headers : "Box Number", "Top left coordinate", "Top right coordinate", "Bottom left coordinate" and "Bottom right coordinate".

How do I plot it in python?

enter image description here


Solution

  • top_left_coordinates = (float(values[2]),float(values[1]))
    bottom_right_coordinates = (float(values[2])- difference,float(values[3]))     
     folium.Rectangle([top_left_coordinates,bottom_right_coordinates]).add_child(folium.Popup(values[0])).add_to(mapobj)
    
    mapobj.save('map.html')