Skip to content

Commit 5db5a20

Browse files
Merge pull request #53 from joinr/topojsonfix
Fix Missing GeoJSON in quarto
2 parents 50bd369 + 140c1b1 commit 5db5a20

File tree

1 file changed

+30
-5
lines changed

1 file changed

+30
-5
lines changed

src/cesium/geovis.clj

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,12 @@ fire-data
237237
;; After a second or two the fire events will be loaded and we'll notice the
238238
;; timeline has changed with a new start time somewhere in the year 2000.
239239

240-
;; # A Note on Map Tiles and Base Layers Cesium is built to work with all sorts
241-
;; of geospatial layers, which are the visual projections of the geography that
242-
;; we want see rendered. We build maps by adding layers (from various sources)
243-
;; and then we can place interactive 3d geometry in the context of these layers.
240+
;; # A Note on Map Tiles and Base Layers
241+
242+
;; Cesium is built to work with all sorts of geospatial layers, which are the
243+
;; visual projections of the geography that we want see rendered. We build maps
244+
;; by adding layers (from various sources) and then we can place interactive 3d
245+
;; geometry in the context of these layers.
244246

245247
;; Most layers come in the form of "map tiles", which are 3d coordinates mapping
246248
;; a visible chunk of the earth at a particular altitude. So when we zoom into a
@@ -285,7 +287,7 @@ fire-data
285287

286288
;; # Back to the App
287289

288-
;; ## GeoJSON For Simple Polyogonal Layers (State Boundaries)
290+
;; ## GeoJSON For Complex Polygonal Layers (State Boundaries)
289291

290292
;; Since not every layer has state boundaries baked in, I added a layer from
291293
;; open source state boundaries via GeoJSON. We get the added benefit of
@@ -296,6 +298,29 @@ fire-data
296298
;; base layers, it may look better to have it toggled off since the current
297299
;; translucent grey polygon fill may collide with interesting visual features.
298300

301+
;; ### Side Note - Clay Local Files vs. Quarto
302+
303+
;; Normally, we can just reference files that are local to our notebook's
304+
;; folder, like images and script tags, and Clay will pick them up just fine.
305+
;; When we go to publish on the Quarto web site, Clay will emit a baked document
306+
;; in .qmd format, wherein only the references to assets in use will be
307+
;; picked up and copied over as static assets.
308+
309+
;; As a consequence of how this Quarto site builds stuff, if we want to
310+
;; have our topojson file available for our CesiumJS app to pull locally,
311+
;; we have to reference it somewhere to indicate it should be copied to
312+
;; the static site (or we stick it in a global resources file etc.).
313+
314+
;; This work-around applies to any resource we want to have inside a webapp
315+
;; like geojson or other data, since Quarto isn't going to know that. We
316+
;; can communicate our need by adding some reference to the doc, like a download
317+
;; link using the hiccup below.
318+
319+
(kind/hiccup
320+
[:a {:href "ne_10m_us_states.topojson"
321+
:download "ne_10m_us_states.topojson"}
322+
"ne_10m_us_states.topojson"])
323+
299324
;; ### Geospatial Entities
300325

301326
;; This is a common idiom in CesiumJS. There is a natural correspondence between

0 commit comments

Comments
 (0)