diff --git a/generic_functions.py b/generic_functions.py index 5385a4d..1b4e773 100755 --- a/generic_functions.py +++ b/generic_functions.py @@ -146,12 +146,17 @@ def gen_centroids_layer(inputlayer,outputlayer='TEMPORARY_OUTPUT',for_allparts=F return processing.run('native:centroids',parameter_dict)['OUTPUT'] +def gen_voronoi_polygons_layer(inputlayer,outputlayer='TEMPORARY_OUTPUT',buffer_perc=300): + parameter_dict = {'INPUT': inputlayer, 'OUTPUT': outputlayer,'BUFFER':buffer_perc} + + return processing.run('qgis:voronoipolygons',parameter_dict)['OUTPUT'] + def get_intersections(inputlayer,intersect_layer,outputlayer): parameter_dict = {'INPUT': inputlayer, 'INTERSECT': intersect_layer, 'OUTPUT': outputlayer} return processing.run('qgis:lineintersections',parameter_dict)['OUTPUT'] -def cliplayer_v2(inputlayer,overlay_lyr,outputlayer): +def cliplayer_v2(inputlayer,overlay_lyr,outputlayer='TEMPORARY_OUTPUT'): """ the first one was intended for datafiles, not memeory layers """ diff --git a/metadata.txt b/metadata.txt index 0c79dd5..83c656a 100644 --- a/metadata.txt +++ b/metadata.txt @@ -6,7 +6,7 @@ name=OSM SidewalKreator qgisMinimumVersion=3.14 description=Plugin designated to create the Geometries of Sidewalks (separated from streets) based on OpenStreetMap Streets, given a bounding polygon, outputting to a .geojson to be imported on JOSM. It is mostly intended for acessibility Mapping. -version=0.9 +version=0.10 author=Kaue de Moraes Vestena email=kauemv2@gmail.com diff --git a/osm_sidewalkreator.py b/osm_sidewalkreator.py index 0433932..0576524 100755 --- a/osm_sidewalkreator.py +++ b/osm_sidewalkreator.py @@ -555,6 +555,17 @@ def data_clean(self): self.filtered_intersection_points.setCrs(self.custom_localTM_crs) + # creating a voronoi polygons layer for the road_intersections, that may be used for validation projects + road_intersection_voronois_0 = gen_voronoi_polygons_layer(self.filtered_intersection_points) + road_intersection_voronois_0.setCrs(self.custom_localTM_crs) + + # TODO: check if will always work properly without being on same CRS + self.road_intersection_voronois = cliplayer_v2(road_intersection_voronois_0,self.only_inputfeature_layer) + self.road_intersection_voronois.setCrs(self.custom_localTM_crs) + + + # self.add_layer_canvas(self.road_intersection_voronois) + #### checking if there's a "width" column, adding if not: if not widths_fieldname in get_column_names(self.splitted_lines): @@ -2917,7 +2928,7 @@ def outputting_files(self): osm_query_string_by_bbox(self.minLat,self.minLgt,self.maxLat,self.maxLgt,interest_key='footway',interest_value='crossing',dump_path=overpass_kerbs_path,node=True,way=False) # dumping extra layers: - extra_layers = {'inner_crossings':self.inner_crossings_layer,'raw_buffers':self.proto_undissolved_buffer_step1} + extra_layers = {self.string_according_language('inner_crossings','cruzamentos interiores'):self.filtered_intersection_points,self.string_according_language('raw_buffers','buffers_originais'):self.proto_undissolved_buffer_step1,self.string_according_language('crossing_centers_voronois','voronois_intersecoes_ruas'):self.road_intersection_voronois} for key in extra_layers: self.reproject_and_export(key,extra_layers[key]) @@ -2932,7 +2943,7 @@ def outputting_files(self): # the sucess message in the QGIS GUI: sucess_category = self.string_according_language("Sucess",'Sucesso') - sucess_message = self.string_according_language("You Can Now Proceed To JOSM, importing the output GEOJSON and changeset comment!!!",'Você pode proceder ao JOSM e importar o GEOJSON de saída e o comentário para o changeset!!!') + sucess_message = self.string_according_language("You Can Now Proceed To JOSM, import the output GEOJSON and changeset comment!!!",'Você pode proceder ao JOSM e importar o GEOJSON de saída e o comentário para o changeset!!!') iface.messageBar().pushMessage(sucess_category,sucess_message, level=Qgis.Success,duration=30) diff --git a/test/extra_tests/sandbox.py b/test/extra_tests/sandbox.py index d5b5b06..1d4d51d 100644 --- a/test/extra_tests/sandbox.py +++ b/test/extra_tests/sandbox.py @@ -1,4 +1,6 @@ -a = {'b':1,'c':2} +def return_string(): + return "aa" -if 'b' in a: - print(a['b']) \ No newline at end of file +a = {return_string():1} + +print(a) \ No newline at end of file