Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix problem with fetching AGS layers in polar #971

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions src/Layers/DynamicMapLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,22 +106,34 @@ export var DynamicMapLayer = RasterLayer.extend({
},

_buildExportParams: function () {
var bounds = this._map.getBounds();
var bounds = this._map.getPixelBounds();

var sw = this._map.unproject(bounds.getBottomLeft());
var ne = this._map.unproject(bounds.getTopRight());

var size = this._map.getSize();
var ne = this._map.options.crs.project(bounds.getNorthEast());
var sw = this._map.options.crs.project(bounds.getSouthWest());
var sr = parseInt(this._map.options.crs.code.split(':')[1], 10);
var neProj = this._map.options.crs.project(ne);
var swProj = this._map.options.crs.project(sw);

// ensure that we don't ask ArcGIS Server for a taller image than we have actual map displaying
var top = this._map.latLngToLayerPoint(bounds._northEast);
var bottom = this._map.latLngToLayerPoint(bounds._southWest);
// ensure that we don't ask ArcGIS Server for a taller image than we have actual map displaying
var top = this._map.latLngToLayerPoint(ne);
var bottom = this._map.latLngToLayerPoint(sw);

if (top.y > 0 || bottom.y < size.y) {
size.y = bottom.y - top.y;
}

var sr = parseInt(this._map.options.crs.code.split(':')[1], 10);

// switch ne/sw if in part of polar map where north/top bottom/south is inverted
if (swProj.y > neProj.y) {
var temp = neProj;
neProj = swProj;
swProj = temp;
}

var params = {
bbox: [sw.x, sw.y, ne.x, ne.y].join(','),
bbox: [swProj.x, swProj.y, neProj.x, neProj.y].join(','),
size: size.x + ',' + size.y,
dpi: 96,
format: this.options.format,
Expand Down