Skip to content

Commit

Permalink
road intersection voronois and 0.10 release
Browse files Browse the repository at this point in the history
  • Loading branch information
kauevestena committed May 9, 2022
1 parent a63f3c9 commit 4f93f60
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
7 changes: 6 additions & 1 deletion generic_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand Down
2 changes: 1 addition & 1 deletion metadata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
15 changes: 13 additions & 2 deletions osm_sidewalkreator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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])
Expand All @@ -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)

Expand Down
8 changes: 5 additions & 3 deletions test/extra_tests/sandbox.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
a = {'b':1,'c':2}
def return_string():
return "aa"

if 'b' in a:
print(a['b'])
a = {return_string():1}

print(a)

0 comments on commit 4f93f60

Please sign in to comment.