You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: javascript/isolines-leaflet/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ This code sample demonstrates how to calculate and display **isochrones** (time-
4
4
5
5
The application allows users to click on the map, configure travel mode and isoline parameters, and visualize the reachable area as a polygon layer. Each isoline is styled with a distinct color and includes a custom marker to indicate its origin.

8
8
9
9
The code calculates isolines with the [Geoapify Isoline API](https://www.geoapify.com/isoline-api/) and renders it dynamically using Leaflet:
Copy file name to clipboardExpand all lines: javascript/isolines-maplibre/README.md
+1-4Lines changed: 1 addition & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ This code sample demonstrates how to calculate and visualize **isochrones** (tim
4
4
5
5
The application lets users click on the map, select travel mode and isoline type, and view the resulting polygon directly on a dynamic vector map. Each isoline is styled with a distinct color and features a custom marker that reflects the travel mode and value.

8
8
9
9
The application combines Geoapify APIs with MapLibre’s vector rendering engine:
10
10
@@ -132,9 +132,6 @@ This will create a `demo_combined.html` file in the `isolines-maplibre/` folder,
132
132
133
133
> The script uses `src/demo.html` as input and outputs a self-contained file with embedded JavaScript and CSS.
134
134
135
-
136
-
Вот следующий раздел — **Code Examples** — с ключевыми фрагментами из `isolines-maplibre`:
137
-
138
135
## Code Examples
139
136
140
137
Here are the key code snippets that power the application:
Copy file name to clipboardExpand all lines: javascript/printable-route-directions/README.md
+73-2Lines changed: 73 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ This combination of dynamic and static content allows users to interact with the
13
13
14
14
## Demo
15
15
16
-
You can see the code sample in action here: [Demo Link](https://geoapify.github.io/maps-api-code-samples/javascript/printable-route-directions/demo.html)
16
+
You can see the code sample in action here: [Demo Link](https://geoapify.github.io/maps-api-code-samples/javascript/printable-route-directions/demo_combined.html)
17
17
18
18
## About the Code Sample
19
19
@@ -312,7 +312,78 @@ The **`generateImageURL()`** function dynamically generates static map previews
You can run the Route + Elevation demo locally using a static server or directly in your IDEwith live preview.
318
+
319
+
### Option 1: Run with a Local HTTP Server
320
+
321
+
Serve the contents of the folder using a static server:
322
+
323
+
1.**Install `http-server`** (if not already installed):
324
+
325
+
```bash
326
+
npm install -g http-server
327
+
```
328
+
329
+
2.**Start the server** from the folder containing your HTML and JS files:
330
+
331
+
```bash
332
+
http-server .
333
+
```
334
+
335
+
3.**Open the demo**in your browser:
336
+
337
+
```
338
+
http://localhost:8080/demo.html
339
+
```
340
+
341
+
Or use `npx` for a one-time server:
342
+
343
+
```bash
344
+
npx http-server .
345
+
```
346
+
347
+
### Option 2: Use IDE Live Preview
348
+
349
+
Many modern IDEs provide live preview for HTML files:
350
+
351
+
***Visual Studio Code** — Install the “Live Server” extension, then right-click `src/demo.html` and choose **“Open with Live Server”**.
352
+
***WebStorm / IntelliJ / PhpStorm** — Right-click `src/demo.html` and choose **“Open in Browser”**.
353
+
***Brackets** — Click the **lightning bolt icon** or use **File → Live Preview**.
354
+
355
+
> Opening the file directly via `file://` protocol is not recommended, as some browsers block dynamic requests in local mode.
356
+
357
+
## How to Build `demo_combined.html`
358
+
359
+
As an alternative to running the project from multiple files, you can generate a standalone HTML file with all scripts and styles inlined. This is useful for GitHub Pages or distributing the demo as a single file.
360
+
361
+
### Steps
362
+
363
+
1.**Navigate to the parent folder**, e.g. `javascript/route-elevation-chart`:
364
+
365
+
```bash
366
+
cd javascript/route-elevation-chart
367
+
```
368
+
369
+
2.**Install the required build dependency**:
370
+
371
+
```bash
372
+
npm install inline-source
373
+
```
374
+
375
+
3.**Run the build script** (make sure `combine.js` exists in the folder):
376
+
377
+
```bash
378
+
node combine.js
379
+
```
380
+
381
+
This will generate a `demo_combined.html` file with all JavaScript and CSS embedded inline.
382
+
383
+
> The `combine.js` script should take `src/` as input and produce a portable version suitable for publishing or offline usage.
384
+
385
+
386
+
## Summary
316
387
317
388
This code sample showcases how to use the **Geoapify Routing API** and **Geoapify Static Maps API** to generate rich, interactive route instructions and static map visuals. It includes key functionalities like:
0 commit comments