Use fetch instead of $.ajax in JSTS example

This commit is contained in:
Tim Schaub
2015-11-15 15:05:28 -07:00
parent 2fff18fd0c
commit 6fd6b794ef
2 changed files with 7 additions and 12 deletions

View File

@@ -1,6 +1,6 @@
---
layout: example.html
title: JSTS Example
layout: strapless.html
title: JSTS Integration
shortdesc: Example on how to use JSTS with OpenLayers 3.
docs: >
Example showing the integration of <a href="https://github.com/bjornharrtell/jsts">JSTS</a>
@@ -9,11 +9,5 @@ tags: "vector, jsts, buffer"
resources:
- https://cdn.rawgit.com/bjornharrtell/jsts/gh-pages/lib/0.16.0/javascript.util.min.js
- https://cdn.rawgit.com/bjornharrtell/jsts/gh-pages/lib/0.16.0/jsts.min.js
---
<div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
</div>
</div>
<div id="map" class="map"></div>

View File

@@ -12,10 +12,11 @@ goog.require('ol.source.Vector');
var source = new ol.source.Vector();
$.ajax('data/geojson/roads-seoul.geojson').then(function(response) {
fetch('data/geojson/roads-seoul.geojson').then(function(response) {
return response.json();
}).then(function(json) {
var format = new ol.format.GeoJSON();
var features = format.readFeatures(response,
{featureProjection: 'EPSG:3857'});
var features = format.readFeatures(json, {featureProjection: 'EPSG:3857'});
var parser = new jsts.io.olParser();