Skip to content

Commit

Permalink
Website updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ahocevar committed Sep 29, 2024
1 parent 11dacd1 commit 28a287d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
14 changes: 8 additions & 6 deletions dist/en/main/examples/turf.html
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,9 @@ <h5 class="source-heading">main.js</h5>
import View from &#x27;ol/View.js&#x27;;
import {OSM, Vector as VectorSource} from &#x27;ol/source.js&#x27;;
import {Tile as TileLayer, Vector as VectorLayer} from &#x27;ol/layer.js&#x27;;
import {along} from &#x27;@turf/along&#x27;;
import {fromLonLat} from &#x27;ol/proj.js&#x27;;
import {length} from &#x27;@turf/length&#x27;;

const source &#x3D; new VectorSource();
fetch(&#x27;data/geojson/roads-seoul.geojson&#x27;)
Expand All @@ -254,9 +256,9 @@ <h5 class="source-heading">main.js</h5>
const distance &#x3D; 0.2;

// get the line length in kilometers
const length &#x3D; turf.lineDistance(turfLine, &#x27;kilometers&#x27;);
for (let i &#x3D; 1; i &lt;&#x3D; length / distance; i++) {
const turfPoint &#x3D; turf.along(turfLine, i * distance, &#x27;kilometers&#x27;);
const lineLength &#x3D; length(turfLine, &#x27;kilometers&#x27;);
for (let i &#x3D; 1; i &lt;&#x3D; lineLength / distance; i++) {
const turfPoint &#x3D; along(turfLine, i * distance, &#x27;kilometers&#x27;);

// convert the generated point to a OpenLayers feature
const marker &#x3D; format.readFeature(turfPoint);
Expand Down Expand Up @@ -304,7 +306,6 @@ <h5 class="source-heading">index.html</h5>
&lt;body&gt;
&lt;div id&#x3D;&quot;map&quot; class&#x3D;&quot;map&quot;&gt;&lt;/div&gt;

&lt;script src="https://api.tiles.mapbox.com/mapbox.js/plugins/turf/v2.0.0/turf.min.js"&gt;&lt;/script&gt;
&lt;script type="module" src="main.js"&gt;&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre>
Expand All @@ -315,7 +316,9 @@ <h5 class="source-heading">package.json</h5>
<pre><code id="example-pkg-source" class="language-json">{
&quot;name&quot;: &quot;turf&quot;,
&quot;dependencies&quot;: {
&quot;ol&quot;: &quot;10.2.2-dev&quot;
&quot;ol&quot;: &quot;10.2.2-dev&quot;,
&quot;@turf/along&quot;: &quot;^7.1.0&quot;,
&quot;@turf/length&quot;: &quot;^7.1.0&quot;
},
&quot;devDependencies&quot;: {
&quot;vite&quot;: &quot;^3.2.3&quot;
Expand All @@ -329,7 +332,6 @@ <h5 class="source-heading">package.json</h5>
</div>

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://api.tiles.mapbox.com/mapbox.js/plugins/turf/v2.0.0/turf.min.js"></script>
<script src="common.js"></script>
<script src="turf.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.28.0/components/prism-core.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion dist/en/main/examples/turf.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/en/main/examples/turf.js.map

Large diffs are not rendered by default.

0 comments on commit 28a287d

Please sign in to comment.