I have no knowledge or experience related to geosciences. I have a list of addresses from Rio and I used GeoPy's geocoding (the Google API) to find the coordinates associated with these addresses. This gives me a geometry of (latitude, longitude, altitude) trios. Then, I construct a GeoDataFrame with this combined information. I then use .set_crs(epsg=4326,inplace=True)
to inform the lat-lon crs.
However, when I try to plot this data, or use the .explore()
method to see the interactive map, the results are way off:
When I reverse the latitude and longitude coordinates, it works as I would expect
Why is GeoPandas seemingly reading the coordinates in the incorrect order?
Edit
A MRE goes as follows:
from geopy.geocoders import GoogleV3
geolocator = GoogleV3(api_key=API_KEY)
# Example using a street from Rio
response = geolocator.geocode(query = 'RUA COLIDER, RJ')
response
Location(Rua Colider - Campo Grande, Rio de Janeiro - RJ, 23047-390, Brazil, (-22.9257627, -43.5650209, 0.0))
# Creating the GeoDataFrame
gdf = gpd.GeoDataFrame(gdf, geometry = [Point(response.point.latitude, response.point.longitude)])
gdf.set_crs(epsg=4326, inplace=True)
gdf.explore()
Where it actually is (from https://www.gps-coordinates.net/):