voxcity 0.3.13__py3-none-any.whl → 0.3.15__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.

@@ -775,5 +775,140 @@ def visualize_numerical_grid_on_basemap(grid, rectangle_vertices, meshsize, valu
775
775
  # Set title and remove axes
776
776
  ax.set_axis_off()
777
777
 
778
+ plt.tight_layout()
779
+ plt.show()
780
+
781
+ def visualize_numerical_grid_gdf_on_basemap(gdf, value_name="value", cmap='viridis', vmin=None, vmax=None,
782
+ alpha=0.6, figsize=(12, 8), basemap='CartoDB light',
783
+ show_edge=False, edge_color='black', edge_width=0.5):
784
+ """Visualizes a GeoDataFrame with numerical values on a basemap.
785
+
786
+ Args:
787
+ gdf: GeoDataFrame containing grid cells with 'geometry' and 'value' columns
788
+ value_name: Name of the value column and legend label (default: "value")
789
+ cmap: Colormap to use (default: 'viridis')
790
+ vmin: Minimum value for colormap scaling (default: None)
791
+ vmax: Maximum value for colormap scaling (default: None)
792
+ alpha: Transparency of the grid overlay (default: 0.6)
793
+ figsize: Figure size in inches (default: (12, 8))
794
+ basemap: Basemap style (default: 'CartoDB light')
795
+ show_edge: Whether to show cell edges (default: False)
796
+ edge_color: Color of cell edges (default: 'black')
797
+ edge_width: Width of cell edges (default: 0.5)
798
+ """
799
+ # Convert to Web Mercator if not already in that CRS
800
+ if gdf.crs != 'EPSG:3857':
801
+ gdf_web = gdf.to_crs(epsg=3857)
802
+ else:
803
+ gdf_web = gdf
804
+
805
+ # Create figure and axis
806
+ fig, ax = plt.subplots(figsize=figsize)
807
+
808
+ # Plot the GeoDataFrame
809
+ gdf_web.plot(column='value',
810
+ ax=ax,
811
+ alpha=alpha,
812
+ cmap=cmap,
813
+ vmin=vmin,
814
+ vmax=vmax,
815
+ legend=True,
816
+ legend_kwds={'label': value_name},
817
+ edgecolor=edge_color if show_edge else 'none',
818
+ linewidth=edge_width if show_edge else 0)
819
+
820
+ # Add basemap
821
+ basemaps = {
822
+ 'CartoDB dark': ctx.providers.CartoDB.DarkMatter,
823
+ 'CartoDB light': ctx.providers.CartoDB.Positron,
824
+ 'CartoDB voyager': ctx.providers.CartoDB.Voyager,
825
+ 'CartoDB light no labels': ctx.providers.CartoDB.PositronNoLabels,
826
+ 'CartoDB dark no labels': ctx.providers.CartoDB.DarkMatterNoLabels,
827
+ }
828
+ ctx.add_basemap(ax, source=basemaps[basemap])
829
+
830
+ # Set title and remove axes
831
+ ax.set_axis_off()
832
+
833
+ plt.tight_layout()
834
+ plt.show()
835
+
836
+ def visualize_point_grid_on_basemap(point_gdf, value_name='value', **kwargs):
837
+ """Visualizes a point GeoDataFrame on a basemap with colors based on values.
838
+
839
+ Args:
840
+ point_gdf: GeoDataFrame with point geometries and values
841
+ value_name: Name of the column containing values to visualize (default: 'value')
842
+ **kwargs: Optional visualization parameters including:
843
+ - figsize: Tuple for figure size (default: (12, 8))
844
+ - colormap: Matplotlib colormap name (default: 'viridis')
845
+ - markersize: Size of points (default: 20)
846
+ - alpha: Transparency of points (default: 0.7)
847
+ - vmin: Minimum value for colormap scaling (default: None)
848
+ - vmax: Maximum value for colormap scaling (default: None)
849
+ - title: Plot title (default: None)
850
+ - basemap_style: Contextily basemap style (default: CartoDB.Positron)
851
+ - zoom: Basemap zoom level (default: 15)
852
+
853
+ Returns:
854
+ matplotlib figure and axis objects
855
+ """
856
+ import matplotlib.pyplot as plt
857
+ import contextily as ctx
858
+
859
+ # Set default parameters
860
+ defaults = {
861
+ 'figsize': (12, 8),
862
+ 'colormap': 'viridis',
863
+ 'markersize': 20,
864
+ 'alpha': 0.7,
865
+ 'vmin': None,
866
+ 'vmax': None,
867
+ 'title': None,
868
+ 'basemap_style': ctx.providers.CartoDB.Positron,
869
+ 'zoom': 15
870
+ }
871
+
872
+ # Update defaults with provided kwargs
873
+ settings = {**defaults, **kwargs}
874
+
875
+ # Create figure and axis
876
+ fig, ax = plt.subplots(figsize=settings['figsize'])
877
+
878
+ # Convert to Web Mercator for basemap compatibility
879
+ point_gdf_web = point_gdf.to_crs(epsg=3857)
880
+
881
+ # Plot points
882
+ scatter = point_gdf_web.plot(
883
+ column=value_name,
884
+ ax=ax,
885
+ cmap=settings['colormap'],
886
+ markersize=settings['markersize'],
887
+ alpha=settings['alpha'],
888
+ vmin=settings['vmin'],
889
+ vmax=settings['vmax'],
890
+ legend=True,
891
+ legend_kwds={
892
+ 'label': value_name,
893
+ 'orientation': 'vertical',
894
+ 'shrink': 0.8
895
+ }
896
+ )
897
+
898
+ # Add basemap
899
+ ctx.add_basemap(
900
+ ax,
901
+ source=settings['basemap_style'],
902
+ zoom=settings['zoom']
903
+ )
904
+
905
+ # Set title if provided
906
+ if settings['title']:
907
+ plt.title(settings['title'])
908
+
909
+ # Remove axes
910
+ ax.set_axis_off()
911
+
912
+ # Adjust layout to prevent colorbar cutoff
778
913
  plt.tight_layout()
779
914
  plt.show()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: voxcity
3
- Version: 0.3.13
3
+ Version: 0.3.15
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>
@@ -225,7 +225,7 @@ from voxcity import get_voxcity
225
225
 
226
226
  voxcity_grid, building_height_grid, building_min_height_grid, \
227
227
  building_id_grid, canopy_height_grid, land_cover_grid, dem_grid, \
228
- building_geojson = get_voxcity(
228
+ building_gdf = get_voxcity(
229
229
  rectangle_vertices,
230
230
  building_source,
231
231
  land_cover_source,
@@ -410,7 +410,7 @@ landmark_kwargs = {
410
410
  "output_directory": "output", # Directory to save output files
411
411
  "output_file_name": "landmark_visibility" # Base filename for outputs
412
412
  }
413
- landmark_vis_map = get_landmark_visibility_map(voxcity_grid, building_id_grid, building_geojson, meshsize, **landmark_kwargs)
413
+ landmark_vis_map = get_landmark_visibility_map(voxcity_grid, building_id_grid, building_gdf, meshsize, **landmark_kwargs)
414
414
  ```
415
415
  <p align="center">
416
416
  <img src="https://raw.githubusercontent.com/kunifujiwara/VoxCity/main/images/landmark.png" alt="Landmark Visibility Map Rendered in Rhino" width="500">
@@ -1,36 +1,36 @@
1
1
  voxcity/__init__.py,sha256=el9v3gfybHOF_GUYPeSOqN0-vCrTW0eU1mcvi0sEfeU,252
2
- voxcity/generator.py,sha256=n0nSzDYddmQDHi4pLOaN2YY8xfZC0Rbl8nD7MvYSmHg,33695
2
+ voxcity/generator.py,sha256=SDaX1gLAq8NEPVZD8h_bFzUQcm8FjcAJzAy6yMXVsxg,33441
3
3
  voxcity/downloader/__init__.py,sha256=OgGcGxOXF4tjcEL6DhOnt13DYPTvOigUelp5xIpTqM0,171
4
- voxcity/downloader/eubucco.py,sha256=BaaMitzPDFXjeH-F7XfDzULpq89hVNEDYpsxeStZYDM,15002
4
+ voxcity/downloader/eubucco.py,sha256=XCkkdEPNuWdrnuxzL80Ext37WsgiCiZGueb-aQV5rvI,14476
5
5
  voxcity/downloader/gee.py,sha256=j7jmzp44T3M6j_4DwhU9Y8Y6gqbZo1zFIlduQPc0jvk,14339
6
- voxcity/downloader/mbfp.py,sha256=xmITDh9mCMnLWjYfjarEr2FEwAW5812IncJxo33IC7c,3959
6
+ voxcity/downloader/mbfp.py,sha256=5fXq9S7qNVSLDdVtj67Da1pBAJP6kL4P8qLZTOmWqdw,3895
7
7
  voxcity/downloader/oemj.py,sha256=YlCuWBQfi40gfmwQcGDeHiPOs4Pk_jLZq65d5R3IGMU,7886
8
- voxcity/downloader/omt.py,sha256=EjzimZMFXcjWNRlUEwPIjeTmE4rPh_9bjsgZyro8_mo,8819
9
- voxcity/downloader/osm.py,sha256=HHSuj6jiQrThrfyJMWHE2nQ0Rqkx4UsXopk8AoNZS6Q,26536
10
- voxcity/downloader/overture.py,sha256=daOvsySC2KIcTcMJUSA7XdbMELJuyLAIM2vr1DRLGp0,7714
8
+ voxcity/downloader/omt.py,sha256=ByFvoQDnBOJF4qdVYNkDjn7cMvEhWwtD0mIV_T-zMEs,9017
9
+ voxcity/downloader/osm.py,sha256=0VpYuPRiO3iru3nHM_or0nTDFb8ytUUDZieFX6zxB9Q,26338
10
+ voxcity/downloader/overture.py,sha256=2m7pHymE60iaqxa3H4gxAMtJioHd831R5kCS73dxzW8,7821
11
11
  voxcity/downloader/utils.py,sha256=z6MdPxM96FWQVqvZW2Eg5pMewVHVysUP7F6ueeCwMfI,1375
12
12
  voxcity/exporter/__init_.py,sha256=cVyNyE6axEpSd3CT5hGuMOAlOyU1p8lVP4jkF1-0Ad8,94
13
13
  voxcity/exporter/envimet.py,sha256=m-y2IYw-yp45AT2wN9UIlxvMjvDvupTKzyfRJl057fE,24300
14
14
  voxcity/exporter/magicavoxel.py,sha256=Fsv7yGRXeKmp82xcG3rOb0t_HtoqltNq2tHl08xVlqY,7500
15
15
  voxcity/exporter/obj.py,sha256=oW-kPoZj53nfmO9tXP3Wvizq6Kkjh-QQR8UBexRuMiI,21609
16
16
  voxcity/geoprocessor/__init_.py,sha256=FFJFf6idmAtmNkwfKPt3ERGSIzjb8tt35D1n9QQbCA8,112
17
- voxcity/geoprocessor/draw.py,sha256=vhO5O8_Hc0eMOfnczz6k2ZqplTX64FA6DL-XryOxIJs,13557
18
- voxcity/geoprocessor/grid.py,sha256=bQvcNjUZ1D124c8QYAs1Pba63bfjRorGr-9wxde9M1w,36298
17
+ voxcity/geoprocessor/draw.py,sha256=7T99AUr2qdt1OTfn4W61_Lph7HGz0_WcgoY6Ezo7sB4,13246
18
+ voxcity/geoprocessor/grid.py,sha256=Q5LSEuAuFMWXnGoJJ2g6RM-E2fkKxBkD8BbiAJeEpNs,43431
19
19
  voxcity/geoprocessor/network.py,sha256=opb_kpUCAxDd1qtrWPStqR5reYZtVe96XxazNSen7Lk,18851
20
- voxcity/geoprocessor/polygon.py,sha256=1U8FYtTbOUrDmK6ZIdECXpf8FuUvT8QKgIhthypDQ54,33566
20
+ voxcity/geoprocessor/polygon.py,sha256=8fU2Ayu2Y_G1z7Mbj8KoSKVurdPuAVbASjGMVS36ftM,32249
21
21
  voxcity/geoprocessor/utils.py,sha256=1BRHp-DDeOA8HG8jplY7Eo75G3oXkVGL6DGONL4BA8A,19815
22
22
  voxcity/simulator/__init_.py,sha256=APdkcdaovj0v_RPOaA4SBvFUKT2RM7Hxuuz3Sux4gCo,65
23
23
  voxcity/simulator/solar.py,sha256=FOcHoUm4miJNyeCcGs2oL93Vu38Affyywt29dJcmIT4,31974
24
24
  voxcity/simulator/utils.py,sha256=sEYBB2-hLJxTiXQps1_-Fi7t1HN3-1OPOvBCWtgIisA,130
25
- voxcity/simulator/view.py,sha256=4H19dMrHNzLuGtkzVEdOTsF1fl_ZcRC29HIxGVJBlGE,36770
25
+ voxcity/simulator/view.py,sha256=zNbfTLQ2Jo0V5-rFA3-xamRjOuw3H3MBrLKpQp8x3hY,36737
26
26
  voxcity/utils/__init_.py,sha256=nLYrj2huBbDBNMqfchCwexGP8Tlt9O_XluVDG7MoFkw,98
27
27
  voxcity/utils/lc.py,sha256=RwPd-VY3POV3gTrBhM7TubgGb9MCd3nVah_G8iUEF7k,11562
28
28
  voxcity/utils/material.py,sha256=Vt3IID5Ft54HNJcEC4zi31BCPqi_687X3CSp7rXaRVY,5907
29
- voxcity/utils/visualization.py,sha256=3cNjJdwIaOlzwgK08S39F1VYNf7vu-x9d4UUiKwXRVo,31943
29
+ voxcity/utils/visualization.py,sha256=2bv3y-1zkUX0cm_YbMHwe_Vt9J2R3QhouaVAGNifQXg,36805
30
30
  voxcity/utils/weather.py,sha256=P6s1y_EstBL1OGP_MR_6u3vr-t6Uawg8uDckJnoI7FI,21482
31
- voxcity-0.3.13.dist-info/AUTHORS.rst,sha256=m82vkI5QokEGdcHof2OxK39lf81w1P58kG9ZNNAKS9U,175
32
- voxcity-0.3.13.dist-info/LICENSE,sha256=-hGliOFiwUrUSoZiB5WF90xXGqinKyqiDI2t6hrnam8,1087
33
- voxcity-0.3.13.dist-info/METADATA,sha256=XWJTqfQEG1Qfvp9XsTMK_xUau4smVj0iUpQgjCCPlDw,25122
34
- voxcity-0.3.13.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
35
- voxcity-0.3.13.dist-info/top_level.txt,sha256=00b2U-LKfDllt6RL1R33MXie5MvxzUFye0NGD96t_8I,8
36
- voxcity-0.3.13.dist-info/RECORD,,
31
+ voxcity-0.3.15.dist-info/AUTHORS.rst,sha256=m82vkI5QokEGdcHof2OxK39lf81w1P58kG9ZNNAKS9U,175
32
+ voxcity-0.3.15.dist-info/LICENSE,sha256=-hGliOFiwUrUSoZiB5WF90xXGqinKyqiDI2t6hrnam8,1087
33
+ voxcity-0.3.15.dist-info/METADATA,sha256=aYm-Aa9Cskc-L7wKMJj25ikqTB4uDyN0h1fBS_DN3Fw,25114
34
+ voxcity-0.3.15.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
35
+ voxcity-0.3.15.dist-info/top_level.txt,sha256=00b2U-LKfDllt6RL1R33MXie5MvxzUFye0NGD96t_8I,8
36
+ voxcity-0.3.15.dist-info/RECORD,,