-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WIP basic geo math * WIP more geo math * ADD some more basic geo math * ADD elevation with tile caching for a single point * ADD exposing the tile parsing function to config * ENH simplified the index.ts * ADD batch elevation * ADD elevation for GeoJSON LineString and MultiLineString * ADD more math functions * ENH rounding pixel coord rather than truncate them * changelog * FIX typo * FIX from code review * FIX better naming for tile cache
- Loading branch information
1 parent
87cdf0c
commit cead13a
Showing
23 changed files
with
43,819 additions
and
690 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,6 @@ docs | |
docsmd | ||
images | ||
test | ||
src | ||
examples | ||
dist/*.umd.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
<html> | ||
<head> | ||
<title>tslib</title> | ||
</head> | ||
|
||
<body> | ||
<p> | ||
This demo is using the UMD bundle. Add <code>?key=YOUR_API_KEY</code> to the URL. | ||
</p> | ||
<p> | ||
Open JS console. | ||
</p> | ||
<div id="images"></div> | ||
|
||
<script src ="../dist/maptiler-client.umd.js"></script> | ||
|
||
<script> | ||
// The API key must be in the URL param as `?key=ABCD1234` | ||
maptilerClient.config.apiKey = (new URLSearchParams(location.search)).get("key"); | ||
|
||
(async () => { | ||
|
||
|
||
// A basic example with only a line string | ||
// const resGeojson = await fetch("linestring.geojson"); | ||
// const geojson = await resGeojson.json(); | ||
// console.log(geojson); | ||
|
||
// const allLines = maptilerClient.extractLineStrings(geojson); | ||
|
||
// const ls = allLines[0] | ||
// console.log(ls) | ||
|
||
// const elevatedLs = await maptilerClient.elevation.fromLineString(ls); | ||
// console.log(elevatedLs) | ||
|
||
|
||
|
||
// an example with a single multilinestring | ||
// const resGeojson = await fetch("multilinestring.geojson"); | ||
// const geojson = await resGeojson.json(); | ||
// console.log(geojson); | ||
|
||
// const allMLS = maptilerClient.extractLineStrings(geojson); | ||
|
||
// const mls = allMLS[0] | ||
// console.log(mls) | ||
|
||
// console.time("1") | ||
// const elevatedMls = await maptilerClient.elevation.fromMultiLineString(mls); | ||
// console.timeEnd("1") | ||
// console.log(elevatedMls) | ||
|
||
|
||
|
||
// a long multilinestrin | ||
// const resGeojson = await fetch("long.geojson"); | ||
// const geojson = await resGeojson.json(); | ||
// console.log(geojson); | ||
|
||
// const allMLS = maptilerClient.extractLineStrings(geojson); | ||
|
||
// const mls = allMLS[0] | ||
// console.log(mls) | ||
|
||
// console.time("1") | ||
// const elevatedMls = await maptilerClient.elevation.fromMultiLineString(mls); | ||
// console.timeEnd("1") | ||
// console.log(elevatedMls) | ||
|
||
|
||
|
||
|
||
// A basic example with only a line string | ||
// a long multilinestrin | ||
// const resGeojson = await fetch("long.geojson"); | ||
// const geojson = await resGeojson.json(); | ||
// console.log(geojson); | ||
|
||
// const allMLS = maptilerClient.extractLineStrings(geojson); | ||
|
||
// const mls = allMLS[0] | ||
// console.log(mls.coordinates[0]) | ||
|
||
// console.time("1") | ||
// const ds = maptilerClient.math.haversineCumulatedDistanceWgs84(mls.coordinates[0]); | ||
// console.timeEnd("1") | ||
// console.log(ds); | ||
|
||
// Batch elevation | ||
// const all = await maptilerClient.elevation.batch( | ||
// [ | ||
// [6.864884, 45.832743], // Mont Blanc, Alps, 4808m | ||
// [6.864884, 45.832743], // Mont Blanc, Alps, 4808m | ||
// [6.864884, 45.832743], // Mont Blanc, Alps, 4808m | ||
// [6.864884, 45.832743], // Mont Blanc, Alps, 4808m | ||
// [6.864884, 45.832743], // Mont Blanc, Alps, 4808m | ||
// [6.864884, 45.832743], // Mont Blanc, Alps, 4808m | ||
// // [86.9250, 27.9881], // Mount Everest, Himalayas, 8848m | ||
// // [-70.0109, -32.6532], // Aconcagua, Andes, 6960m | ||
// // [-151.0064, 63.0695], // Denali, Alaska, 6190m | ||
// // [37.3556, -3.0674], // Mount Kilimanjaro, 5895m | ||
// // [42.4453, 43.3499], // Mount Elbrus, Caucasus, 5642m | ||
// // [137.1595, -4.0784], // Puncak Jaya, Sudirman Range, 4884m | ||
// // [-140.4055, 60.5672], // Mount Logan, Saint Elias Mountains, 5956m | ||
// // [138.73111, 35.358055], // Mount Fuji, 3776m | ||
// ] | ||
// ); | ||
// console.log(all); | ||
|
||
})() | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
|
||
{ | ||
"type": "FeatureCollection", | ||
"features": [ | ||
{ | ||
"type": "Feature", | ||
"geometry": { | ||
"type": "LineString", | ||
"coordinates": [ | ||
[ | ||
6.249869, | ||
46.402238, | ||
424.3 | ||
], | ||
[ | ||
6.249877, | ||
46.40224, | ||
424.4 | ||
], | ||
[ | ||
6.249877, | ||
46.402237, | ||
424.4 | ||
], | ||
[ | ||
6.249871, | ||
46.402232, | ||
424.5 | ||
], | ||
[ | ||
6.249863, | ||
46.402227, | ||
424.6 | ||
], | ||
[ | ||
6.249856, | ||
46.402223, | ||
424.7 | ||
], | ||
[ | ||
6.249849, | ||
46.402224, | ||
424.8 | ||
], | ||
[ | ||
6.249846, | ||
46.402226, | ||
424.8 | ||
], | ||
[ | ||
6.249844, | ||
46.402228, | ||
424.8 | ||
], | ||
[ | ||
6.249843, | ||
46.402228, | ||
424.8 | ||
], | ||
[ | ||
6.249834, | ||
46.402226, | ||
424.9 | ||
], | ||
[ | ||
6.249828, | ||
46.402225, | ||
425 | ||
], | ||
[ | ||
6.249812, | ||
46.402222, | ||
425.2 | ||
], | ||
[ | ||
6.249803, | ||
46.402219, | ||
425.3 | ||
], | ||
[ | ||
6.249793, | ||
46.402217, | ||
425.4 | ||
], | ||
[ | ||
6.249783, | ||
46.402214, | ||
425.5 | ||
], | ||
[ | ||
6.249773, | ||
46.402211, | ||
425.6 | ||
], | ||
[ | ||
6.249743, | ||
46.402183, | ||
426.1 | ||
], | ||
[ | ||
6.249713, | ||
46.402158, | ||
426.5 | ||
], | ||
[ | ||
6.24968, | ||
46.402124, | ||
427.1 | ||
], | ||
[ | ||
6.249654, | ||
46.40209, | ||
427.6 | ||
], | ||
[ | ||
6.249629, | ||
46.402061, | ||
428 | ||
], | ||
[ | ||
6.249609, | ||
46.402035, | ||
428.4 | ||
], | ||
[ | ||
6.249576, | ||
46.402004, | ||
428.8 | ||
], | ||
[ | ||
6.249564, | ||
46.401996, | ||
428.9 | ||
], | ||
[ | ||
6.249515, | ||
46.401992, | ||
429.5 | ||
], | ||
[ | ||
6.249496, | ||
46.401995, | ||
429.5 | ||
], | ||
[ | ||
6.249457, | ||
46.402003, | ||
429.6 | ||
], | ||
[ | ||
6.249411, | ||
46.402019, | ||
429.6 | ||
] | ||
] | ||
}, | ||
"id": "d22fc9f8-ba40-4f46-b46d-939564068e0a", | ||
"properties": { | ||
"name": "It's been a while", | ||
"type": "1" | ||
} | ||
} | ||
] | ||
} |
Oops, something went wrong.