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

  • 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). – PolyGeo Jul 29 '15 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. – ianbroad Jul 29 '15 at 5:04
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.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.