Select to view content in your preferred language

Updating a result map service

2667
7
03-23-2014 10:50 AM
MatthewColwin
Emerging Contributor
Hey all, I'm trying to use the Heat Map widget, which only takes map services that have point results.

So, I created a geoprocessing tool that takes a polygon layer (which I published as a feature service), generates centroids, and adds the centroids to the map. I checked the box to 'view result with a map service'. I then created a Flex Viewer application, added the polygon feature service and the centroid map service as operational layers. Next, I added a geoprocessing widget using the centroid GP service.

My hope was that, if a user added a new polygon to the feature service and then ran the centroid GP widget, the centroid map service would update to include this newly generated centroid, but that is not the case. The result shows the new centroid, but the centroid map service does not update.

I'm wondering a couple things. First, does anyone know if there is a way to update an actual map service once a GP tool has been run? I ask this because if the user adds a new polygon and generates the centroids, I want the Heat Map widget to run on this updated centroid layer so it includes all of the centroids, rather than just the ones that were in the service when it was initially published.

And second, if that isn't doable, is there a way to use the Heat Map widget with an output operational layer, rather than with a map service? I'm guessing not, but maybe it's possible to run the centroid GP widget, add the results as an operational layer, and then have the Heat Map widget use this operational layer as the input layer.

Thanks for any and all help.
Tags (2)
0 Kudos
7 Replies
RobertScheitlin__GISP
MVP Emeritus
Matthew,

    I have not tried this, but in 10.2.1 you have access to to start and stop map services from ArcPy.

http://localhost:6080/arcgis/help/en/#/Manage_Service_utility/015400000625000000/
0 Kudos
MatthewColwin
Emerging Contributor
Thanks Robert, I will check that out. I'm not sure if I stated my problem clearly though.

I have a geoprocessing service that, when run, finds the centroids of a polygon feature service in a Flex application. What I really want is for an actual map service of centroids to be updated when the geoprocessing service is run, but right now, I have only been able to come up with the idea to 'view result with a map service' in addition to just publishing as a geoprocessing service, but this map service does not update when the GP service is run in Flex Viewer.

The other thought that I've had, but really don't know how to implement (or if it's even possible) is to build the "centroid generation" into the Edit tool in Flex Viewer. Basically, when a new polygon is created for the polygon feature service using the Edit tool, a feature service of centroids would also be updated with the centroid of the newly added polygon. Any chance anyone has ideas of how this might be possible?

Thanks,
Matt
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Matt,

   I don't have any suggestions on your other idea. As far as the GP Service that generates the centroids for the polygons, if you edit that GP and have the results write to the feature layer that the points Map Service is getting its data from then you can add a process to the GP model that will use the function mentioned in the link I provided to:

  1. stop the Map Service.

  2. run the centroid part.

  3. start the map service again.

and you should have your updates in your centroid Map Service.
0 Kudos
MatthewColwin
Emerging Contributor
Ok, I'm now starting to see what you mean. I'm not that familiar with using arcpy, or how to take an arcpy or command line operation and 'insert' it into a geoprocessing tool. I'm not even sure if that's the correct methodology for doing so. From what I've seen on the site you sent me, I'd do something like this to stop the service:

<Python installation location>\python.exe "C:\Program Files\ArcGIS\Server\tools\admin\manageservice.py" -u <admin> -p <password> -s http://XXX.X.XX.XXX:6080/arcgis/rest/services -t -n <Map Server name> -o stop

If that seems correct, how do I take this and get it into my geoprocessing model?

Thanks very much for your help.

-Matt
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Matt,

   You need to do some reading up on Model Builder. You should look at the ArcMap help docs for things on model builder. It is a drag and drop easy UI for building advanced processes using many or just a few toolboxes and linking then in a step/flow process. Once you have your model build you run it and then right click on the result of the run and you will get a share menu that allows you to publish it a GP Service. Anyway it is way to much for me to retype here in a post. There are many great step by step examples in the help docs.
0 Kudos
MatthewColwin
Emerging Contributor
I'm fairly familiar with building models and publishing them as geoprocessing services. The link you initially posted didn't work (I think due to the "localhost:6080" part) so I searched for the Manage Service utility and found this:

http://resources.arcgis.com/en/help/main/10.2/index.html#//015400000625000000

That page just talks about how to write command line operation to start/stop services. Unless I'm unaware, is there really a drag and drop tool available to start/stop services? If not, do you have any advice (not a step by step walkthrough or anything) on transferring command line arcpy statements to Model Builder?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
0 Kudos