Raiding Naxxramas: Unlocking the Secrets of the Cursor

By admin

The Curse of Naxxramas is the first Hearthstone adventure released by Blizzard Entertainment. It was introduced in July 2014 and offers a single-player mode where players can face off against various bosses and challenges. The adventure is set in the dark and eerie necropolis of Naxxramas, a floating citadel controlled by the powerful lich Kel'Thuzad. Players progress through different wings of Naxxramas, each containing different bosses to defeat. Each boss has their own unique abilities and tactics, providing a varied and challenging experience. To complete each wing, players must defeat all the bosses within it.


I was successful in most of my gp tool migrations. However, there are 2 major "module-based" issues I am having:

The purpose of this script was to iterate through a set of polygons, select the intersecting points in each polygon, load these points into a new Network Analysis Route layer, solve that route, then move on to the next polygon and repeat. One way to access that field is to use the export method to save the output Stops to a feature class and then use it the same way you would any feature class.

Cursor of naxxramas

To complete each wing, players must defeat all the bosses within it. Along the way, they earn cards that are only available through the adventure, providing unique and powerful options for constructing decks. These cards can often be game-changers, offering new strategies and synergies for players to explore.

Best tips for migrating an arcpy.na script from ArcMap 10.6.1 to Pro 2.5?

Previously, I was working in ArcMap 10.6.1 and created a script utilizing the arcpy.na module. I had no Python background prior to this rather large undertaking, so my (still limited) Python knowledge is based in ArcGIS.

The purpose of this script was to iterate through a set of polygons, select the intersecting points in each polygon, load these points into a new Network Analysis Route layer, solve that route, then move on to the next polygon and repeat.

It was working pretty well! Then, I decided to migrate to Pro 2.5.

I was successful in most of my gp tool migrations. However, there are 2 major "module-based" issues I am having:

1. I am having difficulty understanding how to migrate from the arcpy.mapping module to the arcpy.mp module in Pro.

2. I've been a little confused with the differences between the .nax module and the legacy .na module, even after reading the "choose your module" help page. The .nax module seems much simpler and more straightforward, but it appears to not have the ability to create network analysis layers. That is the main function of my script.

I feel as though I am back at square one trying to navigate these migrations. Does anyone have any experience moving to these new modules? Is anyone else in the same boat as me?

Tags (9) 0 Kudos 10 Replies Esri Regular Contributor ‎07-22-2020 12:53 PM
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Report Inappropriate Content

If you want to keep your script mostly the same and continue to use NA layers, that will work. But, as you have discovered, there are some code changes required, particularly with regards to working with the arcpy.mapping module in Pro.

This page has some tips about how to migrate an NA layer-based workflow to Pro: Migrating arcpy.na to ArcGIS Pro—Network Analyst module | Documentation

And this page talks about migrating to Pro for the arcpy.mapping module: Migrating from arcpy.mapping to ArcGIS Pro—ArcPy | Documentation

Regarding the newer arcpy.nax module: Yes, the workflows are more straightforward, and as you have noticed, they are not based on layers at all. There is the ability to export an NA layer after solving the analysis, but the primary intent there is for debugging problems. The primary assumption is that at the end of the day, most people just need the Service Area polygons or maybe just a couple of field values from the output of the analysis. The arcpy.nax module allows you to access those things directly. You can use the export() method to export the polygons to a feature class on disk, or you can loop through the analysis results using a search cursor if you just need to grab a few field values.

If you are having trouble with a few specific lines of code, feel free to paste them here and I can take a look.

New Contributor II ‎07-28-2020 11:51 AM
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Report Inappropriate Content

Thank you for your quick response. I read through the materials again with your explanations in mind and I attempted to edit my script accordingly. I was going to give it a whirl again using the .nax module and foregoing the arcpy.mp module (since the .nax module is more straightforward with exporting fields).

However, I had a .nax module issue from the get-go. Even after checking out the network analyst extension, I am receiving this error on the following line:

route.load(arcpy.nax.RouteInputDatatype.Stops, input_stops)AttributeError: module 'arcpy.nax' has no attribute 'RouteInputDatatype'

Is this a sign that I should instead try to utilize the arcpy.mp module in conjunction with the legacy arcpy.na module?

0 Kudos Esri Regular Contributor ‎07-28-2020 12:05 PM
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Report Inappropriate Content

Don't give up yet! You just have a capitalization error, and the code is case sensitive. It's "Type", not "type" in "RouteInputDataType".

New Contributor II ‎07-29-2020 06:31 AM
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Report Inappropriate Content

Thank you Melinda! That's all I needed to make it work, and it looks great!

The .nax module is definitely more straightforward and user-friendly; it looks like I saved myself about 20 lines of code with the switch.

I do have one (hopefully) last question, regarding the returnDirections property. I have read that .nax stores everything in memory, and I would like to view the turn-by-turn directions for the generated route. I do not have much experience with in-memory storage. Is there a quick line of code I can insert to call to the route directions output, using that returnDirections property on the route solver?

My purpose in viewing the directions is to see the sequence of the stops that are used on the route. Is there a better way to view the sequence using the .nax module than trying to view the directions output?

0 Kudos Esri Regular Contributor ‎07-29-2020 08:04 AM
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Report Inappropriate Content

Yes, that's definitely possible. What you want is the Sequence field in the output Stops.

This page lists the field available in the outputs: Route output data types—ArcGIS Pro | Documentation

One way to access that field is to use the export() method to save the output Stops to a feature class and then use it the same way you would any feature class. But if you just want to get the sequence values, you can use searchCursor() to access them directly:

