5

i have shapefile that contains a lot of parcels "parcel has like fields (n° parcelle,proprietaire, cin) see picture :

enter image description here

and i want for all parcels to generate this plan :

take a parcel and generate this. (red text is clarification)

enter image description here

software or language programming not important, i'm open to any idea or answer that can solve this problem(product presentation format for all parcels with the format in picture 2 ).

5
  • Would you be able to edit your Question to explain what programming environment you are trying to do this in, please? You mention AxPageLayoutControl so can we assume that you are after an ArcObjects only solution? At the moment I think your Question may be too broad, and in need of focus by letting us know which aspects you already know how to do, and the most important one that is blocking you so that you can seek an Answer to that specific question. I would do this using Python/ArcPy.
    – PolyGeo
    Commented Jan 5, 2014 at 21:31
  • @PolyGeo , i'm working with AxPageLayoutcontrol (ArcObject .net) but if there is an other way to do what i'm looking for, i will happy to work with it !
    – Mounaim
    Commented Jan 5, 2014 at 21:37
  • 2
    It sounds like two new Questions need to be spawned from this very broad one: 1) "how to add the geometry + points to mapframe"; and 2) "how to add the table of coordinates" to mapframe. If these were looking for a Python/ArcPy solution and included some "code so far" then they are something that I would be able to try and answer. I would use "pseudo DDP" rather than Data Driven Pages.
    – PolyGeo
    Commented Jan 5, 2014 at 22:43
  • @PolyGeo any ideas !
    – Mounaim
    Commented Jan 6, 2014 at 15:14
  • I'm sorry to have to close this question but it is simply too broad for our focussed Q&A format because it effectively lists multiple requirements and then seeks a solution to all of them. I recommend that it be broken into a series of Q&As with each seeking to address a single requirement.
    – PolyGeo
    Commented Oct 23, 2014 at 7:19

1 Answer 1

12
+50

This is typically something you can do with Data Driven Pages.

The static text and images is not a problem, you can modify one lay out and this will be transmitted to all other layouts.

For the dynamic text, it can be driven based on one of the attribute fields using this syntax " domainlookup="true"/>

The most complicated part is what you show on the map. The data driven pages will zoom on each parcel (you can either set a fixed scale or an extend related to the parcel bounding box). You will need a script for showing only one parcel and the line around.

import arcpy
import arcpy.mapping as mmap

mxd = mmap.MapDocument("your.mxd")
DF = mmap.ListDataFrames(mxd)[0]
sourcely = mmap.Layer(the_source_of_your_lyr_file_on_disk) #lyr file create from your parcels feature class (with al the parcels)
i = 0
fc = yourparcels.shp
rows = arcpy.SearchCursor(fc)
for row in rows:
    sourcely.definitionQuery = '("FID" = ' + str(i) + ')' #select only one parcel
    sourcely.save()
    sourcely = mmap.Layer("mylayer.lyr")
    ly = mmap.ListLayers(mxd)[1]
    mmap.UpdateLayer(DF, ly, sourcely, False)
    i = i + 1
    mxd.dataDrivenPages.exportToPDF(path + row.getValue("name") + ".pdf", 'RANGE' , str(i), '400')

for the lines around the parcels, this gets even more complicated: you should prepare a set of lines for all your parcels (loop to create a buffer around each parcel then clip those), then create a layer that points on the appropriate lines in the above script example.

for the table, you could also build it with arcpy, like in the example below from ArcGIS help.

import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")

#Reference items in the map document
lyr = arcpy.mapping.ListLayers(mxd, "Accidents")[0]
horzLine = arcpy.mapping.ListLayoutElements(mxd, "GRAPHIC_ELEMENT", "horzLine")[0]
vertLine = arcpy.mapping.ListLayoutElements(mxd, "GRAPHIC_ELEMENT", "vertLine")[0]
tableText = arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT", "TableText")[0]

