Can you specify a map extent for use with PrintTask?

950
1
01-28-2014 07:09 AM
SteveCole
Frequent Contributor
I think the answer to this is "no" but I wanted to check before submitting it to the Ideas page.

I'm using PrintTask to generate a vicinity map for a report that's generated on the fly when a user clicks a button. The report taks a feature, applies a buffer, and then peforms a deferredList of queries against several other feature layers. Anyways, I want the map that I generate to include the project but also the buffered extent as well (I also add it to the map as a graphic). It looks like my only recourse at the moment is to change the map extent with my code just before the printTask executes but that would freak out the user's screen and I would have to keep track of the map extent prior to the running of the report so that I could reset it once the printTask is completed.

So- as the API stands right now, can I just pass an extent as a parameter for the map's area?

Thanks!
Steve
0 Kudos
1 Reply
RobertoPepato
Occasional Contributor II
I think the answer to this is "no" but I wanted to check before submitting it to the Ideas page.

I'm using PrintTask to generate a vicinity map for a report that's generated on the fly when a user clicks a button. The report taks a feature, applies a buffer, and then peforms a deferredList of queries against several other feature layers. Anyways, I want the map that I generate to include the project but also the buffered extent as well (I also add it to the map as a graphic). It looks like my only recourse at the moment is to change the map extent with my code just before the printTask executes but that would freak out the user's screen and I would have to keep track of the map extent prior to the running of the report so that I could reset it once the printTask is completed.

So- as the API stands right now, can I just pass an extent as a parameter for the map's area?

Thanks!
Steve



Hi Steve,

I think that this is not possible to do with de default print service. However, you can use arcpy to publish and orchestrate a custom printing service and specify how many parameters you want.

Another option is: If you can skip the JS API for this task and call the REST API directly, it looks like you can specify the printing extent through the mapOptions parameters. For more info regarding this, see this link.

Let me know if that helps.
0 Kudos