diff --git a/dist/index.html b/dist/index.html index 65f8192b..6c65b53a 100644 --- a/dist/index.html +++ b/dist/index.html @@ -4185,6 +4185,109 @@

+
+

+ Map Type Hybrid (map-type-hybrid) +

+
+ Initialize a map with the hybrid satellite view and use the built-in + map type control to switch between roadmap and satellite. +
+ +
+
+ +/** + * @external https://vitejs.dev/guide/env-and-mode.html + */ +interface ImportMetaEnv { + readonly VITE_WOOSMAP_PUBLIC_API_KEY: string; +} + +interface ImportMeta { + readonly env: ImportMetaEnv; +} diff --git a/dist/samples/map-type-hybrid/app/index.html b/dist/samples/map-type-hybrid/app/index.html new file mode 100644 index 00000000..108176b8 --- /dev/null +++ b/dist/samples/map-type-hybrid/app/index.html @@ -0,0 +1,20 @@ + + + + Map Type Hybrid + + + + + + + + +
+ + + + diff --git a/dist/samples/map-type-hybrid/app/index.ts b/dist/samples/map-type-hybrid/app/index.ts new file mode 100644 index 00000000..b0de25bd --- /dev/null +++ b/dist/samples/map-type-hybrid/app/index.ts @@ -0,0 +1,31 @@ +// Initialize and add the map with hybrid (satellite) map type +let map: woosmap.map.Map; + +function initMap(): void { + const position: woosmap.map.LatLngLiteral = { + lat: 48.8584, + lng: 2.2945, + }; + + // The map, initialized with hybrid satellite view + map = new woosmap.map.Map(document.getElementById("map") as HTMLElement, { + zoom: 16, + center: position, + mapTypeId: woosmap.map.MapTypeId.HYBRID, + mapTypeControl: true, + }); + + // Listen for map type changes via the built-in control + map.addListener("mapTypeId_changed", () => { + console.log("Map type switched to:", map.getMapTypeId()); + }); +} + +declare global { + interface Window { + initMap: () => void; + } +} +window.initMap = initMap; + +export {}; diff --git a/dist/samples/map-type-hybrid/app/package.json b/dist/samples/map-type-hybrid/app/package.json new file mode 100644 index 00000000..eed6247a --- /dev/null +++ b/dist/samples/map-type-hybrid/app/package.json @@ -0,0 +1,33 @@ +{ + "name": "map-type-hybrid", + "description": "Samples for Woosmap Map JS API", + "version": "1.45.2", + "keywords": [ + "woosmap", + "javascript", + "map" + ], + "homepage": "https://github.com/woosmap/js-samples#readme", + "bugs": { + "url": "https://github.com/woosmap/js-samples/issues" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/woosmap/js-samples.git" + }, + "files": [], + "private": true, + "scripts": { + "dev": "vite", + "start": "vite", + "build": "vite build --outDir dist --base './'", + "test": "tsc --no-emit", + "preview": "vite preview" + }, + "devDependencies": { + "@types/woosmap.map": "^1.4.24", + "typescript": "^5.3.3", + "vite": "^6.4.1" + }, + "dependencies": {} +} \ No newline at end of file diff --git a/dist/samples/map-type-hybrid/app/style.css b/dist/samples/map-type-hybrid/app/style.css new file mode 100644 index 00000000..02dace4d --- /dev/null +++ b/dist/samples/map-type-hybrid/app/style.css @@ -0,0 +1,19 @@ +/* + * Always set the map height explicitly to define the size of the div element + * that contains the map. + */ +#map { + height: 100%; +} + +/* + * Optional: Makes the sample page fill the window. + */ +html, +body { + height: 100%; + margin: 0; + padding: 0; + font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji; +} + diff --git a/dist/samples/map-type-hybrid/app/tsconfig.json b/dist/samples/map-type-hybrid/app/tsconfig.json new file mode 100644 index 00000000..b405998d --- /dev/null +++ b/dist/samples/map-type-hybrid/app/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "esnext", + "target": "esnext", + "strict": true, + "noImplicitAny": false, + "lib": [ + "esnext", + "es6", + "dom", + "dom.iterable" + ], + "moduleResolution": "Node", + "jsx": "preserve" + } +} \ No newline at end of file diff --git a/dist/samples/map-type-hybrid/app/vite.config.js b/dist/samples/map-type-hybrid/app/vite.config.js new file mode 100644 index 00000000..803ecc26 --- /dev/null +++ b/dist/samples/map-type-hybrid/app/vite.config.js @@ -0,0 +1,8 @@ +import { defineConfig } from "vite"; + +// https://vitejs.dev/config/ +export default defineConfig({ + server: { + hmr: process.env.CODESANDBOX_SSE ? 443 : undefined, + }, +}); diff --git a/dist/samples/map-type-hybrid/docs/index.html b/dist/samples/map-type-hybrid/docs/index.html new file mode 100644 index 00000000..42621648 --- /dev/null +++ b/dist/samples/map-type-hybrid/docs/index.html @@ -0,0 +1,22 @@ + + + + + Map Type Hybrid + + + + + + + + +
+ + + + + diff --git a/dist/samples/map-type-hybrid/docs/index.js b/dist/samples/map-type-hybrid/docs/index.js new file mode 100644 index 00000000..ad9c219f --- /dev/null +++ b/dist/samples/map-type-hybrid/docs/index.js @@ -0,0 +1,25 @@ +// [START woosmap_map_type_hybrid] +// Initialize and add the map with hybrid (satellite) map type +let map; + +function initMap() { + const position = { + lat: 48.8584, + lng: 2.2945, + }; + + // The map, initialized with hybrid satellite view + map = new woosmap.map.Map(document.getElementById("map"), { + zoom: 16, + center: position, + mapTypeId: woosmap.map.MapTypeId.HYBRID, + mapTypeControl: true, + }); + // Listen for map type changes via the built-in control + map.addListener("mapTypeId_changed", () => { + console.log("Map type switched to:", map.getMapTypeId()); + }); +} + +window.initMap = initMap; +// [END woosmap_map_type_hybrid] diff --git a/dist/samples/map-type-hybrid/docs/index.ts b/dist/samples/map-type-hybrid/docs/index.ts new file mode 100644 index 00000000..24715217 --- /dev/null +++ b/dist/samples/map-type-hybrid/docs/index.ts @@ -0,0 +1,33 @@ +// [START woosmap_map_type_hybrid] +// Initialize and add the map with hybrid (satellite) map type +let map: woosmap.map.Map; + +function initMap(): void { + const position: woosmap.map.LatLngLiteral = { + lat: 48.8584, + lng: 2.2945, + }; + + // The map, initialized with hybrid satellite view + map = new woosmap.map.Map(document.getElementById("map") as HTMLElement, { + zoom: 16, + center: position, + mapTypeId: woosmap.map.MapTypeId.HYBRID, + mapTypeControl: true, + }); + + // Listen for map type changes via the built-in control + map.addListener("mapTypeId_changed", () => { + console.log("Map type switched to:", map.getMapTypeId()); + }); +} + +declare global { + interface Window { + initMap: () => void; + } +} +window.initMap = initMap; +// [END woosmap_map_type_hybrid] + +export {}; diff --git a/dist/samples/map-type-hybrid/docs/style.css b/dist/samples/map-type-hybrid/docs/style.css new file mode 100644 index 00000000..f7b3bda9 --- /dev/null +++ b/dist/samples/map-type-hybrid/docs/style.css @@ -0,0 +1,21 @@ +/* [START woosmap_map_type_hybrid] */ +/* + * Always set the map height explicitly to define the size of the div element + * that contains the map. + */ +#map { + height: 100%; +} + +/* + * Optional: Makes the sample page fill the window. + */ +html, +body { + height: 100%; + margin: 0; + padding: 0; + font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji; +} + +/* [END woosmap_map_type_hybrid] */ \ No newline at end of file diff --git a/dist/samples/map-type-hybrid/highlight/highlight.html b/dist/samples/map-type-hybrid/highlight/highlight.html new file mode 100644 index 00000000..730c4f64 --- /dev/null +++ b/dist/samples/map-type-hybrid/highlight/highlight.html @@ -0,0 +1,1597 @@ + + + + Highlight + + + + + + + + +
+
+
+
+
+
+ + + + + + +
+ +
+
+
+
+
+