#Get/set information about the table
numRows = int(arcpy.GetCount_management(lyr).getOutput(0))
rowHeight = 0.2
fieldNames = ["X", "Y", "Accidents"]
numColumns = len(fieldNames)
colWidth = 1.5

#Build graphic table lines based on upper left coordinate
#  set the proper size of the original, parent line, then clone it and position appropriately
upperX = 1.0
upperY = 5.0

#Vertical lines
vertLine.elementPositionX = upperX
vertLine.elementPositionY = upperY
vertLine.elementHeight =  (rowHeight * numRows) + rowHeight #extra line for column names

x = upperX
for vert in range(1, numColumns+1):
  x = x + colWidth
  vert_clone = vertLine.clone("_clone")
  vert_clone.elementPositionX = x

#Horizontal lines
horzLine.elementPositionX = upperX
horzLine.elementPositionY = upperY
horzLine.elementWidth = numColumns * colWidth

y = upperY - rowHeight
for horz in range(1, numRows +2 ):  #need to accommodate the extra line for field names
  temp_horz = horzLine.clone("_clone")
  temp_horz.elementPositionY = y
  y = y - rowHeight

#Place text column names
tableText.elementPositionX = upperX + 0.05 #slight offset
tableText.elementPositionY = upperY
tableText.text = fieldNames[0]
accumWidth = colWidth
for field in range(1, numColumns):
  newFieldTxt = tableText.clone("_clone")
  newFieldTxt.text = fieldNames[field]
  newFieldTxt.elementPositionX = newFieldTxt.elementPositionX + accumWidth
  accumWidth = accumWidth + colWidth

#Create text elements based on values from the table
table = arcpy.SearchCursor(lyr.dataSource)
y = upperY - rowHeight
for row in table:
  x = upperX + 0.05 #slight offset
  try:   
    for field in fieldNames:
      newCellTxt = tableText.clone("_clone")
      newCellTxt.text = row.getValue(field)
      newCellTxt.elementPositionX = x
      newCellTxt.elementPositionY = y
      accumWidth = accumWidth + colWidth
      x = x + colWidth
    y = y - rowHeight
  except:
    print"Invalid value assignment"

#Export to PDF and delete cloned elements
arcpy.mapping.ExportToPDF(mxd, r"C:\Temp\test.pdf")

for elm in arcpy.mapping.ListLayoutElements(mxd, wildcard="_clone"):
  elm.delete()
del mxd

this table is populated using a table view, which can be created by selecting the vertices of your polygon by location for each polygon (see "make feature layer" and "select layer by location" tools)

9
  • thank you Radouxju and for the table data in the right please ?
    – Mounaim
    Commented Jan 5, 2014 at 21:12
  • 1
    that's another question. You can have a look at gis.stackexchange.com/questions/81828/…
    – radouxju
    Commented Jan 5, 2014 at 21:17
  • 3
    Using the same idea as data driven pages - you can use python/arcpy and open the MXD using a python script - select each polygon, zoom to it, change text on layout, export to PDF, then move on to next row in table. This is fairly easy if you are familiar with python and the arcpy mapping module.
    – dklassen
    Commented Jan 8, 2014 at 18:53
  • 2
    I believe for your table you will have to use the dynamic text method suggested above and simply layout the fields on the template to closely match the table and perhaps put a series of neatlines around the results to look like a table then group everything. From what I have read ESRI has not included the functionality to add a new layout object with arcpy. I have included summary statistics on my layout via arcpy to look like a table without neatlines/gridlines.
    – danagerous
    Commented Jan 10, 2014 at 23:25
  • 1
    Good question. Assuming you're using python, MMAP (Memory-mapped file support) is used to map python file objects. I've never used it myself. It seems to have something to do with updating the layer file. See this thread [gis.stackexchange.com/questions/80978/… to help answer your questions further. Good luck.
    – danagerous
    Commented Jan 15, 2014 at 18:50

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