Skip to content

Commit

Permalink
Fixed html not found error opengeos#88
Browse files Browse the repository at this point in the history
  • Loading branch information
giswqs committed Jul 28, 2021
1 parent 5a9f250 commit f690b7b
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 22 deletions.
1 change: 1 addition & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ jobs:
- run: mkdocs gh-deploy --force
env:
USE_FOLIUM: ${{ secrets.USE_FOLIUM }}
USE_MKDOCS: ${{ secrets.USE_MKDOCS }}
HEREMAPS_API_KEY: ${{ secrets.HEREMAPS_API_KEY }}
PLANET_API_KEY: ${{ secrets.PLANET_API_KEY }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ __pycache__/
examples/notebooks/cache/
docs/notebooks/cache/
docs/javascripts/
docs/maps/
docs/html/
docs/notebooks/*.html
examples/notebooks/*.html
docs/cache/
Expand Down
20 changes: 11 additions & 9 deletions docs/maps.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@

This page demonstrates some interactive maps created using the kepler.gl plotting backend.

Create an interactive map. You can specify various parameters to initialize the map, such as `center`, `zoom`, `height`, and `widescreen`.
## Create an interactive map

You can specify various parameters to initialize the map, such as `center`, `zoom`, `height`, and `widescreen`.

```python
import leafmap.kepler as leafmap
m = leafmap.Map(center=[40, -100], zoom=2, height=600, widescreen=False)
m
```

<iframe width=1000, height=600 frameBorder=0 src="../maps/kepler.html"></iframe>
<iframe width=760 height=500 frameBorder=0 src="../html/kepler.html"></iframe>

Add a GeoJSON to the map.
## Add a GeoJSON

```python
m = leafmap.Map(center=[20, 0], zoom=1)
Expand All @@ -21,7 +23,7 @@ m.add_geojson(lines, layer_name="Cable lines")
m
```

<iframe width=1000, height=600 frameBorder=0 src="../maps/kepler_lines.html"></iframe>
<iframe width=760 height=500 frameBorder=0 src="../html/kepler_lines.html"></iframe>

Add a GeoJSON with US state boundaries to the map.

Expand All @@ -32,9 +34,9 @@ m.add_geojson(polygons, layer_name="Countries")
m
```

<iframe width=1000, height=600 frameBorder=0 src="../maps/kepler_states.html"></iframe>
<iframe width=760 height=500 frameBorder=0 src="../html/kepler_states.html"></iframe>

Add a shapefile to the map.
## Add a shapefile

```python
m = leafmap.Map(center=[20, 0], zoom=1)
Expand All @@ -43,9 +45,9 @@ m.add_shp(in_shp, "Countries")
m
```

<iframe width=1000, height=600 frameBorder=0 src="../maps/kepler_countries.html"></iframe>
<iframe width=760 height=500 frameBorder=0 src="../html/kepler_countries.html"></iframe>

Add a GeoPandas GeoDataFrame to the map.
## Add a GeoDataFrame

```python
import geopandas as gpd
Expand All @@ -55,4 +57,4 @@ m.add_gdf(gdf, "World cities")
m
```

<iframe width=1000, height=600 frameBorder=0 src="../maps/kepler_cities.html"></iframe>
<iframe width=760 height=500 frameBorder=0 src="../html/kepler_cities.html"></iframe>
10 changes: 5 additions & 5 deletions docs/notebooks/26_kepler_gl.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"metadata": {},
"outputs": [],
"source": [
"m.to_html(outfile=\"../maps/kepler.html\", read_only=False)"
"m.to_html(outfile=\"../html/kepler.html\", read_only=False)"
]
},
{
Expand Down Expand Up @@ -117,7 +117,7 @@
"metadata": {},
"outputs": [],
"source": [
"m.to_html(\"../maps/kepler_lines.html\")"
"m.to_html(\"../html/kepler_lines.html\")"
]
},
{
Expand Down Expand Up @@ -145,7 +145,7 @@
"metadata": {},
"outputs": [],
"source": [
"m.to_html(\"../maps/kepler_states.html\")"
"m.to_html(\"../html/kepler_states.html\")"
]
},
{
Expand Down Expand Up @@ -173,7 +173,7 @@
"metadata": {},
"outputs": [],
"source": [
"m.to_html(\"../maps/kepler_countries.html\")"
"m.to_html(\"../html/kepler_countries.html\")"
]
},
{
Expand Down Expand Up @@ -229,7 +229,7 @@
"metadata": {},
"outputs": [],
"source": [
"m.to_html(\"../maps/kepler_cities.html\")"
"m.to_html(\"../html/kepler_cities.html\")"
]
}
],
Expand Down
10 changes: 5 additions & 5 deletions examples/notebooks/26_kepler_gl.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"metadata": {},
"outputs": [],
"source": [
"m.to_html(outfile=\"../maps/kepler.html\", read_only=False)"
"m.to_html(outfile=\"../html/kepler.html\", read_only=False)"
]
},
{
Expand Down Expand Up @@ -117,7 +117,7 @@
"metadata": {},
"outputs": [],
"source": [
"m.to_html(\"../maps/kepler_lines.html\")"
"m.to_html(\"../html/kepler_lines.html\")"
]
},
{
Expand Down Expand Up @@ -145,7 +145,7 @@
"metadata": {},
"outputs": [],
"source": [
"m.to_html(\"../maps/kepler_states.html\")"
"m.to_html(\"../html/kepler_states.html\")"
]
},
{
Expand Down Expand Up @@ -173,7 +173,7 @@
"metadata": {},
"outputs": [],
"source": [
"m.to_html(\"../maps/kepler_countries.html\")"
"m.to_html(\"../html/kepler_countries.html\")"
]
},
{
Expand Down Expand Up @@ -229,7 +229,7 @@
"metadata": {},
"outputs": [],
"source": [
"m.to_html(\"../maps/kepler_cities.html\")"
"m.to_html(\"../html/kepler_cities.html\")"
]
}
],
Expand Down
5 changes: 4 additions & 1 deletion leafmap/kepler.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,10 @@ def static_map(
"""
if isinstance(self, keplergl.KeplerGl):
if out_file is None:
out_file = "./cache/" + "kepler_" + random_string(3) + ".html"
if os.environ.get("USE_MKDOCS") is not None:
out_file = "../maps/" + "kepler_" + random_string(3) + ".html"
else:
out_file = "./cache/" + "kepler_" + random_string(3) + ".html"
out_dir = os.path.abspath(os.path.dirname(out_file))
if not os.path.exists(out_dir):
os.makedirs(out_dir)
Expand Down
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ nav:
- Installation: installation.md
- Get Started: get-started.md
- Usage: notebooks/00_key_features.ipynb
- Interactive maps: maps.md
- Interactive Maps: maps.md
- Tutorials: tutorials.md
- Contributing: contributing.md
- FAQ: faq.md
Expand Down

0 comments on commit f690b7b

Please sign in to comment.