File tree Expand file tree Collapse file tree
packages/layerchart/src/routes/docs/examples Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77 import GeoPath from ' $lib/components/GeoPath.svelte' ;
88 import Text from ' $lib/components/Text.svelte' ;
99
10- import geojson from ' ../_data/geo/us-states-topojson.js' ;
11-
12- const states = feature (geojson , geojson .objects .collection );
10+ export let data;
11+ const states = feature (data .geojson , data .geojson .objects .states );
1312 </script >
1413
1514<h1 >Examples</h1 >
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import pageSource from './+page.svelte?raw';
22
33export async function load ( ) {
44 return {
5+ geojson : ( await fetch ( 'https://cdn.jsdelivr.net/npm/us-atlas@3/states-10m.json' ) ) . json ( ) ,
56 meta : {
67 pageSource,
78 } ,
Original file line number Diff line number Diff line change 77 import GeoPath from ' $lib/components/GeoPath.svelte' ;
88 import Tooltip from ' $lib/components/Tooltip.svelte' ;
99
10- // import geojson from '../_data/geo/states-albers-10m.json';
11-
1210 export let data;
13- // console.log({ data });
14-
1511 const states = feature (data .geojson , data .geojson .objects .states );
1612 const counties = feature (data .geojson , data .geojson .objects .counties );
1713 </script >
Original file line number Diff line number Diff line change 88 import GeoPoint from ' $lib/components/GeoPoint.svelte' ;
99 import Text from ' $lib/components/Text.svelte' ;
1010
11- import geojson from ' ../_data/geo/us-states-topojson.js' ;
1211 import capitals from ' ../_data/geo/us-state-capitals.csv' ;
1312
14- const states = feature (geojson , geojson .objects .collection );
13+ export let data;
14+ const states = feature (data .geojson , data .geojson .objects .states );
1515 </script >
1616
1717<h1 >Examples</h1 >
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import pageSource from './+page.svelte?raw';
22
33export async function load ( ) {
44 return {
5+ geojson : ( await fetch ( 'https://cdn.jsdelivr.net/npm/us-atlas@3/states-10m.json' ) ) . json ( ) ,
56 meta : {
67 pageSource,
78 } ,
Original file line number Diff line number Diff line change 1111 import GeoPoint from ' $lib/components/GeoPoint.svelte' ;
1212 import Text from ' $lib/components/Text.svelte' ;
1313
14- // import geojson from '../_data/geo/states-albers-10m.json';
1514 import capitals from ' ../_data/geo/us-state-capitals.csv' ;
1615
1716 export let data;
18- // console.log({ data });
19-
2017 const states = feature (data .geojson , data .geojson .objects .states );
2118 </script >
2219
Original file line number Diff line number Diff line change 1414 import Tooltip from ' $lib/components/Tooltip.svelte' ;
1515 import TooltipItem from ' $lib/components/TooltipItem.svelte' ;
1616
17- import geojson from ' ../_data/geo/us-states-topojson.js' ;
18-
19- const states = feature (geojson , geojson .objects .collection );
17+ export let data;
18+ const states = feature (data .geojson , data .geojson .objects .states );
2019
2120 $ : filteredStates = {
2221 ... states ,
2322 features: states .features .filter (
24- (d ) => d .properties .name !== ' Alaska' && d .properties .name !== ' Hawaii'
23+ (d ) => d .id < 60 && d . properties .name !== ' Alaska' && d .properties .name !== ' Hawaii'
2524 ),
2625 };
2726 // $: filteredStates = { ...states, features: states.features.filter(d => d.properties.name === 'West Virginia')}
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import pageSource from './+page.svelte?raw';
22
33export async function load ( ) {
44 return {
5+ geojson : ( await fetch ( 'https://cdn.jsdelivr.net/npm/us-atlas@3/states-10m.json' ) ) . json ( ) ,
56 meta : {
67 pageSource,
78 } ,
Original file line number Diff line number Diff line change 1717 import TooltipItem from ' $lib/components/TooltipItem.svelte' ;
1818 import Zoom from ' $lib/components/Zoom.svelte' ;
1919
20- import geojson from ' ../_data/geo/us-states-topojson.js' ;
21-
22- const states = feature (geojson , geojson .objects .collection );
20+ export let data;
21+ const states = feature (data .geojson , data .geojson .objects .states );
2322
2423 $ : filteredStates = {
2524 ... states ,
You can’t perform that action at this time.
0 commit comments