I tend to add a jsonp layer to the map and this can be done by the below
code. However, when I replace the view using the code without
transformation. The jsonp layer cannot be displayed.
var vectorSourceJsonp = new ol.source.ServerVector({
format: new ol.format.GeoJSON(),
loader: function(extent, resolution, projection) {
var url = 'http://localhost:8080/geoserver/gullycreek/ows?' +
'service=WFS&request=GetFeature&' +
'version=1.1.0&typename=gullycreek:subbasin&' +
'outputFormat=text/javascript&' +
'format_options=callback:loadFeatures&' +
'srsname=EPSG:3857&' +
'bbox=' + extent.join(',');
$.ajax({
url: url,
dataType: 'jsonp'
});
},
strategy: ol.loadingstrategy.createTile(new ol.tilegrid.XYZ({
maxZoom: 19
})),
projection: 'EPSG:3857'
});
........
var mapJsonp = new ol.Map({
target: 'map',
renderer: 'canvas',
layers: [osmLayer, vectorLayerJsonp],
view: new ol.View({
center: ol.proj.transform([-75.923853, 45.428736], 'EPSG:4326',
'EPSG:3857'),
maxZoom: 19,
zoom: 11
}),
});
var mapJsonp = new ol.Map({
target: 'map',
renderer: 'canvas',
layers: [osmLayer, vectorLayerJsonp],
view: new ol.View({
center: [-49166508.4895, 5406080.9347],
zoom: 13
})
});
--
You received this message because you are subscribed to the Google Groups "OL3
Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/ol3-dev.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ol3-dev/3e269067-8353-4f34-9955-dd0f8e0e0801%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.