@@ -46,6 +46,13 @@ def draw(
4646 flinger : MercatorFlinger = MercatorFlinger (
4747 boundary_box , 18 , osm_data .equator_length
4848 )
49+ frequency_path : Path = Path ("work" , "frequency.txt" )
50+ with frequency_path .open () as input_file :
51+ frequency_lines : list [str ] = input_file .readlines ()
52+ with frequency_path .open ("a" ) as output_file :
53+ line : str = f"{ boundary_box .get_format ()} { len (osm_data .nodes )} \n "
54+ if line not in frequency_lines :
55+ output_file .write (line )
4956
5057 svg : Drawing = Drawing (output_path .name , flinger .size )
5158
@@ -76,6 +83,7 @@ def _parse_coordinates(string: str) -> np.ndarray:
7683def _write_page (
7784 x : int ,
7885 y : int ,
86+ point : np .ndarray ,
7987 svg_paths : dict [str , Path ],
8088 output_path : Path ,
8189) -> None :
@@ -149,6 +157,13 @@ def _write_page(
149157 "}"
150158 )
151159
160+ a = SubElement (body , "a" )
161+ a .set (
162+ "href" ,
163+ f"https://www.openstreetmap.org/edit#map=18/{ point [0 ]} /{ point [1 ]} " ,
164+ )
165+ a .text = "Edit OSM"
166+
152167 with output_path .open ("wb+" ) as output_file :
153168 ElementTree (root ).write (output_file , method = "html" )
154169
@@ -169,9 +184,11 @@ def main(arguments: argparse.Namespace) -> None:
169184 "Amsterdam" : BoundingBox (4.73 , 52.32 , 4.94 , 52.42 ),
170185 "Berlin" : BoundingBox (13.29 , 52.41 , 13.48 , 52.60 ),
171186 "Buenos Aires" : BoundingBox (- 58.61 , - 34.69 , - 58.35 , - 34.56 ),
187+ "Canberra" : BoundingBox (149.01 , - 35.34 , 149.18 , - 35.18 ),
188+ "Habana" : BoundingBox (- 82.41 , 23.03 , - 82.3 , 23.14 ),
172189 "Kinshasa" : BoundingBox (15.24 , - 4.39 , 15.33 , - 4.30 ),
173190 "Lubumbashi" : BoundingBox (27.44 , - 11.70 , 27.51 , - 11.61 ),
174- "Los Angeles" : BoundingBox (- 118.41 , 33.75 , - 117.94 , 34.11 ),
191+ # "Los Angeles": BoundingBox(-118.41, 33.75, -117.94, 34.11),
175192 "Mexico" : BoundingBox (- 99.26 , 19.28 , - 99.04 , 19.52 ),
176193 "Moscow center" : BoundingBox (37.49 , 55.69 , 37.73 , 55.81 ),
177194 "New Delhi" : BoundingBox (77.01 , 28.53 , 77.39 , 28.74 ),
@@ -197,7 +214,6 @@ def main(arguments: argparse.Namespace) -> None:
197214 )
198215 )
199216 logger .info (city )
200- logger .info ("%s,%s" , str (point [0 ]), str (point [1 ]))
201217 break
202218
203219 if point is not None :
@@ -210,22 +226,13 @@ def main(arguments: argparse.Namespace) -> None:
210226 x , y = tile_1 .x , tile_1 .y
211227 tile_2 : Tile = Tile (x + 2 , y + 1 , 18 )
212228
213- tile_3 : Tile = Tile (x + 3 , y + 2 , 18 )
214- p1 = tile_1 .get_coordinates ()
215- p2 = tile_3 .get_coordinates ()
216- p = (p1 + p2 ) / 2
217- logger .info (p )
218- logger .info ("https://www.openstreetmap.org/edit#map=18/%s/%s" , p [0 ], p [1 ])
219-
220229 boundary_box : BoundingBox = tile_1 .get_bounding_box ()
221230 boundary_box .combine (tile_2 .get_bounding_box ())
222231
223232 tile_list : list [Tile ] = [
224233 Tile (i , j , 18 ) for j in (y , y + 1 ) for i in (x , x + 1 , x + 2 )
225234 ]
226-
227235 tiles : Tiles = Tiles (tile_list , tile_1 , tile_2 , 18 , boundary_box )
228- osm_data : OSMData = tiles .load_osm_data (Path ("cache" ))
229236
230237 svg_paths : dict [str , Path ] = {}
231238
@@ -244,19 +251,12 @@ def main(arguments: argparse.Namespace) -> None:
244251 )
245252 if scheme_id == "default" :
246253 configuration .building_color_mode = BuildingColorMode .HUE
247- tiles .draw (
248- Path ("out/tiles" ),
249- Path ("cache" ),
250- configuration ,
251- osm_data ,
252- redraw = True ,
253- )
254254
255255 svg_path = Path (f"out/random_{ scheme_id } .svg" )
256256 draw (tiles .bounding_box , configuration , svg_path )
257257 svg_paths [scheme_id ] = svg_path
258258
259- _write_page (x , y , svg_paths , Path ("out/output.html" ))
259+ _write_page (x , y , point , svg_paths , Path ("out/output.html" ))
260260
261261
262262if __name__ == "__main__" :
0 commit comments