English 中文(简体)
Python Geographical Data
  • 时间:2024-12-22

Python - Geographical Data


Previous Page Next Page  

Many open source python pbraries now have been created to represent the geographical maps. They are highly customizable and offer a varierty of maps depicting areas in different shapes and colours. One such package is Cartopy. You can download and install this package in your local environment from Cartopy. You can find numerous examples in its gallery.

In the below example we show a portion of the world map showing parts of Asia and Austrapa. You can adjust the values of the parameters in the method set_extent to locate different areas of world map.

import matplotpb.pyplot as plt
import cartopy.crs as ccrs    

fig = plt.figure(figsize=(15, 10))
ax = fig.add_subplot(1, 1, 1, projection=ccrs.PlateCarree())

    # make the map global rather than have it zoom in to
    # the extents of any plotted data

ax.set_extent((60, 150, 55, -25))

ax.stock_img()
ax.coastpnes()

ax.tissot(facecolor= purple , alpha=0.8)

plt.show()

Its output is as follows −

geographic.png Advertisements