def distance_matrix(self, in_points, in_field, target_points, target_field, matrix_type, nearest_points, output_table): in_points = layers.create_shp(in_points) target_points = layers.create_shp(target_points) self.p.runalg("qgis:distancematrix", in_points, in_field, target_points, target_field, matrix_type, nearest_points, output_table)
def sum_line_lengths(self, in_lines, in_polygons, out_lines, length_field="LENGTH", count_field="COUNT"): in_lines = layers.create_shp(in_lines) in_polygons = layers.create_shp(in_polygons) p.runalg("qgis:sumlinelengths", in_lines, in_polygons, length_field, count_field, out_lines)
def serviceAreas(line_network, starting_point): v1 = layers.create_shp(line_network) director = QgsLineVectorLayerDirector(vl, -1, '', '', '', 3) properter = QgsDistanceArcProperter() director.addProperter(properter) delta = qgis.utils.iface.mapCanvas().getCoordinateTransform().mapUnitsPerPixel() * 1
def serviceAreas(line_network, starting_point): director = layers.create_graph(line_network) properter = QgsDistanceArcProperter() director.addProperter(properter) delta = qgis.utils.iface.mapCanvas().getCoordinateTransform().mapUnitsPerPixel() * 1 # Get the CRS of the line network crs = v1.crs().authid() builder = QgsGraphBuilder(crs) pStart = layers.create_shp(starting_point)
def mean_coordinates( self, in_points, out_point, in_weightfield=None, in_uniquefield=None, ): in_points = layers.create_shp(in_points) self.p.runalg("qgis:meancoordinates", in_points, in_weightfield, in_uniquefield, out_point)
def add_field(in_shp, field_name, field_type, field_length, field_precision, output_layer): in_shp = layers.create_shp(in_shp) if field_type.lower() == "integer": ft = "integer" field_type = 0 elif field_type.lower() == "float": ft = "float" field_type = 1 else: ft = "string" field_type = 2 print("Generating field {} of type {}.".format(field_name, ft)) p.runalg("qgis:addfieldtoattributestable", in_shp, field_name, field_type, field_length, field_precision, output_later)
def add_field(self, in_shp, field_name, field_type, field_length, field_precision, output_layer): in_shp = layers.create_shp(in_shp) if field_type.lower() == "integer": ft = "integer" field_type = 0 elif field_type.lower() == "float": ft = "float" field_type = 1 else: ft = "string" field_type = 2 print("Generating field {} of type {}.".format(field_name, ft)) self.p.runalg("qgis:addfieldtoattributestable", in_shp, field_name, field_type, field_length, field_precision, output_later)
def generate_points_inside_polygon_pixel(self, in_polygon, in_raster, out_points): in_polygon = layers.create_shp(in_polygon) in_raster = layers.create_raster(in_raster) self.p.runalg("qgis:generatepointspixelcentroidsinsidepolygons", in_polygon, in_raster, out_points)
def union(self, in_shp, in_shp2, out_shp): in_shp = layers.create_shp(in_shp) in_shp2 = layers.create_shp(in_shp2) print "ayy" self.p.runalg("qgis:union", in_shp, in_shp2, out_shp)
def erase(self, in_shp, erase_shp, out_shp, ignore_invalid=False): in_shp = layers.create_shp(in_shp) erase_shp = layers.create_shp(erase_shp) self.p.runalg("qgis:difference", in_shp, erase_shp, ignore_invalid, out_shp)
def intersect(self, in_shp, in_shp2, out_shp): in_shp = layers.create_shp(in_shp) in_shp2 = layers.create_shp(in_shp2) self.p.runalg("qgis:intersection", in_shp, in_shp2, out_shp)
def clip(self, in_shp, clip_shp, out_shp): in_shp = layers.create_shp(in_shp) clip_shp = layers.create_shp(clip_shp) self.p.runalg("qgis:clip", in_shp, clip_shp, out_shp)
def intersect(in_shp, in_shp2, out_shp): in_shp = layers.create_shp(in_shp) in_shp2 = layers.create_shp(in_shp2) p.runalg("qgis:intersection", in_shp, in_shp2, out_shp)
def nearest_neighbour(self, in_points, out_html): in_points = layers.create_shp(in_points) self.p.runalg("qgis:nearestneighbouranalysis", in_points, out_html)
def hublines(self, in_hub_points, hub_id_field, in_spoke_points, spoke_id_field, out_hub_lines): in_hub_points = layers.create_shp(in_hub_points) in_spoke_points = layers.create_shp(in_spoke_points) self.p.runalg("qgis:hublines", in_hub_points, hub_id_field, in_spoke_points, spoke_id_field, out_hub_lines)
def clip(in_shp, clip_shp, out_shp): in_shp = layers.create_shp(in_shp) clip_shp = layers.create_shp(clip_shp) p.runalg("qgis:clip", in_shp, clip_shp, out_shp)
def generate_points_along_line_pixel(self, in_line, in_raster, out_points): in_line = layers.create_shp(in_line) in_raster = layers.create_raster(in_raster) self.p.runalg("qgis:generatepointspixelcentroidsalongline", in_line, in_raster, out_points)
def erase(in_shp, erase_shp, out_shp): in_shp = layers.create_shp(in_shp) erase_shp = layers.create_shp(erase_shp) p.runalg("qgis:difference", in_shp, erase_shp, out_shp)
def count_unique_points_in_polygon(self, in_polygon, in_points, unique_field, count_field, out_polygon): in_polygon = layers.create_shp(in_polygon) in_points = layers.create_shp(in_points) self.p.runalg("qgis:countuniquepointsinpolygon", in_polygon, in_points, unique_field, count_field, out_polygon)
def union(in_shp, in_shp2, out_shp): in_shp = layers.create_shp(in_shp) in_shp2 = layers.create_shp(in_shp2) p.runalg("qgis:union", in_shp, in_shp2, out_shp)