Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -75,10 +75,10 @@ def get_max_extent(*gdfs):
|
|
| 75 |
|
| 76 |
return minx, miny, maxx, maxy
|
| 77 |
|
| 78 |
-
def create_plot(filename, extent, *gdfs):
|
| 79 |
-
fig, ax = plt.subplots(
|
| 80 |
|
| 81 |
-
colors = ['blue', 'red', 'green', 'purple', 'orange', 'yellow'] # Extend this list as needed
|
| 82 |
|
| 83 |
for idx, gdf in enumerate(gdfs):
|
| 84 |
gdf.plot(ax=ax, color=colors[idx % len(colors)]) # Cycle through colors
|
|
@@ -86,7 +86,10 @@ def create_plot(filename, extent, *gdfs):
|
|
| 86 |
ax.set_xlim(extent[0], extent[2])
|
| 87 |
ax.set_ylim(extent[1], extent[3])
|
| 88 |
|
| 89 |
-
|
|
|
|
|
|
|
|
|
|
| 90 |
|
| 91 |
def ss_intersect(geojson1, ss_geoselect, multiplier_factor, default_building_height):
|
| 92 |
# Read the GeoJSON files
|
|
@@ -152,7 +155,7 @@ iface = gr.Interface(
|
|
| 152 |
gr.outputs.Image(type="pil", label="Result Image"),
|
| 153 |
gr.outputs.File(label="Building Buffers"),
|
| 154 |
gr.outputs.File(label="Union of Building Buffers"),
|
| 155 |
-
gr.outputs.Textbox(label="Building
|
| 156 |
],
|
| 157 |
examples=[
|
| 158 |
["files/building4test.geojson", "Parks Properties", 4.3, 200],
|
|
|
|
| 75 |
|
| 76 |
return minx, miny, maxx, maxy
|
| 77 |
|
| 78 |
+
def create_plot(filename, extent, *gdfs): # takes in unlimited number of gdfs
|
| 79 |
+
fig, ax = plt.subplots(figsize=(6, 4)) #Sets image size by width & height (in inches)
|
| 80 |
|
| 81 |
+
colors = ['blue', 'red', 'green', 'purple', 'orange', 'yellow'] # Extend/improve this list as needed
|
| 82 |
|
| 83 |
for idx, gdf in enumerate(gdfs):
|
| 84 |
gdf.plot(ax=ax, color=colors[idx % len(colors)]) # Cycle through colors
|
|
|
|
| 86 |
ax.set_xlim(extent[0], extent[2])
|
| 87 |
ax.set_ylim(extent[1], extent[3])
|
| 88 |
|
| 89 |
+
# Hide axes
|
| 90 |
+
ax.axis('off')
|
| 91 |
+
|
| 92 |
+
plt.savefig(filename, bbox_inches='tight', pad_inches=0) # remove padding
|
| 93 |
|
| 94 |
def ss_intersect(geojson1, ss_geoselect, multiplier_factor, default_building_height):
|
| 95 |
# Read the GeoJSON files
|
|
|
|
| 155 |
gr.outputs.Image(type="pil", label="Result Image"),
|
| 156 |
gr.outputs.File(label="Building Buffers"),
|
| 157 |
gr.outputs.File(label="Union of Building Buffers"),
|
| 158 |
+
gr.outputs.Textbox(label="Building intersection descriptions"),
|
| 159 |
],
|
| 160 |
examples=[
|
| 161 |
["files/building4test.geojson", "Parks Properties", 4.3, 200],
|