|
POST
|
Thanks for your quick reply, @AubriOtis. This looks very promising! I'll give it a shot and report back. It's great that this option would retain my project as a "real" map series that can be seen in Pro. Whereas the Python option (as I'm envisioning it) would mean the resulting map pages only exist as exported PDFs.
... View more
05-14-2021
12:07 PM
|
0
|
0
|
2696
|
|
POST
|
I'm trying to create a map series where the extent of each map is based on features other than the series' index layer. E.g., index feature 1 is within feature A, and I need the map extent to cover the entirety of feature A. Index feature 2 is within feature B, etc. The problem is map series extent isn't designed for such a scenario. I'm trying to brainstorm a workaround. I could use features A, B... as the index layer, but then I'm not sure how I'd create a page query to get the corresponding feature 1, 2... There is not a 1-to-1 ratio of features A, B to 1, 2. Feature A might contain features 1, 2, 3, 4 and I need a map page for each feature 1, 2, 3, 4. Plus, there are dynamic text elements in the layout driven by features 1,2..., so that really wouldn't work. It's probably possible to do this with Python, but I'm not entirely sure how. I'm thinking it would be a For loop, looking for the index features (1, 2, 3) and an attribute of each feature would be used use to select the corresponding feature A, B, C. Could also use a spatial selection. Has anyone else attempted something similar? Would this even be handled like a map series in Python? I'm thinking probably not. Should this be an idea suggestion for a future version of map series in Pro? Thanks for reading my ramble!
... View more
05-14-2021
11:08 AM
|
0
|
5
|
2733
|
|
POST
|
I did not realize until just now that those 2 options existed! I was using the Table Attribute Value, but for my situation the Map Series Attribute is exactly what I need. Learn something new every day! Thanks!
... View more
04-22-2021
01:03 PM
|
0
|
0
|
1769
|
|
POST
|
I'm using dynamic text to put the page name on each layout page of a map series. The page name is a street address and is not necessarily unique from other page names. I'm also using dynamic text to insert a table attribute for the corresponding features. (Even if a street address is repeated, this other attribute is not.) I just discovered that if a page has a non-unique name/street address, the dynamic text will insert every corresponding value found in the table attribute, which is bad. I'm wondering if this is a bug or an expected behavior. Ideally the page names would be unique, but I didn't think it was a requirement until now. Just trying to assess the situation before I figure out a workaround. Thanks! Example: I add a feature with an address 123 Maple St and it has a corresponding table value of "foo". Later, another feature is added at 123 Maple St with table value "bar". Now, if I open the layout for either page, the dynamic text displays "foo bar".
... View more
04-22-2021
12:00 PM
|
0
|
2
|
1783
|
|
POST
|
Ah! MS vs. Layout also explains why the code complete wasn't working. You were of course right about removing the single quotes from the field name. I thought they were required if using a file GDB, but apparently not. A lot of trial and error went into formatting the SQL statement properly for Python, and that was what I finally arrived at that didn't create an error. However, it also didn't create a selection! Thanks again!
... View more
04-22-2021
11:30 AM
|
0
|
1
|
804
|
|
POST
|
I'm trying to actually implement the knowledge this morning I got from this thread yesterday. I'm getting an error when I try to run my script. I can't figure out what I've done wrong. import arcpy, os, sys
aprx = arcpy.mp.ArcGISProject('CURRENT')
HPCcase = aprx.listLayouts('HPC Case Layout')[0]
ms = HPCcase.mapSeries
if ms.enabled:
ms = HPCcase.mapSeries
indexLyr = ms.indexLayer
PDFpath = 'V:\\projects\\DevSvcs\\Planning\\HistoricDistrict\\HPC\\'
HPCdate = '20210513'
arcpy.management.SelectLayerByAttribute(in_layer_or_view=indexLyr,
selection_type="NEW_SELECTION",
where_clause=f"'HPCDate'='2021-05-13'")
pageName = ms.pageRow.ConcatAddr
HPCcase.exportToPDF(out_pdf=os.path.join(PDFpath, HPCdate, f"HPC_{HPCdate}_{pageName}.pdf"),
page_range_type="SELECTED",
multiple_files="PDF_MULTIPLE_FILES_PAGE_NAME",
resolution=300) Traceback (most recent call last):
File "<string>", line 19, in <module>
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\utils.py", line 191, in fn_
return fn(*args, **kw)
TypeError: exportToPDF() got an unexpected keyword argument 'page_range_type' In addition to the export error, I'm pretty sure nothing is getting selected in my index layer. Since a date is the selecting criterion, it's an additional syntax hurdle to make sure I'm doing it exactly right. When I create the features, I only care about the date, not the time. (Time should always be 00:00:00, but I'd rather it not be a factor just in case.) Also, I want to make sure I understand how the selected page range works for exporting in Python. Does it only work by selecting index features also in Python? Is it possible to select one or more pages manually in the Contents pane, then export with Python without further specifying a selection? Thanks!
... View more
04-22-2021
08:10 AM
|
0
|
0
|
4598
|
|
POST
|
Thank you, @JeffBarrette and @DanPatterson. I'm realizing a few good nuggets of information from your responses. What I called a loop in my o.p. is not a loop; it's a conditional. You don't have to specify every single parameter for the method (but you can, as long as you follow the specified order); you just need to specify the name of the parameter(s) you want. Booleans are like integers, no quotes. A few outstanding questions: Why are the page_range parameters not included in the full, non-named parameter array for the method? Are there other (hidden) parameters? Is it common to have additional parameters that can only be called by name? Thanks!
... View more
04-21-2021
03:29 PM
|
0
|
1
|
4632
|
|
POST
|
Unfortunately, the bus routes would need to geometrically match the streets exactly. There may be some ways to get them to align, but in the end it's probably no quicker or easier than doing it manually, sorry! I'm still not entirely sure what you're trying to do. Assign street names to bus routes? So that only those street names are labeled? One last idea. You did mention you envision "clipping" the street data. You might be able to do that. Create as thin of a buffer on your bus routes as you can to get the traversed streets in their entirety. Clip the streets and export them as a new feature class. This will still include very short segments of cross streets, but you can set a minimum feature length for labeling, which hopefully would result in a pretty clean selection of streets that actually have bus routes.
... View more
04-21-2021
10:36 AM
|
1
|
2
|
2349
|
|
POST
|
It's tough to link one layer to another if there's no attribute or geometry match between them. You could create a buffer (width TBD) on your bus routes and do a spatial join with streets to pick up street attributes, but that's going to be tough with cross streets. Presumably your bus routes are on arterial streets; could you filter your streets on some sort of road classification?
... View more
04-21-2021
10:20 AM
|
0
|
5
|
2352
|
|
POST
|
Assuming you have a common field between bus routes and streets (street name?), you could join the streets layer to the bus routes layer and uncheck "keep all target features". That will hide any streets that aren't matched with a bus route.
... View more
04-21-2021
09:26 AM
|
0
|
7
|
2360
|
|
POST
|
If I try to insert the {page_range_type}, {page_range_string}, and {multiple_files} parameters, I get an error that the value for the image_quality parameter — the parameter that should come next if you ignore the page_range parameters — isn't valid: if not HPCcase.mapSeries is None:
ms = HPCcase.mapSeries
if ms.enabled:
ms = HPCcase.mapSeries
indexLyr = ms.indexLayer
arcpy.management.SelectLayerByAttribute(indexLyr, "NEW_SELECTION")
pageName = ms.pageRow.ConcatAddr
HPCcase.exportToPDF(os.path.join(PDFpath, "20210513", f"HPC_20210513_{pageName}.pdf"),'SELECTED','','PDF_MULTIPLE_FILES_PAGE_NAME',300, 'BEST','True', 'ADAPTIVE','True', 'LAYERS_ONLY','True',80,'False','False','False','True')
<Result 'Sites'>
Traceback (most recent call last):
File "<string>", line 8, in <module>
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\utils.py", line 163, in fn_
arg_name].keys())))
ValueError: Invalid value for image_quality: '' (choices are: ['BEST', 'BETTER', 'NORMAL', 'FASTER', 'FASTEST'])
... View more
04-21-2021
09:05 AM
|
0
|
0
|
4656
|
|
POST
|
Since I barely know what I'm doing with Python 😀, I've only tried to write code that is very similar to the examples. I was attempting to write a cross between example 2 (which writes each page to a separate PDF) and example 3 (which exports selected pages): import arcpy, os, sys
PDFpath = 'V:\\projects\\DevSvcs\\Planning\\HistoricDistrict\\HPC\\'
aprx = arcpy.mp.ArcGISProject('CURRENT')
HPCcase = aprx.listLayouts('HPC Case Layout')[0]
relpath = os.path.dirname(sys.argv[0])
if not HPCcase.mapSeries is None:
ms = HPCcase.mapSeries
if ms.enabled:
ms = HPCcase.mapSeries
indexLyr = ms.indexLayer
arcpy.management.SelectLayerByAttribute(indexLyr, "NEW_SELECTION", "'HPCDate'= '2021-05-13'")
pageName = ms.pageRow.ConcatAddr
HPCcase.exportToPDF(os.path.join(PDFpath, "20210513", f"HPC_20210513_{pageName}.pdf")) I have run this in the interactive Python window. It exports only the page active in the map frame, even if I have multiple pages selected/highlighted in the Contents pane. It also ignores my SQL query.
... View more
04-21-2021
08:55 AM
|
0
|
1
|
4664
|
|
POST
|
I'm trying to export selected pages from a map series (by manually selecting/highlighting them in the Contents pane, or using a SQL query on the index layer) to PDF using Python. The MapSeries Documentation mentions parameters {page_range_type}, {page_range_string}, and {multiple_files} that sound like exactly what I need, but the code examples on that same page don't utilize those parameters. They instead use loops, which would be unnecessary if the above parameters actually worked(?). When using the interactive Python window in Pro, the code completion also does not utilize them. Attempting to use them just throws an error. Am I missing the proper context for these parameters? Are they not implemented (yet)? Please advise. Thanks! Edit: sorry, I was using the wrong terminology. It is parameters for the exportToPDF method that are missing. I changed all use of the word method to parameter.
... View more
04-21-2021
08:19 AM
|
0
|
11
|
5497
|
|
POST
|
I hadn't thought about a database view rather than a join, but I might give it a shot now that I'm fully in troubleshooting mode. It's very weird (to me, at least) that my model does work as-is, but it apparently doesn't write out to the table (or at least Pro doesn't notice that it has) until after Pro is restarted. Perhaps a db view would work better, though even if it does, that seems more like a workaround than a fix for my model (which works in ArcMap).
... View more
04-14-2021
09:56 AM
|
0
|
0
|
3843
|
|
POST
|
Unfortunately, layer refresh doesn't seem to fix my problem. However, that's irrelevant because I just realized that the non-spatial table actually isn't updating. If I update the table directly, it does immediately update on the map. But I'm actually using a model I built to update the table, and that's when edits don't show up until I restart Pro. Back to dealing with my models. 🤣 😒 Specifically, migrating models that worked fine in ArcMap that have proven problematic in Pro. Thanks for following me on 2 model-related wild goose chases in as many days.
... View more
04-14-2021
09:29 AM
|
0
|
0
|
3847
|
| Title | Kudos | Posted |
|---|---|---|
| 4 | 09-09-2024 12:05 PM | |
| 2 | 11-20-2019 07:41 AM | |
| 1 | 06-20-2024 07:43 AM | |
| 1 | 07-13-2022 09:50 AM | |
| 1 | 12-11-2023 06:12 AM |
| Online Status |
Offline
|
| Date Last Visited |
4 weeks ago
|