result = route.solve() fields = ['Name', 'RouteName', 'Sequence'] for row in result.searchCursor(arcpy.nax.RouteOutputDataType.Stops, fields): print(row)
0 Kudos New Contributor II ‎08-03-2020 11:44 AM
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Report Inappropriate Content

Thanks again for all the help lately! That method worked perfectly and I feel confident with the .nax module for routing now!

Down the line we are possibly going to be using this script to host map services, so I am also trying to fix the .na module code to work in Pro and to better my understanding of its differences. Now I am having difficulty with the MakeRouteAnalysisLayer method.

layer_object = arcpy.na.MakeRouteAnalysisLayer(network, route_name, "Driving Time", "FIND_BEST_ORDER", "", "", "ALONG_NETWORK", "", "DIRECTIONS", "")

I am receiving this error:

TypeError: MakeRouteAnalysisLayer() takes from 0 to 9 positional arguments but 10 were given

I am working from this syntax:

MakeRouteAnalysisLayer(network_data_source, , , , , , , , , )

Previously, when I attempted to modify my code for use in Pro (before my initial post requesting help), it was not returning this error. Any insight into this?

Thanks in advance,

0 Kudos Esri Regular Contributor ‎08-03-2020 11:54 AM
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Report Inappropriate Content

The time_zone_for_time_fields parameter was just added at ArcGIS Pro 2.6, so if you have not updated to 2.6 yet, that's probably the source of the error. You can just leave out the last "" in your call to MakeRouteAnalysisLayer.

0 Kudos New Contributor II ‎08-06-2020 12:39 PM
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Report Inappropriate Content

Ah, ok that makes sense. I didn't see an option to view syntax specifically for 2.5; is that documented somewhere or is it more of an understanding gained from working in Pro more and more?

That worked for me, but I am now getting an error when I try to load my points into the stops sublayer. I am wondering if it is a similar issue, where one of the parameters I am using is only for 2.6?

This is the block of code I am using:

layer_object = arcpy.na.MakeRouteAnalysisLayer(network,route_name,"Driving Time","FIND_BEST_ORDER","","","ALONG_NETWORK","","DIRECTIONS").getOutput(0) sublayer_names = arcpy.na.GetNAClassNames(layer_object) stops_sublayer_name = sublayer_names["Stops"] routes_sublayer_name = sublayer_names["Routes"] arcpy.na.AddLocations(layer_object, stops_sublayer_name, input_points, "", "5000 Meters", "IDNO", "", "MATCH_TO_CLOSEST", "APPEND", "NO_SNAP", "5 Meters", "INCLUDE", "") arcpy.na.Solve(layer_object, "SKIP")‍‍‍‍‍‍‍‍‍‍

This is the error returned on line 7:

ExecuteError: Failed to execute. Parameters are not valid. ERROR 000840: The value is not a Network Analyst Layer. Failed to execute (AddLocations).

I am confused as to why it is not recognizing my "layer_object" as an NA Layer, especially because I can see the NA Layers being added to my map and table of contents while the script is running.

Also, I apologize for asking so many questions! I am usually pretty good about being able to research my errors and figure out a solution, but I feel like with all the updates to Pro and new modules I need to utilize, I'm having difficulty finding common errors and solution documentation.

And this page talks about migrating to Pro for the arcpy.mapping module: Migrating from arcpy.mapping to ArcGIS Pro—ArcPy | Documentation
Cursor of naxxramas

The adventure also introduces a new game mechanic, the "Curse." Certain bosses and cards can inflict curses upon players, creating additional challenges and obstacles to overcome. Curses can have a wide range of effects, from limiting the number of cards players can hold to reducing the health of their minions. The Curse of Naxxramas offers a compelling single-player experience for Hearthstone players. It provides a new way to engage with the game and offers unique rewards that can enhance decks in the regular play mode. The adventure also adds depth and lore to the Hearthstone universe, further immersing players in the world of Azeroth. Overall, the Curse of Naxxramas is a significant addition to Hearthstone, offering new content and challenges for players to enjoy..

Reviews for "The Secret Origins of the Cursor of Naxxramas Revealed"

1. Jane - 2/5 stars
I found "Cursor of naxxramas" to be quite disappointing. The storyline was weak and unimpressive, and the characters lacked depth and development. The gameplay mechanics were also frustrating and clunky, making it difficult to fully immerse myself in the game. Additionally, the graphics were outdated, which made the overall experience less enjoyable. Overall, I wouldn't recommend this game to avid gamers as there are far better options available.
2. Mike - 3/5 stars
I had high expectations for "Cursor of naxxramas," but unfortunately, it fell short. The controls were not intuitive and took some getting used to, which impacted my overall enjoyment of the game. Additionally, the levels lacked variety and became repetitive quite quickly. While the concept was interesting, the execution was lacking in many aspects. It's an average game at best, and there are certainly better options out there.
3. Sarah - 1/5 stars
I cannot stress enough how much I disliked "Cursor of naxxramas." The gameplay mechanics were incredibly frustrating and glitchy, making it nearly impossible to progress and enjoy the game. The lack of clear instructions and guidance made it even more infuriating. The graphics were subpar, and the overall experience felt cheap and poorly executed. I regret spending any time on this game and would advise others to stay far away from it.
4. Chris - 2/5 stars
"Cursor of naxxramas" had potential, but it ultimately failed to deliver. The controls were clunky and unresponsive, making it difficult to navigate and complete the tasks at hand. The story was weak and lacked substance, making it hard to fully engage with the game. The lack of updates and support from the developers also left a lot to be desired. Overall, it's a forgettable game that I would not recommend to others.

From the Crypt to Your Cursor: An In-Depth Look at Naxxramas

Unleash Chaos with the Legendary Cursor of Naxxramas