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 1 commit
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
9 changes: 9 additions & 0 deletions src/Layers/DynamicMapLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ 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 total = this._map.getSize();
Copy link
Member

Choose a reason for hiding this comment

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

This is a duplicate of size declared earlier.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i did that on purpose thinking it made the comparison easier to read, but i'm fine with it the other way too.

Copy link
Member

Choose a reason for hiding this comment

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

As it is I think it reads better without total, but I'm no Leaflet developer.

var top = this._map.latLngToLayerPoint(bounds._northEast);
var bottom = this._map.latLngToLayerPoint(bounds._southWest);

if (top.y > 0 || bottom.y < total.y){
size.y = total.y - top.y - (total.y - bottom.y);
Copy link
Member

Choose a reason for hiding this comment

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

Maybe reduce this to size.y = bottom.y - top.y? By using size instead of total in the if condition, you can get rid of total completely.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i'm still using total in the check above, but 👍 for simpler maths!

}

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