def get_array(self, num_points):
     u_new = np.linspace(self.u.min(), self.u.max(), num_points)
     lat_smooth, lon_smooth = si.splev(u_new, self.tck, der=0)
     smoothed = []
     for lat, lon in zip(lat_smooth, lon_smooth):
         smoothed.append(gps_tools.GpsPoint(lat, lon))
     return smoothed
Exemple #2
0
# get_decimal_coordinates(exif['GPSInfo'])

import os
import sys
sys.path.append('../vehicle')
import gps_tools
#GpsPoint = namedtuple('GpsPoint', 'lat lon')

points = []
target = "DJI_0635.JPG"
path = "/home/taylor/Pictures/mapping/cap_dec_2_2020/images/"

target_path = os.path.join(path, target)
target_coords = get_decimal_coordinates(get_exif(target_path))
target_gps = gps_tools.GpsPoint(target_coords[0], target_coords[1])

for r, d, f in os.walk(path):
    for file in f:
        if file.lower().endswith(('.png', '.jpg', '.jpeg')):
            filepath = os.path.join(r, file)
            coords = get_decimal_coordinates(get_exif(filepath))
            gps_point = gps_tools.GpsPoint(coords[0], coords[1])
            distance = gps_tools.get_distance(target_gps, gps_point)
            if coords is not None and distance < 50:
                points.append(
                    (coords[0], coords[1], os.path.basename(filepath)))

index = 0
# exif = get_exif('/home/taylor/Pictures/mapping/cap_dec_2_2020/images/DJI_0173.JPG')
# coords = get_decimal_coordinates(exif)
if USE_DATABASE:
    poly_path = None
    for key in r.scan_iter():
        #logger.info(key)
        if 'gpspolygon' in str(key):
            logger.info(key)
            polygon = pickle.loads(r.get(key))
            #logger.info(polygon["geometry"]["coordinates"][0])
            polygon = polygon["geometry"]["coordinates"][0]
            logger.info(polygon)
            # sys.exit()
    #BASE_LOCATION = (polygon[0][1],polygon[0][0])
    #SECOND_POINT = (polygon[1][1],polygon[1][0])
    if GRID_VERSION == NORTH_ALIGNED_4_METER_GRID:
        BASE_LOCATION = (37.3535689340, -122.3294015900)
        point = gps_tools.project_point(gps_tools.GpsPoint(
            BASE_LOCATION[0], BASE_LOCATION[1]),
                                        bearing=0,
                                        distance_meters=10)
        SECOND_POINT = (point.lat, point.lon)
else:

    if GRID_VERSION == ROAD_ALIGNED_8_METER_GRID:
        BASE_LOCATION = (37.3535689340, -122.3294015900)
        SECOND_POINT = (37.3534222740, -122.3291569190)
    if GRID_VERSION == NORTH_ALIGNED_4_METER_GRID:
        BASE_LOCATION = (37.3535689340, -122.3294015900)
        point = gps_tools.project_point(gps_tools.GpsPoint(
            BASE_LOCATION[0], BASE_LOCATION[1]),
                                        bearing=0,
                                        distance_meters=10)
        SECOND_POINT = (point.lat, point.lon)
 def coordAtU(self, u):
     coord = si.splev(u, self.tck)
     coord = gps_tools.GpsPoint(float(coord[0]), float(coord[1]))
     return coord