ZoomToFeature from Home Panel?
Hi All,
From my Home Panel, is it possible to create a hyperlink and when clicked it zooms to a feature based on the ObjectID?
I'm not sure how to set this up since it's not in the details of a specific layer, but in the Home Panel.
Would it be best/possible to use a workflow, and if so how would I pass the OBJECTID parameter into the workflow?
To give you a better idea of what i'm trying to accomplish, here is the test site i'm trying to set this up for: http://testmapitwest.fortworthtexas.gov/HistoricPhotos
The idea is that if someone clicks on the name of a historic building in the Home Panel (they are underlined), it would zoom to that location on the map.
Any help or advice would be greately appreciated!
Thank You,
Laura
-
Hi Laura,
You could launch a workflow from your home panel by using a hyperlink command.
Here is a sample of the HTML you would need to put in your home panel:
<a href="command:RunWorkflowWithArguments?workflowId=ZoomToFeatureById&featureId=123">Go to point 123</a>
Inside the ZoomToFeatureById workflow you could do a query for a feature with id 123 and then pan/zoom to the geometry of the found feature.
Let me know how it goes!
Cheers,
Kevin
0 -
Hi Kevin,
Would this mean that I would need to create a seperate workflow for each individual object I wanted to ZoomTo?
Thank You,
Laura
0 -
It would be easiest if all the features were in the same layer, then you would just change the ID argument accordingly.
If the features are in multiple layers than you could create a workflow with one or two extra parameters, say 'LayerName', 'Id' and 'IdField'. The query activity then uses the passed info to return a feature.
Cheers,
Kevin
0 -
Hi Kevin,
I think this is going to work great since all the data is coming from the same layer!
However when I setup my WHERE query, how do I write it so it includes the passed in variable (such as 123) from the hyperlink?
Thanks again!
Laura
0 -
Either right in the query task or in an assign above.
For string datatypes: "FeatureNameField = '" +YourWorkflowArgumentName + "'"
For numeric datatypes: "FeatureIdField = " + YourWorkflowArgumentId
There are other fancy ways to handle both types, but try those for now.
-Kevin
0 -
Make sure you check that the query is returning a feature. When you try to access featuresset.features(0) and nothing is there, it will cause this error.
0 -
The problem is that it's not getting the variable from the <a href="command:RunWorkflowWithArguments?workflowId=ZoomTo&featureId=1">Go to point 1</a> statement. I setup an Alert at the beginning of the workflow to print the featureId variable and it's saying "There was a workflow error running activity: Exception has been thrown by the target of an invocation. Workflow 'ZoomTo' failed Unhandled exception: 'Object reference not set to an instance of an object.' in activity '1.50: Alert'. Object reference not set to an instance of an object."
0 -
Can you paste your site config for the link?
0 -
You mean my Home Panel code? I just wanted to check before posting because it's rather lengthy.
0 -
After reading this thread: https://support.geocortex.com/SupportForums/Thread.aspx?pageid=0&mid=2&ItemID=20&thread=53580
I created an Argument for featureID, however now i'm getting the following error: There was a workflow error running activity: Exception has been thrown by the target of an invocation. Unable to load workflow. Cannot set unknown member '{clr-namespace:}_218e.featureID'.
Has anyone seen the message before? I'm trying to run this on an HTML5 site, will this function only work in the Silverlight viewer?
Thank You,
Laura
0 -
Hi Robin, have you figured this ZoomToFeaturebyid workflow out? any possible that you can share the code?
Thanks.
Feng0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
11 Kommentare