@versatiles/svelte 0.0.1
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/README.md +58 -0
- package/dist/AutoComplete/AutoComplete.svelte +159 -0
- package/dist/AutoComplete/AutoComplete.svelte.d.ts +25 -0
- package/dist/BBoxMap/BBoxMap.d.ts +15 -0
- package/dist/BBoxMap/BBoxMap.js +209 -0
- package/dist/BBoxMap/BBoxMap.svelte +155 -0
- package/dist/BBoxMap/BBoxMap.svelte.d.ts +20 -0
- package/dist/BBoxMap/README.md +70 -0
- package/dist/BBoxMap/bboxes.json +2195 -0
- package/dist/BBoxMap/data/countries.jsonl +258 -0
- package/dist/BBoxMap/data/eu.jsonl +1876 -0
- package/dist/BBoxMap/data/us.jsonl +52 -0
- package/dist/BBoxMap/data/world.jsonl +7 -0
- package/dist/BBoxMap/helpers/geojson2bboxes.d.ts +2 -0
- package/dist/BBoxMap/helpers/geojson2bboxes.js +183 -0
- package/dist/BBoxMap/helpers/merge_bboxes.d.ts +2 -0
- package/dist/BBoxMap/helpers/merge_bboxes.js +84 -0
- package/dist/BBoxMap/helpers/population.raw.br +0 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/utils/location.d.ts +3 -0
- package/dist/utils/location.js +31 -0
- package/dist/utils/style.d.ts +3 -0
- package/dist/utils/style.js +20 -0
- package/dist/utils/zones.d.ts +1 -0
- package/dist/utils/zones.js +402 -0
- package/package.json +70 -0
@@ -0,0 +1,70 @@
|
|
1
|
+
# BBox Map
|
2
|
+
|
3
|
+
This SvelteKit component generates an interactive world map with a search field that allows users to easily search for geographic bounding boxes (BBoxes) for various regions, including continents, countries, and cities. The selected bounding box can also be manipulated by dragging the edges.
|
4
|
+
|
5
|
+
## Improving Bounding Boxes
|
6
|
+
|
7
|
+
Bounding boxes for different regions (continents, countries, cities, etc.) are stored in the `bboxes.json` file. This file is generated by the helper script `helpers/merge_bboxes.ts`, which processes the `*.jsonl` files in the `data` directory.
|
8
|
+
|
9
|
+
### Editing Bounding Boxes
|
10
|
+
|
11
|
+
To edit or add new bounding boxes:
|
12
|
+
|
13
|
+
1. **Modify or Add a JSONL File**: Edit existing JSONL files in the `data` directory or create new ones with the required bounding box data.
|
14
|
+
2. **Run the `merge_bboxes.ts` Script**: After making changes, run the `merge_bboxes.ts` script to update the `bboxes.json` file.
|
15
|
+
|
16
|
+
### Helper Script: `merge_bboxes.ts`
|
17
|
+
|
18
|
+
This script consolidates bounding box data from multiple JSONL files in the `data` directory, checks for duplicate labels, and outputs a single, sorted JSON file (`bboxes.json`). The bounding box coordinates are also rounded to an appropriate precision based on their size.
|
19
|
+
|
20
|
+
#### Usage
|
21
|
+
|
22
|
+
Simply run the script:
|
23
|
+
|
24
|
+
```bash
|
25
|
+
./helpers/merge_bboxes.ts
|
26
|
+
```
|
27
|
+
|
28
|
+
#### Output
|
29
|
+
|
30
|
+
The script writes the processed data to `bboxes.json` in the parent directory. The entries in this file are sorted by population and formatted as:
|
31
|
+
|
32
|
+
```json
|
33
|
+
["Label", lngMin, latMin, lngWidth, latHeight]
|
34
|
+
```
|
35
|
+
|
36
|
+
### Helper Script: `geojson2bboxes.ts`
|
37
|
+
|
38
|
+
This script processes GeoJSON or GeoJSONL files to extract bounding boxes for each geographic feature, generate labels, and either extract or estimate the population for each feature. The results are saved in JSONL format, which can be used by the `merge_bboxes.ts` script.
|
39
|
+
|
40
|
+
#### Usage
|
41
|
+
|
42
|
+
```bash
|
43
|
+
./helpers/geojson2bboxes.ts <FILENAME> <LABEL_TEMPLATE> [POPULATION_KEY]
|
44
|
+
```
|
45
|
+
|
46
|
+
- `<FILENAME>`: The name of the input GeoJSON or GeoJSONL file. The file can be optionally compressed with `.br` (Brotli) or `.gz` (Gzip).
|
47
|
+
- `<LABEL_TEMPLATE>`: A template string used to generate labels for each feature. Placeholders in the form `{propertyName}` will be replaced by the corresponding property value from each feature.
|
48
|
+
- `[POPULATION_KEY]`: (Optional) The key in the feature's properties that contains the population value. If not provided, the script will estimate the population.
|
49
|
+
|
50
|
+
#### Example
|
51
|
+
|
52
|
+
```bash
|
53
|
+
./helpers/geojson2bboxes.ts africa.geojson "{country}, {city}"
|
54
|
+
```
|
55
|
+
|
56
|
+
This command processes the `africa.geojson` file, generating labels in the format `"country, city"` and estimating the population for each region.
|
57
|
+
|
58
|
+
#### Output
|
59
|
+
|
60
|
+
The script outputs a `.jsonl` file with entries formatted as follows:
|
61
|
+
|
62
|
+
```json
|
63
|
+
{
|
64
|
+
"label": "Country - City",
|
65
|
+
"population": 123456,
|
66
|
+
"bbox": [minLng, minLat, maxLng, maxLat]
|
67
|
+
}
|
68
|
+
```
|
69
|
+
|
70
|
+
Place this `.jsonl` file in the `data` directory to include it in the `bboxes.json` file when running `merge_bboxes.ts`.
|