HTML5 Startup Actions
I have used URL Startup Actions for the Silverlight Viewer before and they are extremely helpful. As a programmer, I can set properties for the map when opening it from an applicationt. Now my users want HTML5 maps. No problem! Geocortex makes it easy. However, I can't figure out how I can open the HTML5 map and then zoom to some features. Can this be done? Even if it's not in the URL, can this be done?
"Roj"
-
+1
0 -
+1
0 -
Hi Roger,
You can use the URL extent parameter and scale parameter. It's covered in section 11.2 URL Parameters Reference of the Geocortex Viewer for HTML5 2.2 Administrator and Developer Guide.
The other option that comes to mind is a startup workflow (URL parameter) with argument parameters.
regards,
Edmond0 -
I opened up the Geocortex Viewer for HTML5 Administrator and Developer Guide and found exactly what I needed. There is a URL parameter where you can specify a workflow you want to run, as well as the parameters to the workflow. So, I created a simple workflow which searches for a plot by ID (and added the incoming PlotID as an Argument in the Workflow). Then I added the workflow to the site and saved the site. Then I loaded up the HTML5 viewer URL and added "run=SearchAndZoomToPlot&PlotID=A0123" to the end of the URL and it works!
But I have 2 related questions to keep on the same thread:
1) Luckily, no PlotID would ever have a quote in it. But when I do insert a quote (acting as a malicious user), I get this message:
"There was a workflow error running activity: Exception has been thrown by the target of an invocation. Workflow 'SearchAndZoomToPlot' failed Unhandled exception: 'One or more errors occurred.' in activity '1.10: QueryTask'. One or more errors occurred. Unable to complete operation."
What Visual Basic function can I use to properly Quote the incoming value?
2) Once I get the extent, how do I expand the extent in Workflow so that it zooms out a bit?
0 -
I was able to answer question #2 this way:
I used an "If" node to test if the extent of the plot results were Nothing. If not, then I used "Assign" to call PlotsExtent.Expand(3.0) and assign it to a new variable, NewMapExtent. Then I used NewMapExtent in the "SetMapExtent" task.
0 -
Hi Roger,
1) You've got a couple of options here, depending on how you want to handle the situation. You can strip or change the quote by using the .replace method. Here is an example where a single quote is replaced(escaped) with two single quotes, which is useful for last names like O'Malley. An Assign activity would look like txtUserInput = txtUserInput.Replace("'","''"). This escaping will handle the malicious user's attack. Another method is using a regular expression validation to prevent the single quote from being entered in the first place.
2) The extent can be zoomed out by using the .expand method. IE if myEnvelope was an envelope then myEnvelope.expand(2.0) would calculate so that the feature was 50% of the set extent if you used the Set Map Extent client activity. Note that the value for the parameter on the expand has to be a double, not a integer. See http://resources.arcgis.com/en/help/silverlight-api/apiref/api_start.htm?esri.arcgis.client~esri.arcgis.client.geometry.envelope~expand.html
Here is a sequence to zoom to the extent of a featureset:
/customer/servlet/servlet.FileDownload?file=00P6000000em1OIEAY
regards,
Edmond0 -
Thank you, Edmund, for both your replies. They got me going in the right direction and to a solution! What I'll do is strip out quotes, rather than replace them, since my Plot ID's don't have quotes. Much appreciated.
0 -
Here is my finished product:
Workflow Arguments:
/customer/servlet/servlet.FileDownload?file=00P6000000elzaHEAQ
Workflow Variables:
/customer/servlet/servlet.FileDownload?file=00P6000000em1AuEAI
Workflow:
/customer/servlet/servlet.FileDownload?file=00P6000000em1V9EAI
Geocortex Essentials Site Hook-up:
/customer/servlet/servlet.FileDownload?file=00P6000000elzNuEAI
Finished URL:
http://maps.orem.org/HTML5Viewer_1_3/?viewer=c&run=SearchAndZoomToPlot&PlotID=H36001
Thank you!
0 -
Can you send this or post the workflow?
I'm looking to do something similar for properties.
Thanks
0 -
With all due respect, what more do you need? The screenshots in my last post show everything: the argument to the Workflow, necessary variables and their types, and all the tasks and parameter values. Sure the Query URL is chopped off, so I include it here:
http://maps.orem.org/arcgis/rest/services/Cemetery/MapServer/1
Other than that URL, I can't think of anything else I'd need to provide for you to do the same thing on your end. I'm happy to help, though, if there's some trouble in the implementation.
0 -
Sorry Roger
our internal Firewall was blocking the images so I could not see any of the pretty pictures :-(
It's all good now Thanks a bunch for all your hard work.
0 -
I didn't think of that possibility (that a firewall would block the pictures included in the posts). But you got them now, and that is good. I was really happy to find this solution because I had told my boss that zooming to a specific plot in the HTML5 viewer was impossible, and now I made it happen, which makes me look good. :) So I really do thank those on this thread that got me there.
0 -
I like this post and the results. I noticed something that i would like to do also.
the site launches with no splash screen, and a shortened url
We have the problem to display a simple mapview on our website. the tendancy was to just use a javascript viewer and get one of the programmers to build it. i was why do that, if i could simplify the html5 viewer so it fires up fast, no splash screen, and runs a workflow, our web designer could embed a geocortex simple viewer in html5 for the website. so how did you get around the splash screen and a long url to launch your viewer
by long url:
this displays the splash screen builds the site, then runs the workflow - not real smooth
J
0 -
I believe I had found another page in the Geocortex Support Center that showed me how to do shortened URLs with the HTML5 Viewer. Here's what you can do:
- Open C:\inetpub\wwwroot\Html5Viewer_1_3\index.html in a text editor.
- Find "var viewerConfig", without the quotes. You should be taken to the body of a dojo.ready method.
- In the "configurations" thing, go to the end of the last entry in braces, add a comma, and press Enter to add a new line.
- Specify the little string you want to use (in double quotes), followed by a comma, a space, the http URL to the HTML5 Default directory in double-quotes, followed by +shellName+".json.js"
For example, the last entry I have for my Cemetery viewer in viewerConfig is this literal string:
As far as how to get rid of the splash screen, I didn't do that knowingly. Even without calling a workflow it doesn't show a splash screen. I don't think I've ever seen an HTML5 Viewer show a splash screen, but I know the Silverlight viewer does.
0 -
awesome, thanks for codes and instructions!
J
0 -
@ Edmund
I had a similar workflow running
but for some reason today then the "Mapit" button is clicked from the other side
it inserts a %20 our parcels are in the format 500700-62.-5-5 we're getting 500700%20-62.-5-5
which causes an "Object reference not set to an instance of an object" error.
is there a way to prevent this from happenning? Its happening in all the browsers.0 -
Found and fixed the %20 bit I had an extra space in my URL link that was causing discomfort :-)
Thanks to Roger and Edmund for the workflow bit could not have done it without the help
I also like that the map pin is working HTML side would love to see that highlight working as well.0 -
Works great. Thanks Roger D!
0
Please sign in to leave a comment.
Comments
18 comments