text-to-map 1.1.20 → 1.1.22
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.d.ts +1 -2
- package/dist/index.js +5 -3
- package/dist/street-markdown/polygons.js +14 -2
- package/dist/street-markdown/smd.js +2 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { downloadAndImportAddressPoints } from "./open-data-sync/address-points"
|
|
|
3
3
|
import { importCities } from "./open-data-sync/cities";
|
|
4
4
|
import { downloadAndImportRegions } from "./open-data-sync/regions";
|
|
5
5
|
import { downloadAndImportSchools } from "./open-data-sync/schools";
|
|
6
|
-
import { downloadAndImportStreets } from "./open-data-sync/streets";
|
|
7
6
|
import { municipalityToPolygons } from "./street-markdown/polygons";
|
|
8
7
|
import { OpenDataSyncOptionsPartial } from "./utils/helpers";
|
|
9
8
|
export * from "./street-markdown/smd";
|
|
@@ -20,4 +19,4 @@ export * from "./street-markdown/types";
|
|
|
20
19
|
* ```
|
|
21
20
|
*/
|
|
22
21
|
export declare function downloadAndImportEverything(options?: OpenDataSyncOptionsPartial, syncStreets?: boolean): Promise<void>;
|
|
23
|
-
export { clearDb, downloadAndImportAddressPoints, downloadAndImportRegions, downloadAndImportSchools,
|
|
22
|
+
export { clearDb, downloadAndImportAddressPoints, downloadAndImportRegions, downloadAndImportSchools, importCities, municipalityToPolygons, initDb, };
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import { downloadAndImportAddressPoints } from "./open-data-sync/address-points"
|
|
|
12
12
|
import { importCities } from "./open-data-sync/cities";
|
|
13
13
|
import { downloadAndImportRegions } from "./open-data-sync/regions";
|
|
14
14
|
import { downloadAndImportSchools } from "./open-data-sync/schools";
|
|
15
|
-
import { downloadAndImportStreets } from "./open-data-sync/streets";
|
|
15
|
+
// import { downloadAndImportStreets } from "./open-data-sync/streets";
|
|
16
16
|
import { municipalityToPolygons } from "./street-markdown/polygons";
|
|
17
17
|
export * from "./street-markdown/smd";
|
|
18
18
|
export * from "./street-markdown/types";
|
|
@@ -35,8 +35,10 @@ export function downloadAndImportEverything(options = {}, syncStreets = true) {
|
|
|
35
35
|
yield downloadAndImportRegions(options);
|
|
36
36
|
yield importCities(options);
|
|
37
37
|
if (syncStreets) {
|
|
38
|
-
|
|
38
|
+
// await downloadAndImportStreets(options);
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
-
export { clearDb, downloadAndImportAddressPoints, downloadAndImportRegions, downloadAndImportSchools,
|
|
42
|
+
export { clearDb, downloadAndImportAddressPoints, downloadAndImportRegions, downloadAndImportSchools,
|
|
43
|
+
// downloadAndImportStreets,
|
|
44
|
+
importCities, municipalityToPolygons, initDb, };
|
|
@@ -39,6 +39,18 @@ export const createPolygons = (municipality, cityPolygons) => {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
+
for (const point of municipality.unmappedPoints) {
|
|
43
|
+
uniquePoints.set(point.address, {
|
|
44
|
+
type: "Feature",
|
|
45
|
+
geometry: {
|
|
46
|
+
type: "Point",
|
|
47
|
+
coordinates: [point.lng, point.lat],
|
|
48
|
+
},
|
|
49
|
+
properties: {
|
|
50
|
+
schools: ["unmapped"],
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
}
|
|
42
54
|
const points = {
|
|
43
55
|
type: "FeatureCollection",
|
|
44
56
|
features: Array.from(uniquePoints.values()),
|
|
@@ -46,14 +58,14 @@ export const createPolygons = (municipality, cityPolygons) => {
|
|
|
46
58
|
const polygons = d3DelaunayVoronoi(points);
|
|
47
59
|
const unitedPolygons = [];
|
|
48
60
|
let colorIndex = 0;
|
|
49
|
-
for (const school of municipality.schools) {
|
|
61
|
+
for (const school of [...municipality.schools, { izo: "unmapped" }]) {
|
|
50
62
|
const schoolPolygons = polygons.features.filter((polygon) => polygon.properties.schools.includes(school.izo));
|
|
51
63
|
const schoolPolygon = intersect(schoolPolygons.length > 1
|
|
52
64
|
? union(featureCollection(schoolPolygons))
|
|
53
65
|
: schoolPolygons[0], citiesMultipolygon);
|
|
54
66
|
unitedPolygons.push(Object.assign(Object.assign({}, schoolPolygon), { properties: {
|
|
55
67
|
schoolIzo: school.izo,
|
|
56
|
-
colorIndex,
|
|
68
|
+
colorIndex: school.izo === "unmapped" ? -1 : colorIndex,
|
|
57
69
|
} }));
|
|
58
70
|
colorIndex++;
|
|
59
71
|
}
|
|
@@ -290,7 +290,7 @@ const addRestOfMunicipality = (lineNumber, state) => __awaiter(void 0, void 0, v
|
|
|
290
290
|
addRestToSchool(yield getRestOfMunicipality(state), state.rests.wholeMunicipalitySchool.izo, lineNumber, state);
|
|
291
291
|
});
|
|
292
292
|
const addRestOfMunicipalityToUnmappedPoints = (state) => __awaiter(void 0, void 0, void 0, function* () {
|
|
293
|
-
state.currentMunicipality.unmappedPoints = (yield getRestOfMunicipality(state)).map(mapAddressPointForExport);
|
|
293
|
+
state.currentMunicipality.unmappedPoints = (yield getRestOfMunicipality(state)).map((point) => mapAddressPointForExport(point));
|
|
294
294
|
});
|
|
295
295
|
const getRestOfMunicipality = (state) => __awaiter(void 0, void 0, void 0, function* () {
|
|
296
296
|
// get all address points for current municipality
|
|
@@ -370,7 +370,7 @@ const getAllAddressPointsIds = (municipality) => {
|
|
|
370
370
|
return addressPointsIds;
|
|
371
371
|
};
|
|
372
372
|
const mapAddressPointForExport = (addressPoint, lineNumber) => {
|
|
373
|
-
return Object.assign({ address: addressPoint.address, lat: addressPoint.lat, lng: addressPoint.lng }, (lineNumber ? { lineNumbers: [lineNumber - 1] } : {}));
|
|
373
|
+
return Object.assign({ address: addressPoint.address, lat: addressPoint.lat, lng: addressPoint.lng }, (lineNumber !== undefined ? { lineNumbers: [lineNumber - 1] } : {}));
|
|
374
374
|
};
|
|
375
375
|
const mapSchoolForExport = (school) => (Object.assign(Object.assign({}, school), { position: school.position ? mapAddressPointForExport(school.position) : null }));
|
|
376
376
|
const cleanLine = (line) => {
|
package/package.json
CHANGED
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
},
|
|
69
69
|
"name": "text-to-map",
|
|
70
70
|
"description": "Text To Map usiluje o lepší, strojově zpracovatelné využití částí vyhlášek s výčtem ulic a dalších lokací. Jde o rozšiřitelnou sadu konceptů a nástrojů, které zajistí hladký převod výčtu ulic a jejich rozsahů v lidsky srozumitelném jazyce do strojově zpracovatelného, uchopitelného formátu.",
|
|
71
|
-
"version": "1.1.
|
|
71
|
+
"version": "1.1.22",
|
|
72
72
|
"main": "dist/index.js",
|
|
73
73
|
"types": "dist/index.d.ts",
|
|
74
74
|
"files": [
|