How to get Polygon coordinates from a python city?

Asked

Viewed 41 times

-4

Good, to get the coordinates(lat,long) of a city with you using geolocator.geocode, but need to get the coordinates Polygon(the whole area of the city), someone knows of another library that return me the coordinates Polygon of the city?

This example concerns the city Arrecife

using geolocator.geocode, only gives me latitude and longitude info.

inserir a descrição da imagem aqui

1 answer

0


Use the library geopandas, download the shapefile of Brazil or the state in question can be here NEREUS and then open the file . shp

br = gpd.read_file('gadm36_BRA_1.shp')

You will get a geoDataFrame: geodataframe

As you can see in the Geometry column has polygons and multipoligos.

Note: Download a shapefile that has all the cities and Filtre the one you want.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.