voxcity 0.3.10__py3-none-any.whl → 0.3.12__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of voxcity might be problematic. Click here for more details.

@@ -314,4 +314,8 @@ def load_geojson_from_eubucco(rectangle_vertices, output_dir):
314
314
  raw_data = json.load(f)
315
315
  geojson_data = raw_data['features']
316
316
 
317
+ # Add id to each building's properties
318
+ for i, feature in enumerate(geojson_data):
319
+ feature['properties']['id'] = i + 1
320
+
317
321
  return geojson_data
voxcity/file/geojson.py CHANGED
@@ -58,11 +58,13 @@ def filter_and_convert_gdf_to_geojson(gdf, rectangle_vertices):
58
58
 
59
59
  # Create GeoJSON features from filtered geometries
60
60
  features = []
61
+ feature_id = 1
61
62
  for idx, row in filtered_gdf.iterrows():
62
63
  geom = row['geometry'].__geo_interface__
63
64
  properties = {
64
65
  'height': row['height'],
65
- 'confidence': row['confidence']
66
+ 'confidence': row['confidence'],
67
+ 'id': feature_id
66
68
  }
67
69
 
68
70
  # Handle MultiPolygon by splitting into separate Polygon features
@@ -74,10 +76,11 @@ def filter_and_convert_gdf_to_geojson(gdf, rectangle_vertices):
74
76
  }
75
77
  feature = {
76
78
  'type': 'Feature',
77
- 'properties': properties,
79
+ 'properties': properties.copy(), # Use copy to avoid shared references
78
80
  'geometry': single_geom
79
81
  }
80
82
  features.append(feature)
83
+ feature_id += 1
81
84
  elif geom['type'] == 'Polygon':
82
85
  feature = {
83
86
  'type': 'Feature',
@@ -85,6 +88,7 @@ def filter_and_convert_gdf_to_geojson(gdf, rectangle_vertices):
85
88
  'geometry': geom
86
89
  }
87
90
  features.append(feature)
91
+ feature_id += 1
88
92
  else:
89
93
  pass # Skip other geometry types
90
94
 
voxcity/geo/network.py CHANGED
@@ -3,13 +3,15 @@ import matplotlib.pyplot as plt
3
3
  import numpy as np
4
4
  import pandas as pd
5
5
  import geopandas as gpd
6
- from shapely.geometry import LineString
6
+ from shapely.geometry import LineString, Polygon
7
+ import shapely.ops as ops
7
8
  import networkx as nx
8
9
  import osmnx as ox
9
10
  import os
10
11
  import shapely
11
12
  from shapely.geometry import Point
12
13
  from shapely.ops import transform
14
+ import pyproj
13
15
  from pyproj import Transformer
14
16
  from joblib import Parallel, delayed
15
17
 
