diff --git a/src/common/maps/galil-tahton.data.ts b/src/common/maps/galil-tahton.data.ts index 7c9c9a1..d90b339 100644 --- a/src/common/maps/galil-tahton.data.ts +++ b/src/common/maps/galil-tahton.data.ts @@ -1,92 +1,86 @@ -// import * as pimage from "pureimage"; -// import { Bitmap } from "pureimage/types/bitmap"; -// import { Readable } from "stream"; -// import { MapData, UrlResult, UrlUsageType } from "./map.data"; -// -// export const mapDataGalilTahton: MapData = { -// name: "Galil Tahton", -// -// urlProvider: async (usageType: UrlUsageType, mapType: string, zoomLevel: number, row: number, col: number): Promise => { -// const zoomLevelStr = (zoomLevel + 4).toString(); -// https://v5.gis-net.co.il/proxy/proxy.ashx?http://10.237.72.71:8080/geoserver/gwc/service/wmts?SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&LAYER=Galil_tachton_SHP:Galil_tachton_Reka&STYLE=raster&FORMAT=image/jpeg&TILEMATRIXSET=Galil_tachton&TILEMATRIX=Galil_tachton:8&TILEROW=110&TILECOL=128 -// debugger -// return { url: `https://v5.gis-net.co.il/proxy/proxy.ashx?http://10.237.72.71:8080/geoserver/gwc/service/wmts?SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&LAYER=Galil_tachton_2023:2023&STYLE=raster&FORMAT=image/jpeg&TILEMATRIXSET=Galil_tachton&TILEMATRIX=Galil_tachton:${zoomLevelStr}&TILEROW=${row}&TILECOL=${col}` }; -// }, -// -// zoomLevelProvider: (zoomLevel: number): string => { -// return (zoomLevel + 4).toString(); -// }, -// -// zoomFactorProvider: (zoomLevel: number, zoomIn: boolean): number => { -// return 2; -// }, -// -// decode: async (mapType: string, buffer: Buffer): Promise => { -// return pimage.decodeJPEGFromStream(Readable.from(buffer)); -// }, -// -// supportedMapTypes: ["Satellite"], -// -// showScale: true, -// -// referer: undefined, -// -// zoomLayers: [ -// { -// scale: 32000, -// centerTileX: 8, -// centerTileY: 7, -// centerTileOffsetX: 117, -// centerTileOffsetY: 61, -// }, -// { -// scale: 16000, -// centerTileX: 16, -// centerTileY: 14, -// centerTileOffsetX: 234, -// centerTileOffsetY: 122, -// }, -// { -// scale: 8000, -// centerTileX: 33, -// centerTileY: 28, -// centerTileOffsetX: 213, -// centerTileOffsetY: 247, -// }, -// { -// scale: 4000, -// centerTileX: 67, -// centerTileY: 57, -// centerTileOffsetX: 171, -// centerTileOffsetY: 239, -// }, -// { -// scale: 2000, -// centerTileX: 135, -// centerTileY: 115, -// centerTileOffsetX: 87, -// centerTileOffsetY: 219, -// }, -// { -// scale: 1000, -// centerTileX: 270, -// centerTileY: 231, -// centerTileOffsetX: 179, -// centerTileOffsetY: 190, -// }, -// { -// scale: 500, -// centerTileX: 541, -// centerTileY: 463, -// centerTileOffsetX: 108, -// centerTileOffsetY: 129, -// }, -// { -// scale: 250, -// centerTileX: 1082, -// centerTileY: 927, -// centerTileOffsetX: 219, -// centerTileOffsetY: 5, -// } -// ], -// }; +import { MapData, UrlResult, UrlUsageType } from './map.data' + +export const mapDataGalilTahton: MapData = { + name: 'Galil Tahton', + + urlProvider: async (_usageType: UrlUsageType, _mapType: string, zoomLevel: number, row: number, col: number): Promise => { + const zoomLevelStr = (zoomLevel + 4).toString() + + return { + url: `https://v5.gis-net.co.il/proxy/proxy.ashx?http://10.237.72.71:8080/geoserver/gwc/service/wmts?SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&LAYER=Galil_tachton_2023:2023&STYLE=raster&FORMAT=image/jpeg&TILEMATRIXSET=Galil_tachton&TILEMATRIX=Galil_tachton:${zoomLevelStr}&TILEROW=${row}&TILECOL=${col}` + } + }, + + zoomLevelProvider: (zoomLevel: number): string => { + return (zoomLevel + 4).toString() + }, + + zoomFactorProvider: (_zoomLevel: number, _zoomIn: boolean): number => { + return 2 + }, + + supportedMapTypes: ['Satellite'], + + showScale: true, + + referer: 'https://v5.gis-net.co.il/v5/GalilTachton', + + zoomLayers: [ + { + scale: 32000, + centerTileX: 8, + centerTileY: 7, + centerTileOffsetX: 117, + centerTileOffsetY: 61 + }, + { + scale: 16000, + centerTileX: 16, + centerTileY: 14, + centerTileOffsetX: 234, + centerTileOffsetY: 122 + }, + { + scale: 8000, + centerTileX: 33, + centerTileY: 28, + centerTileOffsetX: 213, + centerTileOffsetY: 247 + }, + { + scale: 4000, + centerTileX: 67, + centerTileY: 57, + centerTileOffsetX: 171, + centerTileOffsetY: 239 + }, + { + scale: 2000, + centerTileX: 135, + centerTileY: 115, + centerTileOffsetX: 87, + centerTileOffsetY: 219 + }, + { + scale: 1000, + centerTileX: 270, + centerTileY: 231, + centerTileOffsetX: 179, + centerTileOffsetY: 190 + }, + { + scale: 500, + centerTileX: 541, + centerTileY: 463, + centerTileOffsetX: 108, + centerTileOffsetY: 129 + }, + { + scale: 250, + centerTileX: 1082, + centerTileY: 927, + centerTileOffsetX: 219, + centerTileOffsetY: 5 + } + ] +} diff --git a/src/common/maps/hod-hasharon.data.ts b/src/common/maps/hod-hasharon.data.ts index bc26fc0..b3b3164 100644 --- a/src/common/maps/hod-hasharon.data.ts +++ b/src/common/maps/hod-hasharon.data.ts @@ -1,86 +1,81 @@ -// import * as pimage from "pureimage"; -// import { Bitmap } from "pureimage/types/bitmap"; -// import { Readable } from "stream"; -// import { MapData, UrlResult, UrlUsageType } from "./map.data"; -// -// export const mapDataHodHasharon: MapData = { -// name: "Hod Hasharon", -// -// urlProvider: async (usageType: UrlUsageType, mapType: string, zoomLevel: number, row: number, col: number): Promise => { -// let zoomLevelStr = (zoomLevel + 3).toString(); -// const rowStr = row.toString(); -// const colStr = col.toString(); -// const mapTypeStr = mapType === "Satellite" ? "Hod_Hasharon_2022:2022" : "Hod_Hasharon_SHP:Hod_Hasharon_Reka"; -// return { url: `https://v5.gis-net.co.il/proxy/proxy.ashx?http://10.237.72.70:8080/geoserver/gwc/service/wmts?SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&LAYER=${mapTypeStr}&STYLE=raster&FORMAT=image/jpeg&TILEMATRIXSET=Hod_Hasharon&TILEMATRIX=Hod_Hasharon:${zoomLevelStr}&TILEROW=${rowStr}&TILECOL=${colStr}` }; -// }, -// -// zoomLevelProvider: (zoomLevel: number): string => { -// return zoomLevel.toString(); -// }, -// -// zoomFactorProvider: (zoomLevel: number, zoomIn: boolean): number => { -// return 2; -// }, -// -// decode: async (mapType: string, buffer: Buffer): Promise => { -// return await pimage.decodeJPEGFromStream(Readable.from(buffer)); -// }, -// -// supportedMapTypes: ["Satellite", "Street & Buildings"], -// -// showScale: true, -// -// referer: undefined, -// -// zoomLayers: [ -// { -// scale: 16000, -// centerTileX: 3, -// centerTileY: 4, -// centerTileOffsetX: 221, -// centerTileOffsetY: 216, -// }, -// { -// scale: 8000, -// centerTileX: 7, -// centerTileY: 9, -// centerTileOffsetX: 184, -// centerTileOffsetY: 176, -// }, -// { -// scale: 4000, -// centerTileX: 15, -// centerTileY: 19, -// centerTileOffsetX: 111, -// centerTileOffsetY: 96, -// }, -// { -// scale: 2000, -// centerTileX: 30, -// centerTileY: 38, -// centerTileOffsetX: 223, -// centerTileOffsetY: 192, -// }, -// { -// scale: 1000, -// centerTileX: 61, -// centerTileY: 77, -// centerTileOffsetX: 193, -// centerTileOffsetY: 129, -// }, -// { -// scale: 500, -// centerTileX: 123, -// centerTileY: 155, -// centerTileOffsetX: 130, -// centerTileOffsetY: 3, -// }, -// { -// scale: 250, -// centerTileX: 247, -// centerTileY: 310, -// centerTileOffsetX: 4, -// centerTileOffsetY: 6, -// }, -// ], -// }; +import { MapData, UrlResult, UrlUsageType } from './map.data' + +export const mapDataHodHasharon: MapData = { + name: 'Hod Hasharon', + + urlProvider: async (_usageType: UrlUsageType, mapType: string, zoomLevel: number, row: number, col: number): Promise => { + const zoomLevelStr = (zoomLevel + 3).toString() + const rowStr = row.toString() + const colStr = col.toString() + const mapTypeStr = mapType === 'Satellite' ? 'Hod_Hasharon_2022:2022' : 'Hod_Hasharon_SHP:Hod_Hasharon_Reka' + return { + url: `https://v5.gis-net.co.il/proxy/proxy.ashx?http://10.237.72.70:8080/geoserver/gwc/service/wmts?SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&LAYER=${mapTypeStr}&STYLE=raster&FORMAT=image/jpeg&TILEMATRIXSET=Hod_Hasharon&TILEMATRIX=Hod_Hasharon:${zoomLevelStr}&TILEROW=${rowStr}&TILECOL=${colStr}` + } + }, + + zoomLevelProvider: (zoomLevel: number): string => { + return zoomLevel.toString() + }, + + zoomFactorProvider: (_zoomLevel: number, _zoomIn: boolean): number => { + return 2 + }, + + supportedMapTypes: ['Satellite', 'Street & Buildings'], + + showScale: true, + + referer: 'https://v5.gis-net.co.il/v5/Hod_Hasharon', + + zoomLayers: [ + { + scale: 16000, + centerTileX: 3, + centerTileY: 4, + centerTileOffsetX: 221, + centerTileOffsetY: 216 + }, + { + scale: 8000, + centerTileX: 7, + centerTileY: 9, + centerTileOffsetX: 184, + centerTileOffsetY: 176 + }, + { + scale: 4000, + centerTileX: 15, + centerTileY: 19, + centerTileOffsetX: 111, + centerTileOffsetY: 96 + }, + { + scale: 2000, + centerTileX: 30, + centerTileY: 38, + centerTileOffsetX: 223, + centerTileOffsetY: 192 + }, + { + scale: 1000, + centerTileX: 61, + centerTileY: 77, + centerTileOffsetX: 193, + centerTileOffsetY: 129 + }, + { + scale: 500, + centerTileX: 123, + centerTileY: 155, + centerTileOffsetX: 130, + centerTileOffsetY: 3 + }, + { + scale: 250, + centerTileX: 247, + centerTileY: 310, + centerTileOffsetX: 4, + centerTileOffsetY: 6 + } + ] +} diff --git a/src/common/maps/map.data.ts b/src/common/maps/map.data.ts index ec928bb..2f74643 100644 --- a/src/common/maps/map.data.ts +++ b/src/common/maps/map.data.ts @@ -2,6 +2,8 @@ import { mapDataGovMap } from './govmap.data' import { mapDataTelAviv } from './tel-aviv.data' import { mapDataHaifa } from './haifa.data' import { mapDataNetanya } from './netanya.data' +import { mapDataGalilTahton } from './galil-tahton.data' +import { mapDataHodHasharon } from './hod-hasharon.data' export type ZoomLayer = { readonly scale: number @@ -35,10 +37,10 @@ export type MapData = { export const maps = [ mapDataGovMap, - // mapDataGalilTahton, + mapDataGalilTahton, mapDataTelAviv, mapDataHaifa, - // mapDataHodHasharon, + mapDataHodHasharon, mapDataNetanya, // mapDataMapy ] diff --git a/src/main/maps/galil-tahton.backend.ts b/src/main/maps/galil-tahton.backend.ts new file mode 100644 index 0000000..6d8b353 --- /dev/null +++ b/src/main/maps/galil-tahton.backend.ts @@ -0,0 +1,12 @@ +import * as pimage from 'pureimage' +import { Bitmap } from 'pureimage' +import { Readable } from 'stream' +import { MapBackendData } from './map-backend' + +export const mapBackendGalilTahton: MapBackendData = { + name: 'Galil Tahton', + + decode: async (_mapType: string, buffer: Buffer): Promise => { + return pimage.decodeJPEGFromStream(Readable.from(buffer)) + } +} diff --git a/src/main/maps/hod-hasharon.backend.ts b/src/main/maps/hod-hasharon.backend.ts new file mode 100644 index 0000000..48dd5ec --- /dev/null +++ b/src/main/maps/hod-hasharon.backend.ts @@ -0,0 +1,12 @@ +import * as pimage from 'pureimage' +import { Bitmap } from 'pureimage' +import { Readable } from 'stream' +import { MapBackendData } from './map-backend' + +export const mapBackendHodHasharon: MapBackendData = { + name: 'Hod Hasharon', + + decode: async (_mapType: string, buffer: Buffer): Promise => { + return await pimage.decodeJPEGFromStream(Readable.from(buffer)) + } +} diff --git a/src/main/maps/map-backend.ts b/src/main/maps/map-backend.ts index aacd899..aa87a31 100644 --- a/src/main/maps/map-backend.ts +++ b/src/main/maps/map-backend.ts @@ -3,6 +3,8 @@ import { Bitmap } from 'pureimage' import { mapBackendTelAviv } from './tel-aviv.backend' import { mapBackendDataHaifa } from './haifa.backend' import { mapBackendDataNetanya } from './netanya.backend' +import { mapBackendHodHasharon } from './hod-hasharon.backend' +import { mapBackendGalilTahton } from './galil-tahton.backend' export type MapBackendData = { name: string @@ -11,10 +13,10 @@ export type MapBackendData = { const mapBackend = [ mapBackendDataGovMap, - // mapDataGalilTahton, + mapBackendGalilTahton, mapBackendTelAviv, mapBackendDataHaifa, - // mapDataHodHasharon, + mapBackendHodHasharon, mapBackendDataNetanya // mapDataMapy ]