Skip to content
This repository was archived by the owner on Sep 10, 2024. It is now read-only.
This repository was archived by the owner on Sep 10, 2024. It is now read-only.

Use of meters_to_degrees is inappropriate in Geospatial_Hurricane_Analysis #52

@jeffliu-LL

Description

@jeffliu-LL

The calculation of a buffer around a point is currently done using:
airports.geometry = airports.geometry.buffer(meters_to_degrees(8046.72)) #equal to 5 miles in meters

where the function meters_to_degrees is given by:

def meters_to_degrees(distance_meters):
    
    '''https://sciencing.com/convert-distances-degrees-meters-7858322.html (111,139)'''
    
    distance_degrees = (distance_meters / 111194.926644559) # number derived from matlab calculations
    return distance_degrees

This function is an approximation. There is a better way to do distances in geopandas.

The correct way to do it is to convert the geodataframe from a geographic projection (such as epsg:4326) to one that is natively in meters such as (epsg:3857), do the buffering in that CRS, and then convert back to the original projection.

For example (assuming the airports original crs was epsg:4326):

airports = airports.to_crs(epsg=3857)
airports.geometry = airports.geometry.buffer(8046.72)
airports = airports.to_crs(epsg=4326)

This should be done anywhere meters_to_degrees is used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions