Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
max_lat = None
min_lon = None
max_lon = None
for track in self.tracks:
bounds = track.get_bounds()
if not mod_utils.is_numeric(min_lat) or bounds.min_latitude < min_lat:
min_lat = bounds.min_latitude
if not mod_utils.is_numeric(max_lat) or bounds.max_latitude > max_lat:
max_lat = bounds.max_latitude
if not mod_utils.is_numeric(min_lon) or bounds.min_longitude < min_lon:
min_lon = bounds.min_longitude
if not mod_utils.is_numeric(max_lon) or bounds.max_longitude > max_lon:
max_lon = bounds.max_longitude
return GPXBounds(min_lat, max_lat, min_lon, max_lon)
min_lat = None
max_lat = None
min_lon = None
max_lon = None
for point in self.points:
if min_lat is None or point.latitude < min_lat:
min_lat = point.latitude
if max_lat is None or point.latitude > max_lat:
max_lat = point.latitude
if min_lon is None or point.longitude < min_lon:
min_lon = point.longitude
if max_lon is None or point.longitude > max_lon:
max_lon = point.longitude
return GPXBounds(min_lat, max_lat, min_lon, max_lon)
def get_bounds(self):
"""
Get the bounds of the DFTrack
Returns
-------
bounds: gpxpy.GPXBounds
"""
min_lat = self.df['Latitude'].min()
max_lat = self.df['Latitude'].max()
min_lng = self.df['Longitude'].min()
max_lng = self.df['Longitude'].max()
return GPXBounds(min_lat, max_lat, min_lng, max_lng)
max_lat = None
min_lon = None
max_lon = None
for track_segment in self.segments:
bounds = track_segment.get_bounds()
if not mod_utils.is_numeric(min_lat) or (bounds.min_latitude and bounds.min_latitude < min_lat):
min_lat = bounds.min_latitude
if not mod_utils.is_numeric(max_lat) or (bounds.max_latitude and bounds.max_latitude > max_lat):
max_lat = bounds.max_latitude
if not mod_utils.is_numeric(min_lon) or (bounds.min_longitude and bounds.min_longitude < min_lon):
min_lon = bounds.min_longitude
if not mod_utils.is_numeric(max_lon) or (bounds.max_longitude and bounds.max_longitude > max_lon):
max_lon = bounds.max_longitude
return GPXBounds(min_lat, max_lat, min_lon, max_lon)