gp ExportToPNG can't set the right extent

795
3
06-19-2013 03:43 PM
kentu
by
New Contributor
hello,i use arcpy.mapping to export e map,code like this:


mxdPath = "C:/dev/temp/base.mxd"
mxd = arcpy.mapping.MapDocument(mxdPath)

...load fc from shapefile...

arcpy.MakeFeatureLayer_management(fc,fname)
addLayer = arcpy.mapping.Layer(fname)
arcpy.mapping.AddLayer(df, addLayer)

arcpy.env.extent = arcpy.Extent(XMin=minX,YMin=minY,XMax=maxX,YMax=maxY)
    newExtent = df.extent
    newExtent.XMin, newExtent.YMin = minX, minY
    newExtent.XMax, newExtent.YMax = maxX, maxY
    df.extent = newExtent
ExportToPNG(mxd, outputPath,df,
                                   df_export_width=width,
                                   df_export_height=height,
                                   world_file=None,
                                   resolution=dpi)
i publish it as a gpsrvice,to export png


and then i publish another mapservice with the same shape file

when i add both service on the flex,
the basemap use the service publish by mapservice.
the second layer use the gpservice result.
request with same extent,same size,
but the export image is not the same,i can't find the reason,can you help me?
Tags (2)
0 Kudos
3 Replies
JeffMoulds
Esri Contributor
Some questions:

What version of ArcGIS are you using?

In regards to:
i publish it as a gpsrvice,to export png

Are you creating a map service from within the gp service? That is, are you calling arcpy.mapping.CreateMapSDDraft() in your Python script?

In regards to:
the second layer use the gpservice result

How are you using the PNG in your web app? As a service, or using it directly as a PNG?

If you add the shp file and the output PNG to ArcMap do they line up? My guess is that they wouldnt unless you add world_file=True.

Can you describe what you are trying to accomplsih with this web app?
0 Kudos
kentu
by
New Contributor
Some questions:

What version of ArcGIS are you using?

In regards to:

Are you creating a map service from within the gp service? That is, are you calling arcpy.mapping.CreateMapSDDraft() in your Python script?

In regards to:

How are you using the PNG in your web app? As a service, or using it directly as a PNG?

If you add the shp file and the output PNG to ArcMap do they line up? My guess is that they wouldnt unless you add world_file=True.

Can you describe what you are trying to accomplsih with this web app?


Hi Jeff�?thanks for your reply�??
I am using arcgisserver10.1
I didn't creating a map service from within the gp service
I use png in the web app,the png is export from gpservice which is published by the gisserver

My web app need to load local cad and shapefile on the user client.
The upload file is always Temporary,so i can't publish it as a service at the begining.
I found a way to solve it.
First upload the cad(or shapefile) file to the server,and put it in a directory.
When user request it,then use gp service to open
the workspace(file in the directory) to export the image,return the image url,then the flex client can load it.

I want to use soe to finish it at the beginning.but arcgisserver10.1 don't support IMap interface any more,so i
can't open workspace and add layer to export image,so i use gp to do it.
0 Kudos
kentu
by
New Contributor
I take a simple test,use the same mxd,data,extent and size to export image by gp and mapservice ,but the result
is not the same. I put the result in the Attachment�??
0 Kudos