svgmapviewer-tools-osm 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/.vscode/settings.json +5 -0
- package/LICENSE +15 -0
- package/__pycache__/common.cpython-312.pyc +0 -0
- package/dist/geojsonToTs.js +15 -0
- package/eslint.config.js +58 -0
- package/oxlintrc.json +4 -0
- package/package.json +35 -0
- package/prettier.config.js +14 -0
- package/rslib.config.ts +22 -0
- package/rstest.config.ts +5 -0
- package/scripts/__pycache__/common.cpython-312.pyc +0 -0
- package/scripts/classifyGeometries.py +56 -0
- package/scripts/common.py +969 -0
- package/scripts/copy.sh +36 -0
- package/scripts/extractAreas.py +41 -0
- package/scripts/extractAreas.sh +20 -0
- package/scripts/extractLinesByIds.py +48 -0
- package/scripts/extractMultiLineStringsByIds.py +48 -0
- package/scripts/extractPointsByIds.py +42 -0
- package/scripts/extractPolygonsByIds.py +42 -0
- package/scripts/geojson2ts.py +79 -0
- package/scripts/getOsm.sh +62 -0
- package/scripts/initQgisPrj.py +44 -0
- package/scripts/makeAreas.py +21 -0
- package/scripts/makeAreas.sh +20 -0
- package/scripts/makeExtent.py +21 -0
- package/scripts/makeMeasures.py +25 -0
- package/scripts/makeOrigin.py +30 -0
- package/scripts/makeViewbox.py +22 -0
- package/scripts/osmconf.ini +122 -0
- package/scripts/pyqgis-Ubuntu.sh +36 -0
- package/scripts/pyqgis-macOS.sh +40 -0
- package/scripts/pyqgis.sh +34 -0
- package/scripts/readOsm.py +37 -0
- package/scripts/readOsm.sh +27 -0
- package/scripts/regen.sh +21 -0
- package/scripts/run-common.sh +3 -0
- package/scripts/tagAddresses.py +51 -0
- package/scripts/update.sh +53 -0
- package/src/geojsonToTs.ts +15 -0
- package/src/lib/geojson/geojson-print.test.ts +60 -0
- package/src/lib/geojson/geojson-print.ts +211 -0
- package/src/lib/geojson/geojson-schema.test.ts +42 -0
- package/src/lib/geojson/geojson-schema.ts +151 -0
- package/src/lib/geojson/geojson-types.ts +116 -0
- package/src/lib/osm.test.ts +17 -0
- package/src/lib/osm.ts +18 -0
- package/src/lib/print-utils.test.ts +12 -0
- package/src/lib/print-utils.ts +22 -0
- package/src/lib/print.ts +122 -0
- package/test/geojson.json +22 -0
- package/tsconfig.app.json +34 -0
- package/tsconfig.json +7 -0
- package/tsconfig.node-browser.json +27 -0
- package/tsconfig.node.json +24 -0
package/eslint.config.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import js from '@eslint/js'
|
|
2
|
+
import functional from 'eslint-plugin-functional'
|
|
3
|
+
import prettierRecommended from 'eslint-plugin-prettier/recommended'
|
|
4
|
+
import { defineConfig } from 'eslint/config'
|
|
5
|
+
import globals from 'globals'
|
|
6
|
+
import ts from 'typescript-eslint'
|
|
7
|
+
|
|
8
|
+
export default defineConfig(
|
|
9
|
+
{
|
|
10
|
+
ignores: [
|
|
11
|
+
'**/dist',
|
|
12
|
+
'**/*.d.ts',
|
|
13
|
+
'**/*.config.{js,ts}',
|
|
14
|
+
'**/*.config-*.{js,ts}',
|
|
15
|
+
'**/test',
|
|
16
|
+
'**/*.test.{js,ts}',
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
files: ['src/*.{ts,tsx}', 'src/**/*.{ts,tsx}'],
|
|
21
|
+
},
|
|
22
|
+
js.configs.recommended,
|
|
23
|
+
ts.configs.recommendedTypeChecked,
|
|
24
|
+
{
|
|
25
|
+
languageOptions: {
|
|
26
|
+
globals: {
|
|
27
|
+
...globals.browser,
|
|
28
|
+
...globals.node,
|
|
29
|
+
},
|
|
30
|
+
parserOptions: {
|
|
31
|
+
tsconfigRootDir: import.meta.dirname,
|
|
32
|
+
projectService: true,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
...functional.configs.recommended,
|
|
38
|
+
ignores: [
|
|
39
|
+
'packages/app/src/**/*',
|
|
40
|
+
'**/*.test.{js,ts}',
|
|
41
|
+
'**/*-react.{js,ts}',
|
|
42
|
+
'**/*-xstate.{js,ts}',
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
...functional.configs.strict,
|
|
47
|
+
ignores: ['**/*'],
|
|
48
|
+
},
|
|
49
|
+
prettierRecommended,
|
|
50
|
+
{
|
|
51
|
+
rules: {
|
|
52
|
+
'@typescript-eslint/consistent-type-imports': [
|
|
53
|
+
'error',
|
|
54
|
+
{ prefer: 'type-imports', fixStyle: 'inline-type-imports' },
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
}
|
|
58
|
+
)
|
package/oxlintrc.json
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "svgmapviewer-tools-osm",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"bin": {
|
|
5
|
+
"svgmapviewer-tools-osm-copy": "./scripts/copy.sh",
|
|
6
|
+
"svgmapviewer-tools-osm-extractAreas": "./scripts/extractAreas.sh",
|
|
7
|
+
"svgmapviewer-tools-osm-geojson2ts": "./dist/geojsonToTs.js",
|
|
8
|
+
"svgmapviewer-tools-osm-getOsm": "./scripts/getOsm.sh",
|
|
9
|
+
"svgmapviewer-tools-osm-readOsm": "./scripts/readOsm.sh",
|
|
10
|
+
"svgmapviewer-tools-osm-regen": "./scripts/regen.sh"
|
|
11
|
+
},
|
|
12
|
+
"type": "module",
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@effect/cli": "^0.75.0",
|
|
15
|
+
"@effect/platform": "^0.96.0",
|
|
16
|
+
"@effect/platform-node": "^0.106.0",
|
|
17
|
+
"@effect/printer": "^0.49.0",
|
|
18
|
+
"@rslib/core": "^0.20.1",
|
|
19
|
+
"@rstest/core": "^0.9.5",
|
|
20
|
+
"@types/node": "24.x",
|
|
21
|
+
"effect": "^3.21.0",
|
|
22
|
+
"geojson-schema": "^1.0.5",
|
|
23
|
+
"typescript": "^5.9.3"
|
|
24
|
+
},
|
|
25
|
+
"lint-staged": {
|
|
26
|
+
"*.{ts,tsx}": "eslint --fix",
|
|
27
|
+
"*": "oxfmt --write"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"dev": "rslib build --watch",
|
|
31
|
+
"build": "rslib build",
|
|
32
|
+
"test": "rstest",
|
|
33
|
+
"test:dev": "rstest --watch"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const config = {
|
|
2
|
+
trailingComma: 'es5',
|
|
3
|
+
tabWidth: 2,
|
|
4
|
+
semi: false,
|
|
5
|
+
singleQuote: true,
|
|
6
|
+
plugins: ['@ianvs/prettier-plugin-sort-imports', '@prettier/plugin-oxc'],
|
|
7
|
+
|
|
8
|
+
// @ianvs/prettier-plugin-sort-imports
|
|
9
|
+
importOrderParserPlugins: ['typescript', 'jsx'],
|
|
10
|
+
importOrderTypeScriptVersion: '5.0.0',
|
|
11
|
+
importOrderCaseSensitive: false,
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default config
|
package/rslib.config.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { defineConfig } from '@rslib/core'
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
lib: [
|
|
5
|
+
{
|
|
6
|
+
format: 'esm',
|
|
7
|
+
syntax: 'esnext',
|
|
8
|
+
output: {
|
|
9
|
+
distPath: './dist',
|
|
10
|
+
minify: {
|
|
11
|
+
js: true,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
source: {
|
|
17
|
+
entry: {
|
|
18
|
+
geojsonToTs: ['src/geojsonToTs.ts'],
|
|
19
|
+
},
|
|
20
|
+
tsconfigPath: './tsconfig.app.json',
|
|
21
|
+
},
|
|
22
|
+
})
|
package/rstest.config.ts
ADDED
|
Binary file
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#! /Applications/QGIS3.14.app/Contents/MacOS/bin/python
|
|
2
|
+
|
|
3
|
+
import pathlib
|
|
4
|
+
import os
|
|
5
|
+
import os.path
|
|
6
|
+
import sys
|
|
7
|
+
|
|
8
|
+
####
|
|
9
|
+
|
|
10
|
+
prefix = sys.argv[1]
|
|
11
|
+
|
|
12
|
+
addrTmpl = 'A-1f-%s-%s-%d'
|
|
13
|
+
|
|
14
|
+
prjdir = './%s' % prefix
|
|
15
|
+
datdir = './%s' % prefix
|
|
16
|
+
prjdat = '%s/map.qgz' % prjdir
|
|
17
|
+
|
|
18
|
+
areasGJ = '%s/areas.geojson' % datdir
|
|
19
|
+
|
|
20
|
+
####
|
|
21
|
+
|
|
22
|
+
# - Read areas.geojson
|
|
23
|
+
# - For each layer (init-<layer>.geojson):
|
|
24
|
+
# - Classify geometries by common.classifyGeometries()
|
|
25
|
+
# - Then output to <prefix>-<layer>.geojson
|
|
26
|
+
|
|
27
|
+
import common
|
|
28
|
+
|
|
29
|
+
common.openPrj(prjdir)
|
|
30
|
+
|
|
31
|
+
areas = common.openVector(areasGJ, "areas")
|
|
32
|
+
|
|
33
|
+
for (layername, _) in common.osmLayerNames:
|
|
34
|
+
srcGJ = '%s/%s-%s.geojson' % (datdir, 'init', layername)
|
|
35
|
+
dstBase = '%s/%s-%s' % (datdir, prefix, layername)
|
|
36
|
+
s = common.openVector(srcGJ, 'init-%s' % layername)
|
|
37
|
+
d = common.classifyGeometries(s, areas)
|
|
38
|
+
common.dumpGeoJSON(d, '%s.geojson' % dstBase)
|
|
39
|
+
common.dumpCSV(d, '%s.csv' % dstBase)
|
|
40
|
+
|
|
41
|
+
# XXX Hoge/Hoge-multipolygons.geojson -> Hoge/Hoge-centroids.geojson
|
|
42
|
+
src = '%s/%s-%s.geojson' % (datdir, prefix, 'multipolygons')
|
|
43
|
+
dstBase = '%s/%s-%s' % (datdir, prefix, 'centroids')
|
|
44
|
+
d = common.centroids(src, 'memory:')
|
|
45
|
+
common.dumpGeoJSON(d, '%s.geojson' % dstBase)
|
|
46
|
+
common.dumpCSV(d, '%s.csv' % dstBase)
|
|
47
|
+
|
|
48
|
+
src = '%s/%s-%s.geojson' % (datdir, prefix, 'lines')
|
|
49
|
+
dstBase = '%s/%s-%s' % (datdir, prefix, 'midpoints')
|
|
50
|
+
d = common.centroids(src, 'memory:')
|
|
51
|
+
common.dumpGeoJSON(d, '%s.geojson' % dstBase)
|
|
52
|
+
common.dumpCSV(d, '%s.csv' % dstBase)
|
|
53
|
+
|
|
54
|
+
common.exit()
|
|
55
|
+
|
|
56
|
+
exit()
|