@classic-homes/maps-core 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +713 -0
- package/dist/index.d.cts +330 -3
- package/dist/index.d.ts +330 -3
- package/dist/index.js +667 -2
- package/dist/types/index.d.cts +31 -1
- package/dist/types/index.d.ts +31 -1
- package/package.json +4 -2
- package/src/styles/basemap-switcher.css +20 -0
- package/src/styles/layer-manager.css +228 -0
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { lightTheme } from './chunk-2NISJ7WE.js';
|
|
1
|
+
import { lightBasicStyle, darkBasicStyle, lightTheme } from './chunk-2NISJ7WE.js';
|
|
2
2
|
export { THEME_DARK, THEME_LIGHT, darkBasicStyle, darkTheme, generateBasicStyle, generateDarkColors, generateDarkDataColors, generateDarkTheme, generateLightColors, generateLightDataColors, generateLightTheme, generateVectorStyle, getBasicStyle, getTheme, getTypography, lightBasicStyle, lightTheme } from './chunk-2NISJ7WE.js';
|
|
3
3
|
import RBush from 'rbush';
|
|
4
4
|
|
|
@@ -2654,4 +2654,669 @@ function applyMarkerChildProtection(element) {
|
|
|
2654
2654
|
style.setProperty("animation", "none", "important");
|
|
2655
2655
|
}
|
|
2656
2656
|
|
|
2657
|
-
|
|
2657
|
+
// src/basemaps/registry.ts
|
|
2658
|
+
var OSM_STANDARD = {
|
|
2659
|
+
id: "osm-standard",
|
|
2660
|
+
name: "OpenStreetMap",
|
|
2661
|
+
provider: "osm",
|
|
2662
|
+
category: "streets",
|
|
2663
|
+
thumbnail: "https://tile.openstreetmap.org/3/4/2.png",
|
|
2664
|
+
style: "https://demotiles.maplibre.org/style.json",
|
|
2665
|
+
requiresApiKey: false,
|
|
2666
|
+
attribution: "\xA9 OpenStreetMap contributors"
|
|
2667
|
+
};
|
|
2668
|
+
var CLASSIC_LIGHT = {
|
|
2669
|
+
id: "classic-light",
|
|
2670
|
+
name: "Classic Light",
|
|
2671
|
+
provider: "classic-theme",
|
|
2672
|
+
category: "minimal",
|
|
2673
|
+
thumbnail: "https://tile.openstreetmap.org/3/4/2.png",
|
|
2674
|
+
style: lightBasicStyle,
|
|
2675
|
+
requiresApiKey: false
|
|
2676
|
+
};
|
|
2677
|
+
var CLASSIC_DARK = {
|
|
2678
|
+
id: "classic-dark",
|
|
2679
|
+
name: "Classic Dark",
|
|
2680
|
+
provider: "classic-theme",
|
|
2681
|
+
category: "dark",
|
|
2682
|
+
thumbnail: "https://tile.openstreetmap.org/3/4/3.png",
|
|
2683
|
+
style: darkBasicStyle,
|
|
2684
|
+
requiresApiKey: false
|
|
2685
|
+
};
|
|
2686
|
+
var MAPTILER_STREETS = {
|
|
2687
|
+
id: "maptiler-streets",
|
|
2688
|
+
name: "Streets",
|
|
2689
|
+
provider: "maptiler",
|
|
2690
|
+
category: "streets",
|
|
2691
|
+
thumbnail: "https://api.maptiler.com/maps/streets-v2/256/3/4/2.png",
|
|
2692
|
+
style: (apiKey) => `https://api.maptiler.com/maps/streets-v2/style.json?key=${apiKey}`,
|
|
2693
|
+
requiresApiKey: true
|
|
2694
|
+
};
|
|
2695
|
+
var MAPTILER_SATELLITE = {
|
|
2696
|
+
id: "maptiler-satellite",
|
|
2697
|
+
name: "Satellite",
|
|
2698
|
+
provider: "maptiler",
|
|
2699
|
+
category: "satellite",
|
|
2700
|
+
thumbnail: "https://api.maptiler.com/maps/satellite/256/3/4/2.png",
|
|
2701
|
+
style: (apiKey) => `https://api.maptiler.com/maps/satellite/style.json?key=${apiKey}`,
|
|
2702
|
+
requiresApiKey: true
|
|
2703
|
+
};
|
|
2704
|
+
var MAPTILER_OUTDOOR = {
|
|
2705
|
+
id: "maptiler-outdoor",
|
|
2706
|
+
name: "Outdoor",
|
|
2707
|
+
provider: "maptiler",
|
|
2708
|
+
category: "outdoor",
|
|
2709
|
+
thumbnail: "https://api.maptiler.com/maps/outdoor-v2/256/3/4/2.png",
|
|
2710
|
+
style: (apiKey) => `https://api.maptiler.com/maps/outdoor-v2/style.json?key=${apiKey}`,
|
|
2711
|
+
requiresApiKey: true
|
|
2712
|
+
};
|
|
2713
|
+
var MAPTILER_BASIC = {
|
|
2714
|
+
id: "maptiler-basic",
|
|
2715
|
+
name: "Basic",
|
|
2716
|
+
provider: "maptiler",
|
|
2717
|
+
category: "minimal",
|
|
2718
|
+
thumbnail: "https://api.maptiler.com/maps/basic-v2/256/3/4/2.png",
|
|
2719
|
+
style: (apiKey) => `https://api.maptiler.com/maps/basic-v2/style.json?key=${apiKey}`,
|
|
2720
|
+
requiresApiKey: true
|
|
2721
|
+
};
|
|
2722
|
+
var STADIA_ALIDADE_SMOOTH = {
|
|
2723
|
+
id: "stadia-alidade-smooth",
|
|
2724
|
+
name: "Alidade Smooth",
|
|
2725
|
+
provider: "stadia",
|
|
2726
|
+
category: "minimal",
|
|
2727
|
+
thumbnail: "https://tiles.stadiamaps.com/tiles/alidade_smooth/3/4/2.png",
|
|
2728
|
+
style: (apiKey) => `https://tiles.stadiamaps.com/styles/alidade_smooth.json?api_key=${apiKey}`,
|
|
2729
|
+
requiresApiKey: true
|
|
2730
|
+
};
|
|
2731
|
+
var STADIA_ALIDADE_DARK = {
|
|
2732
|
+
id: "stadia-alidade-dark",
|
|
2733
|
+
name: "Alidade Dark",
|
|
2734
|
+
provider: "stadia",
|
|
2735
|
+
category: "dark",
|
|
2736
|
+
thumbnail: "https://tiles.stadiamaps.com/tiles/alidade_smooth_dark/3/4/2.png",
|
|
2737
|
+
style: (apiKey) => `https://tiles.stadiamaps.com/styles/alidade_smooth_dark.json?api_key=${apiKey}`,
|
|
2738
|
+
requiresApiKey: true
|
|
2739
|
+
};
|
|
2740
|
+
var STADIA_STAMEN_TONER = {
|
|
2741
|
+
id: "stadia-stamen-toner",
|
|
2742
|
+
name: "Stamen Toner",
|
|
2743
|
+
provider: "stadia",
|
|
2744
|
+
category: "artistic",
|
|
2745
|
+
thumbnail: "https://tiles.stadiamaps.com/tiles/stamen_toner/3/4/2.png",
|
|
2746
|
+
style: (apiKey) => `https://tiles.stadiamaps.com/styles/stamen_toner.json?api_key=${apiKey}`,
|
|
2747
|
+
requiresApiKey: true
|
|
2748
|
+
};
|
|
2749
|
+
var STADIA_STAMEN_WATERCOLOR = {
|
|
2750
|
+
id: "stadia-stamen-watercolor",
|
|
2751
|
+
name: "Stamen Watercolor",
|
|
2752
|
+
provider: "stadia",
|
|
2753
|
+
category: "artistic",
|
|
2754
|
+
thumbnail: "https://tiles.stadiamaps.com/tiles/stamen_watercolor/3/4/2.png",
|
|
2755
|
+
style: (apiKey) => `https://tiles.stadiamaps.com/styles/stamen_watercolor.json?api_key=${apiKey}`,
|
|
2756
|
+
requiresApiKey: true
|
|
2757
|
+
};
|
|
2758
|
+
var STADIA_STAMEN_TERRAIN = {
|
|
2759
|
+
id: "stadia-stamen-terrain",
|
|
2760
|
+
name: "Stamen Terrain",
|
|
2761
|
+
provider: "stadia",
|
|
2762
|
+
category: "outdoor",
|
|
2763
|
+
thumbnail: "https://tiles.stadiamaps.com/tiles/stamen_terrain/3/4/2.png",
|
|
2764
|
+
style: (apiKey) => `https://tiles.stadiamaps.com/styles/stamen_terrain.json?api_key=${apiKey}`,
|
|
2765
|
+
requiresApiKey: true
|
|
2766
|
+
};
|
|
2767
|
+
var BUILTIN_BASEMAPS = [
|
|
2768
|
+
OSM_STANDARD,
|
|
2769
|
+
CLASSIC_LIGHT,
|
|
2770
|
+
CLASSIC_DARK,
|
|
2771
|
+
MAPTILER_STREETS,
|
|
2772
|
+
MAPTILER_SATELLITE,
|
|
2773
|
+
MAPTILER_OUTDOOR,
|
|
2774
|
+
MAPTILER_BASIC,
|
|
2775
|
+
STADIA_ALIDADE_SMOOTH,
|
|
2776
|
+
STADIA_ALIDADE_DARK,
|
|
2777
|
+
STADIA_STAMEN_TONER,
|
|
2778
|
+
STADIA_STAMEN_WATERCOLOR,
|
|
2779
|
+
STADIA_STAMEN_TERRAIN
|
|
2780
|
+
];
|
|
2781
|
+
var FREE_BASEMAPS = BUILTIN_BASEMAPS.filter((b) => !b.requiresApiKey);
|
|
2782
|
+
function getApiKeyForProvider(basemap, apiKeys) {
|
|
2783
|
+
if (!apiKeys) return void 0;
|
|
2784
|
+
return apiKeys[basemap.provider];
|
|
2785
|
+
}
|
|
2786
|
+
function resolveBasemapStyle(basemap, apiKeys) {
|
|
2787
|
+
if (typeof basemap.style === "function") {
|
|
2788
|
+
const apiKey = getApiKeyForProvider(basemap, apiKeys);
|
|
2789
|
+
if (!apiKey) return null;
|
|
2790
|
+
return basemap.style(apiKey);
|
|
2791
|
+
}
|
|
2792
|
+
return basemap.style;
|
|
2793
|
+
}
|
|
2794
|
+
function getAvailableBasemaps(basemaps, apiKeys) {
|
|
2795
|
+
return basemaps.filter((basemap) => {
|
|
2796
|
+
if (!basemap.requiresApiKey) return true;
|
|
2797
|
+
return !!getApiKeyForProvider(basemap, apiKeys);
|
|
2798
|
+
});
|
|
2799
|
+
}
|
|
2800
|
+
function resolveBasemapThumbnail(basemap, apiKeys) {
|
|
2801
|
+
const { thumbnail, provider } = basemap;
|
|
2802
|
+
const apiKey = getApiKeyForProvider(basemap, apiKeys);
|
|
2803
|
+
if (!apiKey) return thumbnail;
|
|
2804
|
+
if (provider === "maptiler" && thumbnail.includes("api.maptiler.com")) {
|
|
2805
|
+
const separator = thumbnail.includes("?") ? "&" : "?";
|
|
2806
|
+
return `${thumbnail}${separator}key=${apiKey}`;
|
|
2807
|
+
}
|
|
2808
|
+
if (provider === "stadia" && thumbnail.includes("stadiamaps.com")) {
|
|
2809
|
+
const separator = thumbnail.includes("?") ? "&" : "?";
|
|
2810
|
+
return `${thumbnail}${separator}api_key=${apiKey}`;
|
|
2811
|
+
}
|
|
2812
|
+
return thumbnail;
|
|
2813
|
+
}
|
|
2814
|
+
|
|
2815
|
+
// src/layers/registry.ts
|
|
2816
|
+
var CATEGORY_META = {
|
|
2817
|
+
boundaries: {
|
|
2818
|
+
label: "Boundaries",
|
|
2819
|
+
icon: "square-dashed",
|
|
2820
|
+
order: 1
|
|
2821
|
+
},
|
|
2822
|
+
recreation: {
|
|
2823
|
+
label: "Recreation",
|
|
2824
|
+
icon: "trees",
|
|
2825
|
+
order: 2
|
|
2826
|
+
},
|
|
2827
|
+
transportation: {
|
|
2828
|
+
label: "Transportation",
|
|
2829
|
+
icon: "bus",
|
|
2830
|
+
order: 3
|
|
2831
|
+
},
|
|
2832
|
+
environmental: {
|
|
2833
|
+
label: "Environmental",
|
|
2834
|
+
icon: "droplets",
|
|
2835
|
+
order: 4
|
|
2836
|
+
},
|
|
2837
|
+
custom: {
|
|
2838
|
+
label: "Other",
|
|
2839
|
+
icon: "layers",
|
|
2840
|
+
order: 5
|
|
2841
|
+
}
|
|
2842
|
+
};
|
|
2843
|
+
var SCHOOL_DISTRICTS = {
|
|
2844
|
+
id: "school-districts",
|
|
2845
|
+
name: "School Districts",
|
|
2846
|
+
description: "Public school district boundaries",
|
|
2847
|
+
category: "boundaries",
|
|
2848
|
+
source: {
|
|
2849
|
+
type: "geojson-url",
|
|
2850
|
+
url: ""
|
|
2851
|
+
// Must be configured with actual data URL
|
|
2852
|
+
},
|
|
2853
|
+
style: {
|
|
2854
|
+
renderType: "fill",
|
|
2855
|
+
light: {
|
|
2856
|
+
"fill-color": "hsl(210, 80%, 60%)",
|
|
2857
|
+
"fill-opacity": 0.2,
|
|
2858
|
+
"fill-outline-color": "hsl(210, 80%, 40%)"
|
|
2859
|
+
},
|
|
2860
|
+
dark: {
|
|
2861
|
+
"fill-color": "hsl(210, 70%, 50%)",
|
|
2862
|
+
"fill-opacity": 0.25,
|
|
2863
|
+
"fill-outline-color": "hsl(210, 70%, 60%)"
|
|
2864
|
+
}
|
|
2865
|
+
},
|
|
2866
|
+
interactive: true,
|
|
2867
|
+
labelProperty: "name",
|
|
2868
|
+
tags: ["education", "schools", "districts"]
|
|
2869
|
+
};
|
|
2870
|
+
var CITY_LIMITS = {
|
|
2871
|
+
id: "city-limits",
|
|
2872
|
+
name: "City Limits",
|
|
2873
|
+
description: "Municipal boundaries",
|
|
2874
|
+
category: "boundaries",
|
|
2875
|
+
source: {
|
|
2876
|
+
type: "geojson-url",
|
|
2877
|
+
url: ""
|
|
2878
|
+
},
|
|
2879
|
+
style: {
|
|
2880
|
+
renderType: "line",
|
|
2881
|
+
light: {
|
|
2882
|
+
"line-color": "hsl(0, 0%, 40%)",
|
|
2883
|
+
"line-width": 2,
|
|
2884
|
+
"line-dasharray": [4, 2]
|
|
2885
|
+
},
|
|
2886
|
+
dark: {
|
|
2887
|
+
"line-color": "hsl(0, 0%, 70%)",
|
|
2888
|
+
"line-width": 2,
|
|
2889
|
+
"line-dasharray": [4, 2]
|
|
2890
|
+
}
|
|
2891
|
+
},
|
|
2892
|
+
interactive: true,
|
|
2893
|
+
labelProperty: "name",
|
|
2894
|
+
tags: ["municipal", "city", "limits"]
|
|
2895
|
+
};
|
|
2896
|
+
var ZONING_DISTRICTS = {
|
|
2897
|
+
id: "zoning-districts",
|
|
2898
|
+
name: "Zoning Districts",
|
|
2899
|
+
description: "Land use zoning designations",
|
|
2900
|
+
category: "boundaries",
|
|
2901
|
+
source: {
|
|
2902
|
+
type: "geojson-url",
|
|
2903
|
+
url: ""
|
|
2904
|
+
},
|
|
2905
|
+
style: {
|
|
2906
|
+
renderType: "fill",
|
|
2907
|
+
light: {
|
|
2908
|
+
"fill-color": [
|
|
2909
|
+
"match",
|
|
2910
|
+
["get", "zone_type"],
|
|
2911
|
+
"residential",
|
|
2912
|
+
"hsl(120, 50%, 70%)",
|
|
2913
|
+
"commercial",
|
|
2914
|
+
"hsl(30, 80%, 70%)",
|
|
2915
|
+
"industrial",
|
|
2916
|
+
"hsl(0, 50%, 70%)",
|
|
2917
|
+
"mixed",
|
|
2918
|
+
"hsl(270, 50%, 70%)",
|
|
2919
|
+
"hsl(0, 0%, 70%)"
|
|
2920
|
+
],
|
|
2921
|
+
"fill-opacity": 0.3
|
|
2922
|
+
},
|
|
2923
|
+
dark: {
|
|
2924
|
+
"fill-color": [
|
|
2925
|
+
"match",
|
|
2926
|
+
["get", "zone_type"],
|
|
2927
|
+
"residential",
|
|
2928
|
+
"hsl(120, 40%, 50%)",
|
|
2929
|
+
"commercial",
|
|
2930
|
+
"hsl(30, 70%, 50%)",
|
|
2931
|
+
"industrial",
|
|
2932
|
+
"hsl(0, 40%, 50%)",
|
|
2933
|
+
"mixed",
|
|
2934
|
+
"hsl(270, 40%, 50%)",
|
|
2935
|
+
"hsl(0, 0%, 50%)"
|
|
2936
|
+
],
|
|
2937
|
+
"fill-opacity": 0.35
|
|
2938
|
+
}
|
|
2939
|
+
},
|
|
2940
|
+
legend: {
|
|
2941
|
+
type: "categorical",
|
|
2942
|
+
items: [
|
|
2943
|
+
{ label: "Residential", color: "hsl(120, 50%, 70%)" },
|
|
2944
|
+
{ label: "Commercial", color: "hsl(30, 80%, 70%)" },
|
|
2945
|
+
{ label: "Industrial", color: "hsl(0, 50%, 70%)" },
|
|
2946
|
+
{ label: "Mixed Use", color: "hsl(270, 50%, 70%)" }
|
|
2947
|
+
]
|
|
2948
|
+
},
|
|
2949
|
+
interactive: true,
|
|
2950
|
+
labelProperty: "zone_name",
|
|
2951
|
+
tags: ["zoning", "land-use", "planning"]
|
|
2952
|
+
};
|
|
2953
|
+
var PARKS = {
|
|
2954
|
+
id: "parks",
|
|
2955
|
+
name: "Parks",
|
|
2956
|
+
description: "Public parks and green spaces",
|
|
2957
|
+
category: "recreation",
|
|
2958
|
+
source: {
|
|
2959
|
+
type: "geojson-url",
|
|
2960
|
+
url: ""
|
|
2961
|
+
},
|
|
2962
|
+
style: {
|
|
2963
|
+
renderType: "fill",
|
|
2964
|
+
light: {
|
|
2965
|
+
"fill-color": "hsl(120, 60%, 50%)",
|
|
2966
|
+
"fill-opacity": 0.4,
|
|
2967
|
+
"fill-outline-color": "hsl(120, 60%, 30%)"
|
|
2968
|
+
},
|
|
2969
|
+
dark: {
|
|
2970
|
+
"fill-color": "hsl(120, 50%, 40%)",
|
|
2971
|
+
"fill-opacity": 0.5,
|
|
2972
|
+
"fill-outline-color": "hsl(120, 50%, 50%)"
|
|
2973
|
+
}
|
|
2974
|
+
},
|
|
2975
|
+
interactive: true,
|
|
2976
|
+
labelProperty: "name",
|
|
2977
|
+
tags: ["parks", "green-space", "recreation"]
|
|
2978
|
+
};
|
|
2979
|
+
var TRAILS = {
|
|
2980
|
+
id: "trails",
|
|
2981
|
+
name: "Trails",
|
|
2982
|
+
description: "Hiking, biking, and walking trails",
|
|
2983
|
+
category: "recreation",
|
|
2984
|
+
source: {
|
|
2985
|
+
type: "geojson-url",
|
|
2986
|
+
url: ""
|
|
2987
|
+
},
|
|
2988
|
+
style: {
|
|
2989
|
+
renderType: "line",
|
|
2990
|
+
light: {
|
|
2991
|
+
"line-color": "hsl(30, 70%, 45%)",
|
|
2992
|
+
"line-width": 2,
|
|
2993
|
+
"line-dasharray": [2, 1]
|
|
2994
|
+
},
|
|
2995
|
+
dark: {
|
|
2996
|
+
"line-color": "hsl(30, 60%, 55%)",
|
|
2997
|
+
"line-width": 2,
|
|
2998
|
+
"line-dasharray": [2, 1]
|
|
2999
|
+
}
|
|
3000
|
+
},
|
|
3001
|
+
interactive: true,
|
|
3002
|
+
labelProperty: "name",
|
|
3003
|
+
tags: ["trails", "hiking", "biking", "walking"]
|
|
3004
|
+
};
|
|
3005
|
+
var SPORTS_FACILITIES = {
|
|
3006
|
+
id: "sports-facilities",
|
|
3007
|
+
name: "Sports Facilities",
|
|
3008
|
+
description: "Sports fields, courts, and recreational facilities",
|
|
3009
|
+
category: "recreation",
|
|
3010
|
+
source: {
|
|
3011
|
+
type: "geojson-url",
|
|
3012
|
+
url: ""
|
|
3013
|
+
},
|
|
3014
|
+
style: {
|
|
3015
|
+
renderType: "circle",
|
|
3016
|
+
light: {
|
|
3017
|
+
"circle-color": "hsl(200, 70%, 50%)",
|
|
3018
|
+
"circle-radius": 6,
|
|
3019
|
+
"circle-stroke-width": 2,
|
|
3020
|
+
"circle-stroke-color": "hsl(200, 70%, 30%)"
|
|
3021
|
+
},
|
|
3022
|
+
dark: {
|
|
3023
|
+
"circle-color": "hsl(200, 60%, 55%)",
|
|
3024
|
+
"circle-radius": 6,
|
|
3025
|
+
"circle-stroke-width": 2,
|
|
3026
|
+
"circle-stroke-color": "hsl(200, 60%, 70%)"
|
|
3027
|
+
}
|
|
3028
|
+
},
|
|
3029
|
+
interactive: true,
|
|
3030
|
+
labelProperty: "name",
|
|
3031
|
+
tags: ["sports", "recreation", "facilities"]
|
|
3032
|
+
};
|
|
3033
|
+
var TRANSIT_ROUTES = {
|
|
3034
|
+
id: "transit-routes",
|
|
3035
|
+
name: "Transit Routes",
|
|
3036
|
+
description: "Public transportation routes",
|
|
3037
|
+
category: "transportation",
|
|
3038
|
+
source: {
|
|
3039
|
+
type: "geojson-url",
|
|
3040
|
+
url: ""
|
|
3041
|
+
},
|
|
3042
|
+
style: {
|
|
3043
|
+
renderType: "line",
|
|
3044
|
+
light: {
|
|
3045
|
+
"line-color": "hsl(270, 70%, 50%)",
|
|
3046
|
+
"line-width": 3
|
|
3047
|
+
},
|
|
3048
|
+
dark: {
|
|
3049
|
+
"line-color": "hsl(270, 60%, 60%)",
|
|
3050
|
+
"line-width": 3
|
|
3051
|
+
}
|
|
3052
|
+
},
|
|
3053
|
+
interactive: true,
|
|
3054
|
+
labelProperty: "route_name",
|
|
3055
|
+
tags: ["transit", "bus", "public-transportation"]
|
|
3056
|
+
};
|
|
3057
|
+
var BIKE_LANES = {
|
|
3058
|
+
id: "bike-lanes",
|
|
3059
|
+
name: "Bike Lanes",
|
|
3060
|
+
description: "Designated bicycle lanes and paths",
|
|
3061
|
+
category: "transportation",
|
|
3062
|
+
source: {
|
|
3063
|
+
type: "geojson-url",
|
|
3064
|
+
url: ""
|
|
3065
|
+
},
|
|
3066
|
+
style: {
|
|
3067
|
+
renderType: "line",
|
|
3068
|
+
light: {
|
|
3069
|
+
"line-color": "hsl(150, 70%, 45%)",
|
|
3070
|
+
"line-width": 2
|
|
3071
|
+
},
|
|
3072
|
+
dark: {
|
|
3073
|
+
"line-color": "hsl(150, 60%, 55%)",
|
|
3074
|
+
"line-width": 2
|
|
3075
|
+
}
|
|
3076
|
+
},
|
|
3077
|
+
interactive: true,
|
|
3078
|
+
labelProperty: "name",
|
|
3079
|
+
tags: ["bike", "bicycle", "cycling", "lanes"]
|
|
3080
|
+
};
|
|
3081
|
+
var FLOOD_ZONES = {
|
|
3082
|
+
id: "flood-zones",
|
|
3083
|
+
name: "Flood Zones",
|
|
3084
|
+
description: "FEMA flood hazard areas",
|
|
3085
|
+
category: "environmental",
|
|
3086
|
+
source: {
|
|
3087
|
+
type: "geojson-url",
|
|
3088
|
+
url: ""
|
|
3089
|
+
},
|
|
3090
|
+
style: {
|
|
3091
|
+
renderType: "fill",
|
|
3092
|
+
light: {
|
|
3093
|
+
"fill-color": [
|
|
3094
|
+
"match",
|
|
3095
|
+
["get", "flood_zone"],
|
|
3096
|
+
"A",
|
|
3097
|
+
"hsl(200, 80%, 60%)",
|
|
3098
|
+
"AE",
|
|
3099
|
+
"hsl(200, 80%, 50%)",
|
|
3100
|
+
"AH",
|
|
3101
|
+
"hsl(200, 80%, 45%)",
|
|
3102
|
+
"X",
|
|
3103
|
+
"hsl(200, 40%, 70%)",
|
|
3104
|
+
"hsl(200, 60%, 60%)"
|
|
3105
|
+
],
|
|
3106
|
+
"fill-opacity": 0.4
|
|
3107
|
+
},
|
|
3108
|
+
dark: {
|
|
3109
|
+
"fill-color": [
|
|
3110
|
+
"match",
|
|
3111
|
+
["get", "flood_zone"],
|
|
3112
|
+
"A",
|
|
3113
|
+
"hsl(200, 70%, 50%)",
|
|
3114
|
+
"AE",
|
|
3115
|
+
"hsl(200, 70%, 40%)",
|
|
3116
|
+
"AH",
|
|
3117
|
+
"hsl(200, 70%, 35%)",
|
|
3118
|
+
"X",
|
|
3119
|
+
"hsl(200, 30%, 50%)",
|
|
3120
|
+
"hsl(200, 50%, 45%)"
|
|
3121
|
+
],
|
|
3122
|
+
"fill-opacity": 0.45
|
|
3123
|
+
}
|
|
3124
|
+
},
|
|
3125
|
+
legend: {
|
|
3126
|
+
type: "categorical",
|
|
3127
|
+
items: [
|
|
3128
|
+
{ label: "Zone A (High Risk)", color: "hsl(200, 80%, 60%)" },
|
|
3129
|
+
{ label: "Zone AE (High Risk)", color: "hsl(200, 80%, 50%)" },
|
|
3130
|
+
{ label: "Zone AH (High Risk)", color: "hsl(200, 80%, 45%)" },
|
|
3131
|
+
{ label: "Zone X (Minimal Risk)", color: "hsl(200, 40%, 70%)" }
|
|
3132
|
+
]
|
|
3133
|
+
},
|
|
3134
|
+
interactive: true,
|
|
3135
|
+
labelProperty: "flood_zone",
|
|
3136
|
+
tags: ["flood", "fema", "hazard", "environmental"]
|
|
3137
|
+
};
|
|
3138
|
+
var WATERSHEDS = {
|
|
3139
|
+
id: "watersheds",
|
|
3140
|
+
name: "Watersheds",
|
|
3141
|
+
description: "Hydrological watershed boundaries",
|
|
3142
|
+
category: "environmental",
|
|
3143
|
+
source: {
|
|
3144
|
+
type: "geojson-url",
|
|
3145
|
+
url: ""
|
|
3146
|
+
},
|
|
3147
|
+
style: {
|
|
3148
|
+
renderType: "line",
|
|
3149
|
+
light: {
|
|
3150
|
+
"line-color": "hsl(190, 70%, 45%)",
|
|
3151
|
+
"line-width": 2
|
|
3152
|
+
},
|
|
3153
|
+
dark: {
|
|
3154
|
+
"line-color": "hsl(190, 60%, 55%)",
|
|
3155
|
+
"line-width": 2
|
|
3156
|
+
}
|
|
3157
|
+
},
|
|
3158
|
+
interactive: true,
|
|
3159
|
+
labelProperty: "name",
|
|
3160
|
+
tags: ["watershed", "hydrology", "water", "environmental"]
|
|
3161
|
+
};
|
|
3162
|
+
var BUILTIN_OVERLAY_LAYERS = [
|
|
3163
|
+
// Boundaries
|
|
3164
|
+
SCHOOL_DISTRICTS,
|
|
3165
|
+
CITY_LIMITS,
|
|
3166
|
+
ZONING_DISTRICTS,
|
|
3167
|
+
// Recreation
|
|
3168
|
+
PARKS,
|
|
3169
|
+
TRAILS,
|
|
3170
|
+
SPORTS_FACILITIES,
|
|
3171
|
+
// Transportation
|
|
3172
|
+
TRANSIT_ROUTES,
|
|
3173
|
+
BIKE_LANES,
|
|
3174
|
+
// Environmental
|
|
3175
|
+
FLOOD_ZONES,
|
|
3176
|
+
WATERSHEDS
|
|
3177
|
+
];
|
|
3178
|
+
function resolveLayerSourceUrl(layer, apiKeys) {
|
|
3179
|
+
const { source } = layer;
|
|
3180
|
+
if (source.type === "geojson-inline") {
|
|
3181
|
+
return null;
|
|
3182
|
+
}
|
|
3183
|
+
if (!source.url) {
|
|
3184
|
+
return null;
|
|
3185
|
+
}
|
|
3186
|
+
if (source.url.includes("{apiKey}") && apiKeys) {
|
|
3187
|
+
const apiKey = apiKeys[layer.id] ?? apiKeys["default"];
|
|
3188
|
+
if (apiKey) {
|
|
3189
|
+
return source.url.replace("{apiKey}", apiKey);
|
|
3190
|
+
}
|
|
3191
|
+
return null;
|
|
3192
|
+
}
|
|
3193
|
+
return source.url;
|
|
3194
|
+
}
|
|
3195
|
+
function getLayerStyleForTheme(layer, theme) {
|
|
3196
|
+
return theme === "dark" ? layer.style.dark : layer.style.light;
|
|
3197
|
+
}
|
|
3198
|
+
function searchLayers(layers, query) {
|
|
3199
|
+
if (!query.trim()) {
|
|
3200
|
+
return layers;
|
|
3201
|
+
}
|
|
3202
|
+
const lowerQuery = query.toLowerCase();
|
|
3203
|
+
return layers.filter((layer) => {
|
|
3204
|
+
const nameMatch = layer.name.toLowerCase().includes(lowerQuery);
|
|
3205
|
+
const descMatch = layer.description?.toLowerCase().includes(lowerQuery);
|
|
3206
|
+
const tagMatch = layer.tags?.some((tag) => tag.toLowerCase().includes(lowerQuery));
|
|
3207
|
+
return nameMatch || descMatch || tagMatch;
|
|
3208
|
+
});
|
|
3209
|
+
}
|
|
3210
|
+
function getLayersByCategory(layers, category) {
|
|
3211
|
+
return layers.filter((layer) => layer.category === category);
|
|
3212
|
+
}
|
|
3213
|
+
function groupLayersByCategory(layers) {
|
|
3214
|
+
const groups = {
|
|
3215
|
+
boundaries: [],
|
|
3216
|
+
recreation: [],
|
|
3217
|
+
transportation: [],
|
|
3218
|
+
environmental: [],
|
|
3219
|
+
custom: []
|
|
3220
|
+
};
|
|
3221
|
+
for (const layer of layers) {
|
|
3222
|
+
groups[layer.category].push(layer);
|
|
3223
|
+
}
|
|
3224
|
+
return groups;
|
|
3225
|
+
}
|
|
3226
|
+
function getLayerCategories(layers) {
|
|
3227
|
+
const categories = /* @__PURE__ */ new Set();
|
|
3228
|
+
for (const layer of layers) {
|
|
3229
|
+
categories.add(layer.category);
|
|
3230
|
+
}
|
|
3231
|
+
return Array.from(categories).sort((a, b) => CATEGORY_META[a].order - CATEGORY_META[b].order);
|
|
3232
|
+
}
|
|
3233
|
+
|
|
3234
|
+
// src/layers/state.ts
|
|
3235
|
+
function createInitialLayerStates(layers, initialActiveLayers) {
|
|
3236
|
+
const states = /* @__PURE__ */ new Map();
|
|
3237
|
+
const activeSet = new Set(initialActiveLayers ?? []);
|
|
3238
|
+
layers.forEach((layer, index) => {
|
|
3239
|
+
states.set(layer.id, {
|
|
3240
|
+
id: layer.id,
|
|
3241
|
+
visible: activeSet.has(layer.id),
|
|
3242
|
+
opacity: 1,
|
|
3243
|
+
loading: false,
|
|
3244
|
+
error: null,
|
|
3245
|
+
order: index
|
|
3246
|
+
});
|
|
3247
|
+
});
|
|
3248
|
+
return states;
|
|
3249
|
+
}
|
|
3250
|
+
function getVisibleLayerIds(states) {
|
|
3251
|
+
return Array.from(states.values()).filter((state) => state.visible).sort((a, b) => a.order - b.order).map((state) => state.id);
|
|
3252
|
+
}
|
|
3253
|
+
function updateLayerState(states, layerId, updates) {
|
|
3254
|
+
const newStates = new Map(states);
|
|
3255
|
+
const current = newStates.get(layerId);
|
|
3256
|
+
if (current) {
|
|
3257
|
+
newStates.set(layerId, { ...current, ...updates });
|
|
3258
|
+
}
|
|
3259
|
+
return newStates;
|
|
3260
|
+
}
|
|
3261
|
+
function toggleLayerVisibility(states, layerId) {
|
|
3262
|
+
const current = states.get(layerId);
|
|
3263
|
+
if (!current) return states;
|
|
3264
|
+
return updateLayerState(states, layerId, { visible: !current.visible });
|
|
3265
|
+
}
|
|
3266
|
+
function setLayerOpacity(states, layerId, opacity) {
|
|
3267
|
+
return updateLayerState(states, layerId, { opacity: Math.max(0, Math.min(1, opacity)) });
|
|
3268
|
+
}
|
|
3269
|
+
function reorderLayers(states, layerId, newIndex) {
|
|
3270
|
+
const sortedIds = Array.from(states.values()).sort((a, b) => a.order - b.order).map((s) => s.id);
|
|
3271
|
+
const currentIndex = sortedIds.indexOf(layerId);
|
|
3272
|
+
if (currentIndex === -1 || currentIndex === newIndex) {
|
|
3273
|
+
return states;
|
|
3274
|
+
}
|
|
3275
|
+
sortedIds.splice(currentIndex, 1);
|
|
3276
|
+
sortedIds.splice(newIndex, 0, layerId);
|
|
3277
|
+
const newStates = new Map(states);
|
|
3278
|
+
sortedIds.forEach((id, index) => {
|
|
3279
|
+
const current = newStates.get(id);
|
|
3280
|
+
if (current && current.order !== index) {
|
|
3281
|
+
newStates.set(id, { ...current, order: index });
|
|
3282
|
+
}
|
|
3283
|
+
});
|
|
3284
|
+
return newStates;
|
|
3285
|
+
}
|
|
3286
|
+
function setLayerLoading(states, layerId, loading) {
|
|
3287
|
+
return updateLayerState(states, layerId, {
|
|
3288
|
+
loading,
|
|
3289
|
+
error: loading ? null : states.get(layerId)?.error ?? null
|
|
3290
|
+
});
|
|
3291
|
+
}
|
|
3292
|
+
function setLayerError(states, layerId, error) {
|
|
3293
|
+
return updateLayerState(states, layerId, { error, loading: false });
|
|
3294
|
+
}
|
|
3295
|
+
function showAllLayers(states) {
|
|
3296
|
+
const newStates = /* @__PURE__ */ new Map();
|
|
3297
|
+
for (const [id, state] of states) {
|
|
3298
|
+
newStates.set(id, { ...state, visible: true });
|
|
3299
|
+
}
|
|
3300
|
+
return newStates;
|
|
3301
|
+
}
|
|
3302
|
+
function hideAllLayers(states) {
|
|
3303
|
+
const newStates = /* @__PURE__ */ new Map();
|
|
3304
|
+
for (const [id, state] of states) {
|
|
3305
|
+
newStates.set(id, { ...state, visible: false });
|
|
3306
|
+
}
|
|
3307
|
+
return newStates;
|
|
3308
|
+
}
|
|
3309
|
+
function getLayerStatesArray(states) {
|
|
3310
|
+
return Array.from(states.values()).sort((a, b) => a.order - b.order);
|
|
3311
|
+
}
|
|
3312
|
+
function isAnyLayerLoading(states) {
|
|
3313
|
+
for (const state of states.values()) {
|
|
3314
|
+
if (state.loading) return true;
|
|
3315
|
+
}
|
|
3316
|
+
return false;
|
|
3317
|
+
}
|
|
3318
|
+
function getLayersWithErrors(states) {
|
|
3319
|
+
return Array.from(states.values()).filter((state) => state.error !== null);
|
|
3320
|
+
}
|
|
3321
|
+
|
|
3322
|
+
export { BASE_OFFSET, BIKE_LANES, BUILTIN_BASEMAPS, BUILTIN_OVERLAY_LAYERS, CATEGORY_META, CITY_LIMITS, CLASSIC_DARK, CLASSIC_LIGHT, DEFAULT_SIMPLIFICATION_THRESHOLDS, FLOOD_ZONES, FREE_BASEMAPS, KEYBOARD_CONTROLS, MAPTILER_BASIC, MAPTILER_OUTDOOR, MAPTILER_SATELLITE, MAPTILER_STREETS, MARKER_PROTECTION_CLASS, OFFSET_CLASSES, OSM_STANDARD, PARKS, POSITION_CLASSES, SCHOOL_DISTRICTS, SPORTS_FACILITIES, STADIA_ALIDADE_DARK, STADIA_ALIDADE_SMOOTH, STADIA_STAMEN_TERRAIN, STADIA_STAMEN_TONER, STADIA_STAMEN_WATERCOLOR, TRAILS, TRANSIT_ROUTES, WATERSHEDS, ZONING_DISTRICTS, applyMarkerChildProtection, applyMarkerProtection, boundsToPolygon, buildRTreeIndex, buildSpatialIndex, calculateBounds, calculateCentroid, calculateZoomThresholds, combineBounds, computePositionClasses, computeVerticalOffsetStyle, countFeaturesByType, createCategoricalColorExpression, createCircleStyle, createContinuousColorExpression, createDynamicLODManager, createExtrusionHeightExpression, createExtrusionStyle, createFillStyle, createGeoJSONFingerprint, createHeatmapStyle, createHoverExpression, createIdleViewportManager, createInitialLayerStates, createInteractiveExpression, createInteractiveStatusColorExpression, createLineStyle, createLotFillStyle, createLotOutlineStyle, createPredictiveViewportManager, createRTreeViewportManager, createSelectionExpression, createStatusColorExpression, createViewportManager, createViewportQuery, createZoomExpression, decimalToDMS, deepEqual, expandCluster, expandClusterToBounds, extendBounds, filterByGeometryType, filterEqual, fingerprintEqual, formatArea, formatBearing, formatBounds, formatCoordinates, formatDistance, formatFeatureProperties, formatLabel, formatPitch, formatPropertyValue, formatScale, formatZoom, generateBoundingPolygon, generateConvexHull, generateFeatureCollectionDescription, generateFeatureTable, generateKeyboardControlsDescription, generateLODData, generateLODDataWithSimplification, generateMapDescription, generateMarkerList, generateMarkersDescription, generateMoveAnnouncement, geoJSONEqual, getAvailableBasemaps, getChangedPaintProps, getClusterBounds, getClusterChildren, getClusterExpansionZoom, getClusterLeaves, getHighlightStyle, getLayerCategories, getLayerStatesArray, getLayerStyleForTheme, getLayersByCategory, getLayersWithErrors, getSelectionStyle, getSimplificationToleranceForZoom, getSimplifiedFeaturesForZoom, getVisibleLayerIds, groupFeaturesByProperty, groupLayersByCategory, hideAllLayers, isAnyLayerLoading, isClusterFeature, isValidBounds, loadGeoJSON, paintPropsEqual, queryByBounds, queryByBoundsWithStats, queryRTreeByBounds, queryRTreeByBoundsWithStats, removeMarkerProtection, reorderLayers, resolveBasemapStyle, resolveBasemapThumbnail, resolveLayerSourceUrl, searchLayers, serializeFilter, setLayerError, setLayerLoading, setLayerOpacity, showAllLayers, simplifyFeature, simplifyFeatureCollection, simplifyFeatureCollectionWithStats, simplifyPolygon, toggleLayerVisibility, updateLayerState, validateGeoJSON, zoomToScale };
|