@@ -484,6 +486,17 @@ def analyze_network_slopes(
484
486
 
485
487
  # 10) Visualization
486
488
  if settings['vis_graph']:
489
+ # Create a Polygon from the rectangle vertices
490
+ rectangle_polygon = Polygon(rectangle_vertices)
491
+
492
+ # Convert the rectangle polygon to the same CRS as edge_gdf_web
493
+ rectangle_gdf = gpd.GeoDataFrame(index=[0], crs='epsg:4326', geometry=[rectangle_polygon])
494
+ rectangle_gdf_web = rectangle_gdf.to_crs(epsg=3857)
495
+
496
+ # Get the bounding box of the rectangle
497
+ minx, miny, maxx, maxy = rectangle_gdf_web.total_bounds
498
+
499
+ # Plot the edges
487
500
  edge_gdf_web = edge_gdf.to_crs(epsg=3857)
488
501
  fig, ax = plt.subplots(figsize=settings['fig_size'])
489
502
  edge_gdf_web.plot(
@@ -497,9 +510,38 @@ def analyze_network_slopes(
497
510
  alpha=settings['alpha'],
498
511
  legend_kwds={'label': f"{value_name} (%)"}
499
512
  )
513
+
514
+ # Add basemap
500
515
  ctx.add_basemap(ax, source=settings['basemap_style'], zoom=settings['zoom'])
516
+
517
+ # Set the plot limits to the bounding box of the rectangle
518
+ ax.set_xlim(minx, maxx)
519
+ ax.set_ylim(miny, maxy)
520
+
521
+ # Turn off the axis
501
522
  ax.set_axis_off()
523
+
524
+ # Add title
502
525
  plt.title(f'Network {value_name} Analysis', pad=20)
526
+
527
+ # Show the plot
503
528
  plt.show()
529
+ # edge_gdf_web = edge_gdf.to_crs(epsg=3857)
530
+ # fig, ax = plt.subplots(figsize=settings['fig_size'])
531
+ # edge_gdf_web.plot(
532
+ # column=value_name,
533
+ # ax=ax,
534
+ # cmap=settings['colormap'],
535
+ # legend=True,
536
+ # vmin=settings['vmin'],
537
+ # vmax=settings['vmax'],
538
+ # linewidth=settings['edge_width'],
539
+ # alpha=settings['alpha'],
540
+ # legend_kwds={'label': f"{value_name} (%)"}
541
+ # )
542
+ # ctx.add_basemap(ax, source=settings['basemap_style'], zoom=settings['zoom'])
543
+ # ax.set_axis_off()
544
+ # plt.title(f'Network {value_name} Analysis', pad=20)
545
+ # plt.show()
504
546
 
505
547
  return G, edge_gdf
voxcity/sim/solar.py CHANGED
@@ -573,7 +573,7 @@ def get_cumulative_global_solar_irradiance(
573
573
  vmax = kwargs.get("vmax", max(direct_normal_irradiance_scaling, diffuse_irradiance_scaling) * 1000)
574
574
  cmap = plt.cm.get_cmap(colormap).copy()
575
575
  cmap.set_bad(color='lightgray')
576
- plt.figure(figsize=(8, 6))
576
+ plt.figure(figsize=(10, 8))
577
577
  # plt.title(f"Global Solar Irradiance at {time_local.strftime('%Y-%m-%d %H:%M:%S')}")
578
578
  plt.imshow(global_map, origin='lower', cmap=cmap, vmin=vmin, vmax=vmax)
579
579
  plt.axis('off')
@@ -591,7 +591,7 @@ def get_cumulative_global_solar_irradiance(
591
591
  vmax = kwargs.get("vmax", np.nanmax(cumulative_map))
592
592
  cmap = plt.cm.get_cmap(colormap).copy()
593
593
  cmap.set_bad(color='lightgray')
594
- plt.figure(figsize=(8, 6))
594
+ plt.figure(figsize=(10, 8))
595
595
  # plt.title("Cumulative Global Solar Irradiance Map")
596
596
  plt.imshow(cumulative_map, origin='lower', cmap=cmap, vmin=vmin, vmax=vmax)
597
597
  plt.colorbar(label='Cumulative Global Solar Irradiance (W/m²·hour)')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: voxcity
3
- Version: 0.3.10
3
+ Version: 0.3.12
4
4
  Summary: voxcity is an easy and one-stop tool to output 3d city models for microclimate simulation by integrating multiple geospatial open-data
5
5
  Author-email: Kunihiko Fujiwara <kunihiko@nus.edu.sg>
6
6
  Maintainer-email: Kunihiko Fujiwara <kunihiko@nus.edu.sg>
@@ -1,7 +1,7 @@
1
1
  voxcity/__init__.py,sha256=HJM0D2Mv9qpk4JdVzt2SRAAk-hA1D_pCO0ezZH9F7KA,248
2
2
  voxcity/voxcity.py,sha256=tZOgRnyvw4ZHuuJr_QP3qeen5DxhYOkDglNDtpB0hzY,33664
3
3
  voxcity/download/__init__.py,sha256=OgGcGxOXF4tjcEL6DhOnt13DYPTvOigUelp5xIpTqM0,171
4
- voxcity/download/eubucco.py,sha256=e1JXBuUfBptSDvNznSGckRs5Xgrj_SAFxk445J_o4KY,14854
4
+ voxcity/download/eubucco.py,sha256=u2MoAIm_ylMDr1DPqqktcC_KS0iny2IJbFzUlUSvR8o,14993
5
5
  voxcity/download/gee.py,sha256=j7jmzp44T3M6j_4DwhU9Y8Y6gqbZo1zFIlduQPc0jvk,14339
6
6
  voxcity/download/mbfp.py,sha256=aQOGKP0pV6J6MCBXG9J6kQX04_S31rMjJEVvgrgOPg4,3942
7
7
  voxcity/download/oemj.py,sha256=YlCuWBQfi40gfmwQcGDeHiPOs4Pk_jLZq65d5R3IGMU,7886
@@ -11,16 +11,16 @@ voxcity/download/overture.py,sha256=daOvsySC2KIcTcMJUSA7XdbMELJuyLAIM2vr1DRLGp0,
11
11
  voxcity/download/utils.py,sha256=z6MdPxM96FWQVqvZW2Eg5pMewVHVysUP7F6ueeCwMfI,1375
12
12
  voxcity/file/__init_.py,sha256=cVyNyE6axEpSd3CT5hGuMOAlOyU1p8lVP4jkF1-0Ad8,94
13
13
  voxcity/file/envimet.py,sha256=SPVoSyYTMNyDRDFWsI0YAsIsb6yt_SXZeDUlhyqlEqY,24282
14
- voxcity/file/geojson.py,sha256=h6WYr1bdvzC46w6CbjKzO4wMtVrKTSF7SGaOUuUMkCM,33412
14
+ voxcity/file/geojson.py,sha256=dZTRkz4LQspWdNyfJZuwsymSeKqhx0v-bF-L9_1iudg,33571
15
15
  voxcity/file/magicavoxel.py,sha256=Fsv7yGRXeKmp82xcG3rOb0t_HtoqltNq2tHl08xVlqY,7500
16
16
  voxcity/file/obj.py,sha256=oW-kPoZj53nfmO9tXP3Wvizq6Kkjh-QQR8UBexRuMiI,21609
17
17
  voxcity/geo/__init_.py,sha256=AZYQxK1zY1M_mDT1HmgcdVI86OAtwK7CNo3AOScLHco,88
18
18
  voxcity/geo/draw.py,sha256=roljWXyqYdsWYkmb-5_WNxrJrfV5lnAt8uZblCCo_3Q,13555
19
19
  voxcity/geo/grid.py,sha256=_MzO-Cu2GhlP9nuCql6f1pfbU2_OAL27aQ_zCj1u_zk,36288
20
- voxcity/geo/network.py,sha256=P1oaosieFPuWj9QbU9VmZHpoXV3HR61VssZMcUZLYIw,17403
20
+ voxcity/geo/network.py,sha256=egAHsqVYNcDIPPHv0RnVBQCLpfsdsWXf0ltrkZi2V7A,18905
21
21
  voxcity/geo/utils.py,sha256=1BRHp-DDeOA8HG8jplY7Eo75G3oXkVGL6DGONL4BA8A,19815
22
22
  voxcity/sim/__init_.py,sha256=APdkcdaovj0v_RPOaA4SBvFUKT2RM7Hxuuz3Sux4gCo,65
23
- voxcity/sim/solar.py,sha256=wpnDC3BAm4edx5Z-dz2g_5rqnFNi_YKXneHY2RVBk1w,31968
23
+ voxcity/sim/solar.py,sha256=ddzEjN9s9zEABMPu1S0k-NXlNtIYDl12EAwiaaASJs0,31970
24
24
  voxcity/sim/utils.py,sha256=sEYBB2-hLJxTiXQps1_-Fi7t1HN3-1OPOvBCWtgIisA,130
25
25
  voxcity/sim/view.py,sha256=FoXovh406hmvL1obaIXi2MyiRnPdXHY9SWxqfqmcJnc,36758
26
26
  voxcity/utils/__init_.py,sha256=nLYrj2huBbDBNMqfchCwexGP8Tlt9O_XluVDG7MoFkw,98
@@ -28,9 +28,9 @@ voxcity/utils/lc.py,sha256=RwPd-VY3POV3gTrBhM7TubgGb9MCd3nVah_G8iUEF7k,11562
28
28
  voxcity/utils/material.py,sha256=Vt3IID5Ft54HNJcEC4zi31BCPqi_687X3CSp7rXaRVY,5907
29
29
  voxcity/utils/visualization.py,sha256=FNBMN0V5IPuAdqvLHnqSGYqNS7jWesg0ZADEtsUtl0A,31925
30
30
  voxcity/utils/weather.py,sha256=P6s1y_EstBL1OGP_MR_6u3vr-t6Uawg8uDckJnoI7FI,21482
31
- voxcity-0.3.10.dist-info/AUTHORS.rst,sha256=m82vkI5QokEGdcHof2OxK39lf81w1P58kG9ZNNAKS9U,175
32
- voxcity-0.3.10.dist-info/LICENSE,sha256=-hGliOFiwUrUSoZiB5WF90xXGqinKyqiDI2t6hrnam8,1087
33
- voxcity-0.3.10.dist-info/METADATA,sha256=Lf4DIH1_hPKyQkxAset4cMlL5dJWwHosXpBgj6Ybta8,25122
34
- voxcity-0.3.10.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
35
- voxcity-0.3.10.dist-info/top_level.txt,sha256=00b2U-LKfDllt6RL1R33MXie5MvxzUFye0NGD96t_8I,8
36
- voxcity-0.3.10.dist-info/RECORD,,
31
+ voxcity-0.3.12.dist-info/AUTHORS.rst,sha256=m82vkI5QokEGdcHof2OxK39lf81w1P58kG9ZNNAKS9U,175
32
+ voxcity-0.3.12.dist-info/LICENSE,sha256=-hGliOFiwUrUSoZiB5WF90xXGqinKyqiDI2t6hrnam8,1087
33
+ voxcity-0.3.12.dist-info/METADATA,sha256=ASX53F7pGZnhPvOD8PSO5Sg_6TMbsdo5r9YDaNy6wV4,25122
34
+ voxcity-0.3.12.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
35
+ voxcity-0.3.12.dist-info/top_level.txt,sha256=00b2U-LKfDllt6RL1R33MXie5MvxzUFye0NGD96t_8I,8
36
+ voxcity-0.3.12.dist-info/RECORD,,