2

I have a Python based geoprocessing service that gets called in my web app. The web app takes a few input parameters, and zooms to a returned buffered section of cable that meets the criteria. This all works really great.

I'm using the following code to zoom to the returned graphic feature:

map.setExtent(graphicsUtils.graphicsExtent(map.graphics.graphics));

But, I really don't want the map to zoom this close to the graphic:

No

I'd prefer something like this:

Yes

asked Jul 29, 2015 at 3:23
2
  • In Python I would do something like df.extent = df.extent * 2.5 so I'm guessing map.setExtent = map.getExtent * 2.5 (with no JavaScript knowledge claimed). Commented Jul 29, 2015 at 4:44
  • Thanks for the suggestion. I just tried map.setExtent(graphicsUtils.graphicsExtent(map.graphics.graphics) * 2); but it doesn't seem to like it. Commented Jul 29, 2015 at 5:04

1 Answer 1

6

In the Extent class there's an expand(factor) method:

enter image description here

So, I tried:

var extent = graphicsUtils.graphicsExtent(map.graphics.graphics).expand(4)
map.setExtent(extent);

And it's exactly what I wanted.

answered Jul 29, 2015 at 5:09

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.