File tree Expand file tree Collapse file tree
packages/layerchart/src/routes/docs/examples/GeoPointPreProjected Expand file tree Collapse file tree 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 capitals from ' ../_data/geo/us-state-capitals.csv' ;
15-
1614 export let data;
15+
1716 const states = feature (data .geojson , data .geojson .objects .states );
1817 </script >
1918
6059 <text y ={120 }>{projection .translate ()}</text >
6160 </GeoContext >
6261 <g class =" points" >
63- {#each capitals as capital }
62+ {#each data . stateCaptitals as capital }
6463 <GeoPoint lat ={capital .latitude } long ={capital .longitude }>
6564 <circle r =" 2" fill =" red" />
6665 <Text y ="-6" value ={capital .description } textAnchor =" middle" class =" text-[8px]" />
Original file line number Diff line number Diff line change 1+ import { autoType , csvParse } from 'd3-dsv' ;
12import pageSource from './+page.svelte?raw' ;
23
34export async function load ( { fetch } ) {
@@ -7,6 +8,9 @@ export async function load({ fetch }) {
78 geojson : await fetch ( 'https://cdn.jsdelivr.net/npm/us-atlas@3/states-albers-10m.json' ) . then (
89 ( r ) => r . json ( )
910 ) ,
11+ stateCaptitals : await fetch ( '/data/examples/geo/us-state-capitals.csv' ) . then ( async ( r ) =>
12+ csvParse ( await r . text ( ) , autoType )
13+ ) ,
1014 meta : {
1115 pageSource,
1216 } ,
You can’t perform that action at this time.
0 commit comments