|
27 | 27 |
|
28 | 28 | import XYZ from 'ol/source/XYZ'; |
29 | 29 | import VectorSource from 'ol/source/Vector'; |
| 30 | + import TileJSON from 'ol/source/TileJSON'; |
| 31 | +
|
| 32 | + import GeoJSON from 'ol/format/GeoJSON'; |
30 | 33 |
|
31 | 34 | import TileLayer from 'ol/layer/Tile'; |
32 | 35 | import VectorLayer from 'ol/layer/Vector'; |
| 36 | + import LayerGroup from 'ol/layer/Group'; |
33 | 37 |
|
34 | | - import { makeTitilerXYZUrl, makeLayerGroupFromLayerSet } from '../lib/utils'; |
35 | 38 | import { MapViewer } from '../lib/viewers'; |
36 | 39 | import Modal, { getModal } from './modals/BaseModal.svelte'; |
37 | 40 | import Link from './common/Link.svelte'; |
38 | 41 | import MapboxLogoLink from './common/MapboxLogoLink.svelte'; |
39 | 42 |
|
| 43 | + import Crop from 'ol-ext/filter/Crop'; |
| 44 | +
|
40 | 45 | export let CONTEXT; |
41 | 46 | export let PLACE; |
42 | 47 | export let MAPS; |
|
90 | 95 |
|
91 | 96 | let mainGroup; |
92 | 97 | let mosaicType; |
93 | | - if (vol.main_layerset.layers.length > 0 && vol.main_layerset.extent) { |
| 98 | +
|
| 99 | + if (vol.main_layerset.layers_tilejson.length > 0) { |
94 | 100 | const mainExtent = transformExtent(vol.main_layerset.extent, 'EPSG:4326', 'EPSG:3857'); |
95 | 101 | extend(homeExtent, mainExtent); |
96 | | - if (vol.main_layerset.mosaic_cog_url) { |
97 | | - mainGroup = new TileLayer({ |
98 | | - source: new XYZ({ |
99 | | - transition: 0, |
100 | | - url: makeTitilerXYZUrl({ |
101 | | - host: CONTEXT.titiler_host, |
102 | | - url: vol.main_layerset.mosaic_cog_url, |
103 | | - }), |
| 102 | +
|
| 103 | + mainGroup = new LayerGroup(); |
| 104 | +
|
| 105 | + vol.main_layerset.layers_tilejson.forEach((tilejson) => { |
| 106 | + const lyr = new TileLayer({ |
| 107 | + source: new TileJSON({ |
| 108 | + tileJSON: tilejson, |
| 109 | + tileSize: 512, |
104 | 110 | }), |
105 | | - extent: transformExtent(vol.main_layerset.multimask_extent, 'EPSG:4326', 'EPSG:3857'), |
| 111 | + extent: transformExtent(tilejson.bounds, 'EPSG:4326', 'EPSG:3857'), |
106 | 112 | }); |
107 | | - mosaicType = 'gt'; |
108 | | - } else { |
109 | | - mainGroup = makeLayerGroupFromLayerSet({ |
110 | | - layerSet: vol.main_layerset, |
111 | | - zIndex: 400 + n, |
112 | | - titilerHost: CONTEXT.titiler_host, |
113 | | - applyMultiMask: true, |
114 | | - }); |
115 | | - } |
| 113 | + if (tilejson.mask) { |
| 114 | + const feature = new GeoJSON().readFeature(tilejson.mask); |
| 115 | + feature.getGeometry().transform('EPSG:4326', 'EPSG:3857'); |
| 116 | + const crop = new Crop({ |
| 117 | + feature: feature, |
| 118 | + wrapX: true, |
| 119 | + inner: false, |
| 120 | + }); |
| 121 | + lyr.addFilter(crop); |
| 122 | + } |
| 123 | + mainGroup.getLayers().push(lyr); |
| 124 | + }); |
116 | 125 | } |
117 | 126 |
|
118 | 127 | let opacity = 0; |
|
128 | 137 |
|
129 | 138 | const volumeObj = { |
130 | 139 | id: vol.identifier, |
131 | | - summaryUrl: vol.urls.summary, |
| 140 | + summaryUrl: `/map/${vol.identifier}`, |
132 | 141 | displayName: vol.volume_number ? `${vol.year} vol. ${vol.volume_number}` : vol.year, |
133 | | - progress: vol.progress, |
| 142 | + unprepared_ct: vol.unprepared_ct, |
| 143 | + prepared_ct: vol.prepared_ct, |
| 144 | + layer_ct: vol.layer_ct, |
| 145 | + completion_pct: vol.completion_pct, |
134 | 146 | mainLayer: mainGroup, |
135 | 147 | mainLayerO: opacity, |
136 | | - mosaicType: mosaicType, |
| 148 | + mosaicType: vol.main_layerset.is_mosaic ? "gt" : null, |
137 | 149 | }; |
138 | 150 | volumeIds.push(vol.identifier); |
139 | 151 | volumeLookup[vol.identifier] = volumeObj; |
|
346 | 358 | } |
347 | 359 |
|
348 | 360 | function getCompletedStr(id) { |
349 | | - return `${volumeLookup[id].progress.georef_ct}/${volumeLookup[id].progress.unprep_ct + volumeLookup[id].progress.prep_ct + volumeLookup[id].progress.georef_ct}`; |
| 361 | + return `${volumeLookup[id].layer_ct}/${volumeLookup[id].unprepared_ct + volumeLookup[id].prepared_ct + volumeLookup[id].layer_ct}`; |
350 | 362 | } |
351 | 363 | </script> |
352 | 364 |
|
|
372 | 384 | In early 2022, participants in a <Link href="https://digitalcommons.lsu.edu/gradschool_theses/5641/" external={true} |
373 | 385 | >crowdsourcing project</Link |
374 | 386 | > georeferenced all of the Louisiana maps you see here, eventually creating these seamless mosaic overlays. These comprise |
375 | | - 1,500 individual sheets from 270 different Sanborn atlases, covering of over <Link href="/browse" |
| 387 | + 1,500 individual sheets from 270 different Sanborn atlases, covering of over <Link href="/search" |
376 | 388 | >130 different locations</Link |
377 | 389 | >. |
378 | 390 | </p> |
|
468 | 480 | <div {id} class="volume-detail"> |
469 | 481 | <div> |
470 | 482 | <span title="{getCompletedStr(id)} georeferenced"> |
471 | | - {volumeLookup[id].progress.percent}% ({getCompletedStr(id)}) |
| 483 | + {volumeLookup[id].completion_pct}% ({getCompletedStr(id)}) |
472 | 484 | </span> |
473 | 485 | {#if volumeLookup[id].mosaicType} |
474 | 486 | <span |
|
490 | 502 | {/each} |
491 | 503 | {:else} |
492 | 504 | <div class="volume-item"> |
493 | | - <p>No volumes for this place. <Link href="/browse" title="Back to browse">Back to browse →</Link></p> |
| 505 | + <p>No volumes for this place. <Link href="/search" title="Back to browse">Back to browse →</Link></p> |
494 | 506 | </div> |
495 | 507 | {/if} |
496 | 508 | </div> |
497 | 509 | <div class="control-panel-footer"> |
498 | | - <Link title="Find another city" href="/browse" classes={['white']}>← switch city</Link> |
| 510 | + <Link title="Find another city" href="/search" classes={['white']}>← switch city</Link> |
499 | 511 | <span>|</span> |
500 | 512 | <Link title="Go to home page" href="/" classes={['white']}>home</Link> |
501 | 513 | <span>|</span> |
|
577 | 589 | top: 0.5em; |
578 | 590 | right: 0.5em; |
579 | 591 | max-width: 100%; |
580 | | - min-width: 250px; |
| 592 | + min-width: 300px; |
581 | 593 | background: var(--primary-background-color); |
582 | 594 | border-radius: 4px; |
583 | 595 | border: 1px solid #333333; |
|
739 | 751 | bottom: 3em; |
740 | 752 | margin-right: auto; |
741 | 753 | margin-left: auto; |
| 754 | + width: 100%; |
742 | 755 | } |
743 | 756 | } |
744 | 757 | </style> |
0 commit comments