Select to view content in your preferred language

Export using Printing tools into another projection?

3211
3
03-11-2013 06:39 PM
BartBajek
Emerging Contributor
I am quite new to the Flex WebApi world. I am using the Flex WebApi and have set up map templates to print maps out to my own template as a PDF. In my template I have the Map grid set. When I eport the WebMap it is displayed in Web Mercator Auxilliary Sphere as it is the set coordinate system in the WebApi (using BingMaps). Does anybody know a way to export this WebMap in a different coordinate system , so that my mapgrid on my map is displayed in the right projection??? Please ask if you have any more questions as I am really struggling with it. People in my company are using GDA94 and when they print a map they also want to have these coordinates displayed on their PDF map and not the Web Mercator coordinates.

Cheers

Bart
Tags (2)
0 Kudos
3 Replies
DasaPaddock
Esri Regular Contributor
0 Kudos
JoeTack
Occasional Contributor
Can the Tiled ESRI Basemaps be used with exportwebmap to generate a print in a  different projection through FLEX (or a different API)? 

I also have custom map templates for printing.  In these templates there is a 1000m grid that should align with the USNG in Ohio as the templates were developed using UTM Zone 17 N.  When printing at a fixed scale the USNG misaligns with the 1000m grid by about a scale of 1.3 for Northern Ohio.  So when I print, the USNG measures at 1300m instead of 1000m at that latitude.  This is a result of the basemap being in Web Mercatur.

My understanding is that since I use the tiled ESRI basemaps that are in Web Mercatur projection, I can't on the fly project the output to UTM Zone 17N.  Furthermore, since the Web Mercatur does not preserve distance, printing a fixed scale map is not possible.  A 1:50000 scale map is closer to a 1:60000 scale map. 

I see the option of setting the outputspatial reference for the export print task (https://developers.arcgis.com/flex/api-reference/com/esri/ags/tasks/supportClasses/PrintParameters.h...), but in my scouring of the forums, it is often mentioned that you can't reproject the tiled services.

I'm not a flex developer, but have enough experience to fumble my way through modifying existing code.  Can the Tiled ESRI Basemaps be used to print in a different projection through FLEX (or a different API)?
0 Kudos
PatrickRhodes1
Occasional Contributor
I am describing a work around without using flashbuilder. Instead use the Advanced High Quality mapping tutorial to setup your *.mxd templates and your datastore. You then expose the layout template name as your spatial reference using python (understandable by Arcmap) and the user can use the standard print widget in Viewer for flex to print in the desired spatial reference.

http://resources.arcgis.com/en/help/main/10.1/index.html#//0057000000mq000000

templatePath = 'C://folder2//'
# Input WebMap json
Web_Map_as_JSON = arcpy.GetParameterAsText(0)
# Format for output
Format = arcpy.GetParameterAsText(1)
if Format == '#' or not Format:
Format = "PDF"
# Input Layout template
Layout_Template = arcpy.GetParameterAsText(2)
if Layout_Template == '#' or not Layout_Template:
Layout_Template = "WGS 1984 UTM ZONE 17N"
# Get the requested map document
templateMxd = os.path.join(templatePath, Layout_Template + '.mxd')
# Convert the WebMap to a map document
result = arcpy.mapping.ConvertWebMapToMapDocument(Web_Map_as_JSON, templateMxd)
mxd = result.mapDocument
sr = arcpy.SpatialReference(Layout_Template) #Set spatial reference based on the name
df = arcpy.mapping.ListDataFrames(mxd)[0] #setting it for the data frame
df.spatialReference = arcpy.SpatialReference(Layout_Template) #finish him

# Use the uuid module to generate a GUID as part of the output name
# This will ensure a unique output name
output = 'WebMap_{}.{}'.format(str(uuid.uuid1()), Format)
Output_File = os.path.join(arcpy.env.scratchFolder, output)
# Export the WebMap
if Format.lower() == 'pdf':
arcpy.mapping.ExportToPDF(mxd, Output_File)
elif Format.lower() == 'png':
arcpy.mapping.ExportToPNG(mxd, Output_File)
# Set the output parameter to be the output file of the server job
arcpy.SetParameterAsText(3, Output_File)
# Clean up - delete the map document reference
filePath = mxd.filePath
del mxd, result
os.remove(filePath)

[ATTACH=CONFIG]33286[/ATTACH]
0 Kudos