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

trim height of export requests when necessary #484

Merged
merged 2 commits into from
Mar 18, 2015
Merged
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
8 changes: 8 additions & 0 deletions src/Layers/DynamicMapLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ EsriLeaflet.Layers.DynamicMapLayer = EsriLeaflet.Layers.RasterLayer.extend({
var ne = this._map.options.crs.project(bounds._northEast);
var sw = this._map.options.crs.project(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(bounds._northEast);
var bottom = this._map.latLngToLayerPoint(bounds._southWest);

if (top.y > 0 || bottom.y < size.y){
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking at this again, i guess we could even skip the check entirely.
if the map fills up the whole div, bottom.y - top.y still returns the height we want.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets leave the check in there just for safety.

size.y = bottom.y - top.y;
}

var params = {
bbox: [sw.x, sw.y, ne.x, ne.y].join(','),
size: size.x + ',' + size.y,
Expand Down