I am producing some maps of a point layer using arcpy.mapping.ExportToPDF. Is there a possibility of creating HTML popup for the final PDF based on this link?
123054
I am using ArcGIS to add geotagged images as points to a map which allows me to click on the point and an HTML popup comes up with the photo.     This works fine. What I would like to do, is export/print the map to a PDF and within the resulting PDF, I would like to be able to click on the points and get the same HTML popup. Does anyone know if this is possible?
13006
I am using ArcPy to export PDFs from my ArcGIS Server application. I want to move a TextElement in my layout view to the centroid of a selected feature. I can get the centroid of the feature, but that's in my projected coordinate system (PCS). I need to convert that point into inches in my layout view. elements = arcpy.mapping.ListLayoutElements(mapDoc, &quot;TEXT_ELEMENT&quot;)     for elem in elements:         if elem.name == &quot;SiteText&quot;:             elem.elementPositionX = center.X             elem.elementPositionY = center.Y  center.X and center.Y are in a projected coordinate system (PCS), not inches. I know it can be done with ArcObjects, as I've done it in desktop addins using C#. I need to do it from ArcPy and I don't see how. Any ideas?
77928
I want to use arcpy.mapping to make some changes to a mxd.  I am using the Spyder environment for python.  To change the title I can use the following code:  import arcpy  myMap = r'C:\path_to_mxd\myfile.mxd' mxd = arcpy.mapping.MapDocument(myMap) mxd.relativePaths = True mxd.title = 'Title' arcpy.RefreshActiveView() mxd.save()   I can't execute mxd.save() on an open mxd file though.  Is there a way to make changes to an open file and view any code I execute on the fly?
49695
I remember long time ago, seeing PDF documents (such as online PDF versions of newspapers) that had hypertext boxes around paragraphs, such that when you clicked inside those boxes the surrounded paragraph will be zoomed in to exactly that paragraph in the Acrobat Reader window. I am not sure what tool was used to create those PDFs, and unfortunately I can't find one example at the moment.   Is it possible to reproduce such zoom-on-click feature with some pdflatex code? To repeat: the requested feature is to create hypertext boxes around paragraphs or figures that when clicked the PDF viewer would zoom in into that region.  This feature can be useful in PDFs with lots of structure in a given page, such as small paragraphs or figures or figure captions scattered around the page.  (Beamer has a "zoom in" feature (\framezoom) but it is not the same thing because that creates a new page with the zoomed region, and I just want to force the PDF reader to enclose the area in the same page by only zooming. I am also aware of marquee zoom in Acrobat but it is not what I am looking for because it is not aware of the content.)
96510
I have a python addin, which as part of its function checks to see if a template point feature class exists on the user's machine.  If it doesn't, it creates this file.  This template file is used elsewhere in the addin to create other files.  I do not want this template file to be added to the map document.  When the addin is run, if the template file doesn't exist it gets created and automatically added into the currently active data frame.  Is there something I can add to the scrip to prevent this from happening?  Or is the neatest way to let the feature class be added to the data frame and then add a line to the script to remove it from the map document?  My code is currently as follows:  coordsys = arcpy.SpatialReference(27700)  #Define the schema file for the output schemafile = defgdb + "/Template"  #Check to see if the schema file exists, if it doesn't, create it. if arcpy.Exists(schemafile):     pass else:     arcpy.CreateFeatureclass_management(defgdb, "Template", "POINT", "", "", "", coordsys)   My current method for removing the layer from the map document (rather than preventing the layer from being added) is:  for layer in arcpy.mapping.ListLayers(mxd, "Template"):     arcpy.mapping.RemoveLayer(df,layer)
47286
In WebForms, I would normally have code like this to let the browser present a "Download File" popup with an arbitrary file type, like a PDF, and a filename:  Response.Clear() Response.ClearHeaders() ''# Send the file to the output stream Response.Buffer = True  Response.AddHeader("Content-Length", pdfData.Length.ToString()) Response.AddHeader("Content-Disposition", "attachment; filename= " &amp; Server.HtmlEncode(filename))  ''# Set the output stream to the correct content type (PDF). Response.ContentType = "application/pdf"  ''# Output the file Response.BinaryWrite(pdfData)  ''# Flushing the Response to display the serialized data ''# to the client browser. Response.Flush() Response.End()   How do I accomplish the same task in ASP.NET MVC?
21929
I was wondering if anyone had any experience in working programmatically with .pdf files. I have a .pdf file and I need to crop every page down to a certain size.  After a quick Google search I found the pyPdf library for python but my experiments with it failed. When I changed the cropBox and trimBox attributes on a page object the results were not what I had expected and appeared to be quite random.  Has anyone had any experience with this? Code examples would be well appreciated, preferably in python.
45495
I opened a Popup from an inline VF page in SFDC and then after some action I was able to close the window but needed a refresh of the Top window from inline frame .  My code is as below for opening a pop up.Note this is inline page   &lt;apex:page standardController="Account" extensions="Accountctrl"&gt;  &lt;apex:form &gt;  &lt;script&gt;    function openwindow(){       window.open("/apex/pagereal", "myWindow", "width=200, height=100");    }  &lt;/script&gt;  &lt;apex:pageBlock &gt;  &lt;apex:pageBlockSection columns="1" id="Test" &gt;     &lt;apex:inputcheckbox value="{!test.istest__c}" label="Same as Above"&gt;     &lt;apex:actionSupport event="onchange" rerender="Test" /&gt; &lt;/apex:inputcheckbox&gt;   &lt;apex:outputPanel rendered="{!NOT(test.istest__c)}"&gt;  &lt;apex:inputField value="{!test.Campaign__c}" /&gt; &lt;apex:inputField value="{!test.cust_vendor__c}" /&gt; &lt;/apex:outputPanel&gt; &lt;apex:commandButton value="Tetete" onclick="openwindow();"/&gt;   &lt;/apex:pageBlockSection&gt;  &lt;/apex:form&gt; &lt;/apex:page&gt;   And my popup page code is as below and I want to redirect top frame from inline page  &lt;apex:page &gt;    &lt;script&gt;    function test(){      alert('hello');      window.opener.top.location.href='https://googleflowauth-dev- ed.my.salesforce.com/001900000096agv';   }     &lt;/script&gt;    &lt;apex:form &gt;     &lt;!-- End Default Content REMOVE THIS --&gt;      &lt;apex:commandButton onclick="test()" value="Test"/&gt;     &lt;/apex:form&gt;   The error is pretty much I know that it is for security browsers dont allow        Unsafe JavaScript attempt to initiate navigation for frame with URL '' from frame with URL ''. The frame attempting navigation is neither same-origin with the target, nor is it the target's parent or opener.   I am happy if i get workaround for same
4990
I am looking for a way to access a .mxd file's layer names and data sources.  In ArcGIS Desktop, I could do:  def print_layer_info(mxd_path):     print(mxd_path + ":")     mxd = arcpy.mapping.MapDocument(mxd_path)      for df in arcpy.mapping.ListDataFrames(mxd, "*"):         lyr = arcpy.mapping.ListLayers(mxd, "", df)[0]         if lyr.supports("dataSource"):             print "\t" + lyr.name             print "\t\t" + lyr.dataSource     del mxd   According to , I could do:  p = arcpy.mp.ArcGISProject("file.mxd")   But that doesn't work. When I do that I get a OSError.  Since the arcpy.mapping.MapDocument is gone in ArcPy for ArcGIS Pro, what is the equivalent way of reading layer name and datasource of an .mxd file?
39749
how could I do the following steps with arcpy:   right-click on the layer with the features Label Features Convert Labels to Annotations ...   The annotions should be saved in a new shapefile.  How could I do this in python?
1526
I am attempting to use this code in a tool that I am working on:  mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd)[0] XMIN = df.extent.XMin YMIN = df.extent.YMin XMAX = df.extent.XMax YMAX = df.extent.YMax   I then go on to do other calculations with the extent. The code works perfectly in the Python window, but because Toolbox tools are run in separate processes I am unable to use "CURRENT".  I think I could probably add a derived input variable and pass the coordinates through the validation script, but that doesn't work for what I am doing. I need to be able to do this later on in the script and add an additional temporary feature to the current map:  points = arcpy.CreateFeatureclass_management("in_memory", "NewFeature", "POINT") arcpy.AddField_management(points, "NewField", "TEXT", "", "", 20)   I know all of my code works right, because I can paste the entire .py into the  Python window and then call Main() and run through it, but I need to share it with others in an easier way.   I would prefer the solution be compatible with 10.0 and 10.1 if at all possible, because some of the people I work with do not have 10.1 yet. I will accept a 10.1 only solution if I have to though.  What options do I have to do this?    I still can not get this to work, they have not gotten me Python Add-In Wizard yet so I am unable to test that approach. I have again tried the "Run in process" box checked and unchecked. Neither are working.   Checked gives me this: RuntimeError: CreateObject cannot open map document  Handled that exception: Object: CreateObject cannot open map document  From my testing looks like it is having the same error running in process or not.    I will still be attempting to do this within the Add-In Wizard, when they finally give me it.  The winning answer is I wasn't running it in the foreground.
39855
I'm trying to create a tool in ModelBuilder that will take a new point from a user, create a feature class for this point and display it on a map.  What I've done is:   I've created a feature class for a point-like feature in ArcCatalog. I've prepared a really simple model in ModelBuilder, that starts with a feature set variable (which takes the feature class as a schema and symbology file). The variable is marked as a parameter. Next I'm using the Copy Features tool that takes the variable as input and saves it as a feature class in my scratch workspace. The output feature class is marked as a parameter with the 'add to display' option.   After the module is run I get a shapefile in my scratch workspace. I can add it manually to TOC and it contains the selected point. However no matter what I do, I can't display it in TOC automatically after the model completes.  There is a known issue described in several places that doesn't allow to display newly created layers in TOC when model finishes with the 'add to display' option. However there's a quick workaround, which is to mark the output layer as parameter. In my case it doesn't work.  I'm using ArcGIS for Desktop 10.1 on Windows 7 x86_64.
105912
I've got a simple Leaflet map with a basemap and one map-layer coming from my own hosted GeoServer.  I made the layers show up nicely in a map.  Now I want to add popups on the point layer showing information stored in MapService.  I couldn't find too much information about that topic.   There's one link to a working example but the link seems to be broken. I found another example which I addopted. You can see it on . I'd like to display the content of the name field in the attribute table but nothing happens when the user clicks the map.  Any idea?
123521
I have a VF page with lightningstylesheets = &quot;true&quot;. (This needs to stay this way-- when I take that away the whole page doesn't look right.) I need to save this VF page as a PDF to my Lead record, from an after update trigger. I am seeing that I cannot use renderas=&quot;pdf&quot; together with lightningstylesheets=&quot;true&quot;. I am also seeing that when I try to save the page as is as a pdf, it does not work-- the logs say  Internal Salesforce.com Error.  Does anyone have experience with a similar issue? How can I make this work? Here is the code I'm trying to get the body of the page as pdf:  PageReference pref = Page.SEEK_MVP_PDF_Display;         pref.getParameters().put('id',leadId);         Blob b; if(Test.isRunningTest()) {   b = blob.valueOf('Unit.Test'); } else {    b = pref.getContentaspdf();    system.debug('B: ' + b); } ContentVersion cv = new ContentVersion();         cv.versionData = b;         cv.title = 'SEEK Medicare Eligibility Check';         cv.PathOnClient = 'SEEK_Eligibility_Check.pdf';         insert cv;  ContentVersion Content = [SELECT id, ContentDocumentId FROM ContentVersion where Id = :cv.Id];         ContentDocumentLink contentlink=new ContentDocumentLink();         contentlink.LinkedEntityId= leadId;         contentlink.ShareType= 'V';         contentlink.ContentDocumentId= Content.ContentDocumentId;         insert contentlink;
94213
I currently have a data driven page template set up which I manually cycle through and for each page run a Report Layout File (RLF) report and then add this to the ArcMap layout.  The added element is then positioned on the legend to give additional data to the map user.  The RLF draws it's data from the attribute table of a map layer that is not the DDP index layer.    I now want to automate the production of these maps.  I have no problem with the scripting for the data driven page and exporting side of things, but not sure how to go about adding the report for each page before exporting.    Can anyone suggest if there is a way to do this?   I looked at arcpy.mapping.ExportReport but couldn't see how this works with bringing them back into the mxd and positioning them?  It seems to be more for exporting standalone reports to later add to a book.  Also the outputs were not quite the same as what the run report option within Arcmap produces, which is perfectly aligned to the size I need. They were either the wrong size, layout, or quality.    I also considered adding tables as is described  but don't want the grid lines to show.
106055
I am trying to make a script which selects every .png file in a folder beginning with the letters "LG". I then want the scipt create a shapefile, replacing the "LG" with "SH", and then i want the script to buffer that shapefile and rename the buffer with the first 2 letters being "SB".  I keep getting an error 99999 error message at line 37! ( gp.RasterToPolygon_conversion(INPUT_RASTER, Output_polygon_features, "SIMPLIFY", "VALUE") )  I have posted this on stackoverflow.com but probably here is a better place as scripting for arcmap is probably quite specialised!  Can anyone offer me any advice to why this script doesnt work? I am running ArcMap 9.3.1. and (attempting) to run the script from pyscripter!  # --------------------------------------------------------------------------- # RASTER2POLYGON.py # Created on: Wed Dec 01 2010 12:20:48 PM #   (generated by ArcGIS/ModelBuilder) # Usage: RASTER2POLYGON &lt;INPUT_RASTER&gt; &lt;Output_polygon_features&gt; &lt;Raster_Buffer_shp&gt; # ---------------------------------------------------------------------------  # Import system modules import sys, string, os, arcgisscripting  # Create the Geoprocessor object gp = arcgisscripting.create()  # Load required toolboxes... gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Conversion Tools.tbx") gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Analysis Tools.tbx")  # Script arguments...  folder = "D:\\J04-0083\\IMAGEFILES" for root, dirs, filenames in os.walk(folder): # returms root, dirs, and files     for filename in filenames:         filename_split = os.path.splitext(filename) # filename and extensionname (extension in [1])         filename_zero = filename_split[0]     try:         first_2_letters = filename_zero[0] + filename_zero[1]     except:         first_2_letters = "XX"      if first_2_letters == "LG":         Output_polygon_features = "D:\\J04-0083\\ShapeFiles.gdb\\" + "SH_" + filename + ".shp"          # Process: Raster to Polygon...          INPUT_RASTER = os.path.join(root + "\\" + filename_zero + ".png")         gp.RasterToPolygon_conversion(INPUT_RASTER, Output_polygon_features, "SIMPLIFY", "VALUE")           Distance__value_or_field_ = "5 Meters"         Raster_Buffer_shp = "SB_" + filename + ".shp"          # Process: Buffer...         gp.Buffer_analysis(Output_polygon_features, Raster_Buffer_shp, Distance__value_or_field_, "FULL", "ROUND", "NONE", "")
46571
I have found this in the cover of seminar(one tool to make slide) document.  The final result I have captured below:    The complete document can download .  I wonder how to make this. Is there any easy way?