0

I measured GIS distance from a point (latitude, longitude) to the target boundary using geopandas according to this post gis calculate distance between point and polygon / border. My code is the following.

import geopandas as gpd
from shapely.geometry import LineString, Point
import pandas as pd

TH_borders = gpd.read_file(os.path.join('gadm36_THA_0.shp'))
point = Point(16.7091717,98.572205)
print(point.distance(TH_borders.geometry[0]))

The shape file (latitude, longitude coordination) for TH_boarders can get from https://gadm.org/download_country_v3.html. The above code returns the results as follows

113.2216551338134 

I'm wondering what is the unit of measure for that results. May I have your suggestion?

1 Answers1

3

The units for geographic coordinates are in degrees. Please note that uncorrected distances using geographic coordinates do not accurately represent real distances. You should not use this calculation as-is.

Note: your coordinates do not appear correct, it should be Point(98.52..., 16.709...). The order is x (longitude), y (latitude); 98 is not a valid latitude.

There is work underway in GeoPandas to add a warning for this case in the upcoming version, and adding geodesic calculations so that distances are calculated correctly for these coordinates.

For now, you should project your data frame to an appropriate planar coordinate system. See: https://geopandas.org/projections.html Which planar projection to use is very much dependent on your locations and your need for accuracy.

bcward
  • 101
  • 2