+              
+
+

+              
+
+

+              
+
+

+              
+
+
+
+
+
+ +
+
+ + + diff --git a/dist/samples/map-type-hybrid/highlight/index.html b/dist/samples/map-type-hybrid/highlight/index.html new file mode 100644 index 00000000..4d2187b6 --- /dev/null +++ b/dist/samples/map-type-hybrid/highlight/index.html @@ -0,0 +1,20 @@ + + + + Map Type Hybrid + + + + + + + + +
+ + + + diff --git a/dist/samples/map-type-hybrid/highlight/index.js b/dist/samples/map-type-hybrid/highlight/index.js new file mode 100644 index 00000000..5c50575c --- /dev/null +++ b/dist/samples/map-type-hybrid/highlight/index.js @@ -0,0 +1,23 @@ +// Initialize and add the map with hybrid (satellite) map type +let map; + +function initMap() { + const position = { + lat: 48.8584, + lng: 2.2945, + }; + + // The map, initialized with hybrid satellite view + map = new woosmap.map.Map(document.getElementById("map"), { + zoom: 16, + center: position, + mapTypeId: woosmap.map.MapTypeId.HYBRID, + mapTypeControl: true, + }); + // Listen for map type changes via the built-in control + map.addListener("mapTypeId_changed", () => { + console.log("Map type switched to:", map.getMapTypeId()); + }); +} + +window.initMap = initMap; diff --git a/dist/samples/map-type-hybrid/highlight/index.ts b/dist/samples/map-type-hybrid/highlight/index.ts new file mode 100644 index 00000000..b0de25bd --- /dev/null +++ b/dist/samples/map-type-hybrid/highlight/index.ts @@ -0,0 +1,31 @@ +// Initialize and add the map with hybrid (satellite) map type +let map: woosmap.map.Map; + +function initMap(): void { + const position: woosmap.map.LatLngLiteral = { + lat: 48.8584, + lng: 2.2945, + }; + + // The map, initialized with hybrid satellite view + map = new woosmap.map.Map(document.getElementById("map") as HTMLElement, { + zoom: 16, + center: position, + mapTypeId: woosmap.map.MapTypeId.HYBRID, + mapTypeControl: true, + }); + + // Listen for map type changes via the built-in control + map.addListener("mapTypeId_changed", () => { + console.log("Map type switched to:", map.getMapTypeId()); + }); +} + +declare global { + interface Window { + initMap: () => void; + } +} +window.initMap = initMap; + +export {}; diff --git a/dist/samples/map-type-hybrid/highlight/style.css b/dist/samples/map-type-hybrid/highlight/style.css new file mode 100644 index 00000000..02dace4d --- /dev/null +++ b/dist/samples/map-type-hybrid/highlight/style.css @@ -0,0 +1,19 @@ +/* + * Always set the map height explicitly to define the size of the div element + * that contains the map. + */ +#map { + height: 100%; +} + +/* + * Optional: Makes the sample page fill the window. + */ +html, +body { + height: 100%; + margin: 0; + padding: 0; + font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji; +} + diff --git a/dist/samples/map-type-hybrid/iframe/index.html b/dist/samples/map-type-hybrid/iframe/index.html new file mode 100644 index 00000000..f1c04992 --- /dev/null +++ b/dist/samples/map-type-hybrid/iframe/index.html @@ -0,0 +1,91 @@ + + + + Map Type Hybrid + + + + + + + + +
+ + + + diff --git a/dist/samples/map-type-hybrid/jsfiddle/demo.css b/dist/samples/map-type-hybrid/jsfiddle/demo.css new file mode 100644 index 00000000..02dace4d --- /dev/null +++ b/dist/samples/map-type-hybrid/jsfiddle/demo.css @@ -0,0 +1,19 @@ +/* + * Always set the map height explicitly to define the size of the div element + * that contains the map. + */ +#map { + height: 100%; +} + +/* + * Optional: Makes the sample page fill the window. + */ +html, +body { + height: 100%; + margin: 0; + padding: 0; + font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji; +} + diff --git a/dist/samples/map-type-hybrid/jsfiddle/demo.details b/dist/samples/map-type-hybrid/jsfiddle/demo.details new file mode 100644 index 00000000..ec540d85 --- /dev/null +++ b/dist/samples/map-type-hybrid/jsfiddle/demo.details @@ -0,0 +1,7 @@ +name: Map Type Hybrid +authors: + - Woosmap +tags: + - woosmap +load_type: h +description: Sample code for Woosmap Map JavaScript API diff --git a/dist/samples/map-type-hybrid/jsfiddle/demo.html b/dist/samples/map-type-hybrid/jsfiddle/demo.html new file mode 100644 index 00000000..aa92bf06 --- /dev/null +++ b/dist/samples/map-type-hybrid/jsfiddle/demo.html @@ -0,0 +1,19 @@ + + + + Map Type Hybrid + + + + + + + +
+ + + + diff --git a/dist/samples/map-type-hybrid/jsfiddle/demo.js b/dist/samples/map-type-hybrid/jsfiddle/demo.js new file mode 100644 index 00000000..5c50575c --- /dev/null +++ b/dist/samples/map-type-hybrid/jsfiddle/demo.js @@ -0,0 +1,23 @@ +// Initialize and add the map with hybrid (satellite) map type +let map; + +function initMap() { + const position = { + lat: 48.8584, + lng: 2.2945, + }; + + // The map, initialized with hybrid satellite view + map = new woosmap.map.Map(document.getElementById("map"), { + zoom: 16, + center: position, + mapTypeId: woosmap.map.MapTypeId.HYBRID, + mapTypeControl: true, + }); + // Listen for map type changes via the built-in control + map.addListener("mapTypeId_changed", () => { + console.log("Map type switched to:", map.getMapTypeId()); + }); +} + +window.initMap = initMap; diff --git a/package-lock.json b/package-lock.json index 164dc915..bd2020d4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ "@playwright/test": "^1.57.0", "@types/geojson": "^7946.0.16", "@types/supercluster": "^7.1.3", - "@types/woosmap.map": "^1.4.23", + "@types/woosmap.map": "^1.4.24", "@typescript-eslint/eslint-plugin": "^8.52.0", "@typescript-eslint/parser": "^8.15.0", "chalk": "^5.6.2", @@ -2620,9 +2620,9 @@ } }, "node_modules/@types/woosmap.map": { - "version": "1.4.23", - "resolved": "https://registry.npmjs.org/@types/woosmap.map/-/woosmap.map-1.4.23.tgz", - "integrity": "sha512-/gNmRBiZlBakvKua8q60DmR/h3y7phN6CZrsJEAVY/8cJQy2Rtb9LH2ye/WLJwp1oFRwDMAltqI85VDjVWNq7g==", + "version": "1.4.24", + "resolved": "https://registry.npmjs.org/@types/woosmap.map/-/woosmap.map-1.4.24.tgz", + "integrity": "sha512-l8Lzza5E7rFsmwijzwOKr/Gko8QlAq6jnJjW+4/3mIjzUZgBxyLYfNMLjPJRwoWQF7Ix71+8fyQUbxlxKl4FpQ==", "dev": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 07a16a83..e345eb16 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "@playwright/test": "^1.57.0", "@types/geojson": "^7946.0.16", "@types/supercluster": "^7.1.3", - "@types/woosmap.map": "^1.4.23", + "@types/woosmap.map": "^1.4.24", "@typescript-eslint/eslint-plugin": "^8.52.0", "@typescript-eslint/parser": "^8.15.0", "chalk": "^5.6.2", diff --git a/samples/map-type-hybrid/index.njk b/samples/map-type-hybrid/index.njk new file mode 100644 index 00000000..f2ff4535 --- /dev/null +++ b/samples/map-type-hybrid/index.njk @@ -0,0 +1,5 @@ +{% extends '../../src/_includes/layout.njk' %} +{% block html %} + +
+{% endblock %} diff --git a/samples/map-type-hybrid/index.ts b/samples/map-type-hybrid/index.ts new file mode 100644 index 00000000..24715217 --- /dev/null +++ b/samples/map-type-hybrid/index.ts @@ -0,0 +1,33 @@ +// [START woosmap_map_type_hybrid] +// Initialize and add the map with hybrid (satellite) map type +let map: woosmap.map.Map; + +function initMap(): void { + const position: woosmap.map.LatLngLiteral = { + lat: 48.8584, + lng: 2.2945, + }; + + // The map, initialized with hybrid satellite view + map = new woosmap.map.Map(document.getElementById("map") as HTMLElement, { + zoom: 16, + center: position, + mapTypeId: woosmap.map.MapTypeId.HYBRID, + mapTypeControl: true, + }); + + // Listen for map type changes via the built-in control + map.addListener("mapTypeId_changed", () => { + console.log("Map type switched to:", map.getMapTypeId()); + }); +} + +declare global { + interface Window { + initMap: () => void; + } +} +window.initMap = initMap; +// [END woosmap_map_type_hybrid] + +export {}; diff --git a/samples/map-type-hybrid/map-type-hybrid.json b/samples/map-type-hybrid/map-type-hybrid.json new file mode 100644 index 00000000..8e18c873 --- /dev/null +++ b/samples/map-type-hybrid/map-type-hybrid.json @@ -0,0 +1,14 @@ +{ + "title": "Map Type Hybrid", + "description": "Initialize a map with the hybrid satellite view and use the built-in map type control to switch between roadmap and satellite.", + "category": "Map Basics", + "callback": "initMap", + "tag": "map_type_hybrid", + "name": "map-type-hybrid", + "pagination": { + "data": "mode", + "size": 1, + "alias": "mode" + }, + "permalink": "samples/{{ page.fileSlug }}/{{mode}}/{% if mode == 'jsfiddle' %}demo{% else %}index{% endif %}.{{ page.outputFileExtension }}" +} diff --git a/samples/map-type-hybrid/style.scss b/samples/map-type-hybrid/style.scss new file mode 100644 index 00000000..d96fcb03 --- /dev/null +++ b/samples/map-type-hybrid/style.scss @@ -0,0 +1,6 @@ +@use 'sass:meta'; // To enable @use via meta.load-css and keep comments in order + +/* [START woosmap_map_type_hybrid] */ +@include meta.load-css("../../shared/scss/_default.scss"); + +/* [END woosmap_map_type_hybrid] */