def init_from_geospatial_pair(cls, start_geospatial, end_geospatial, geospatials_to_latlngs, elevation_points_to_pylon_points_ratio): arc_length_step_size = (parameters.PYLON_SPACING / elevation_points_to_pylon_points_ratio) geospatials, arc_lengths = util.build_grid(start_geospatial, end_geospatial, arc_length_step_size) latlngs = geospatials_to_latlngs(geospatials) data = cls(geospatials, latlngs, arc_lengths) return data
def compute_land_cost(self): if config.INCLUDE_LAND_COST: edge_is_in_right_of_way = (self.start_point.is_in_right_of_way and self.end_point.is_in_right_of_way) if edge_is_in_right_of_way: self.land_cost = landcover.RIGHT_OF_WAY_LAND_COST else: landcover_geospatials, distances = util.build_grid( self.start_point.geospatial, self.end_point.geospatial, landcover.LAND_POINT_SPACING) landcover_latlngs = self.geospatials_to_latlngs( landcover_geospatials) self.land_cost = landcover.get_land_cost(landcover_latlngs) else: self.land_cost = 0
def spatial_slice_points_builder(abstract_x_coord, spatial_slice_bounds, slice_start_id): spatial_slice_y_spacing = spatial_slice_bounds["ySpacing"] spline_geospatials = spatial_slice_bounds["splineGeospatials"] directions_geospatials = spatial_slice_bounds["directionsGeospatials"] spatial_slice_geospatials, distances = util.build_grid( spline_geospatials, directions_geospatials, spatial_slice_y_spacing) point_id = slice_start_id abstract_y_coord = 0 spatial_slice_points = [] for spatial_slice_geospatial in spatial_slice_geospatials: is_in_right_of_way = (abstract_y_coord == 0) new_spatial_point = SpatialPoint(point_id, abstract_x_coord, abstract_y_coord, spatial_slice_geospatial, is_in_right_of_way) spatial_slice_points.append(new_spatial_point) point_id += 1 abstract_y_coord += 1 return [spatial_slice_points, point_id]