URL Parameter like QueryZoom

863
5
09-19-2011 01:00 PM
DavidMarquette
New Contributor
I am using the template found at http://www.arcgis.com/home/item.html?id=ad9b257016ab40ee9def89ac2d3db2b3.  I cannot find how to pass a URL parameter like a Parcel ID to QueryZoom to the parcel in question.  Any help or pointing in the right direction would be most helpful. Thanks!
0 Kudos
5 Replies
GarimaVyas
New Contributor
Per the Readme.pdf included in the download, QueryWidget.xml allows you to change the query widget's urls and other parameters.
0 Kudos
DavidMarquette
New Contributor
I know how to edit that and have done so successfully.  What I want to provide is a link from another site to a specific parcel id.  Basically a click here buttom that takes someone to my Silverlight site and zooms to their parcel.  Something like http://...mysite.com/default.htm?Parcels=040-084-300-030-00?
0 Kudos
MichaelKohler
Occasional Contributor II
Hi,
I have this for a parcel link as well. Common thing I guess! It was also to replace the QueryZoom from an ArcIMS site I replaced with silverlight.

What I did was to use HtmlPage to get to the query string and then process that in the MainPage startup.

      public MainPage()
      {

           InitializeComponent();


           //Code section for handling a Query String if passed in the URL
            #region Handling for URL Query String 
            if (HtmlPage.Document.QueryString.ContainsKey("service"))
            {

                if (HtmlPage.Document.QueryString["service"] == "parcel")
                {
                    if (HtmlPage.Document.QueryString.ContainsKey("parcelid"))
                    {
                        Process_ParcelQS(HtmlPage.Document.QueryString["parcelid"], "parcelid");
                    }
                    else if (HtmlPage.Document.QueryString.ContainsKey("spatid"))
                    {
                        Process_ParcelQS(HtmlPage.Document.QueryString["spatid"], "spatid");
                    }
                    else if (HtmlPage.Document.QueryString.ContainsKey("address"))
                    {
                        Process_ParcelQS(HtmlPage.Document.QueryString["address"], "address");
                    }
                    else
                    {
                        MessageBox.Show("passed URL does not contain data", "Parcel Service", MessageBoxButton.OK);
                    }
                }     



I also have other "services" like for users to zoom to a culvert or a specific zoning polygon etc... The parcel service in the code above can take a parcel id, a spatial id, or an address. I then pass the parameters to a function that runs a query, turns on aerials, and zooms to the parcel.

private void Process_ParcelQS(string inValue, string service)
{
   do your stuff here
}


so the calling app can format a string like:
http://yourwebsite.com/myapp.html?service=parcel&parcelid=345600800032
or
http://yourwebsite.com/myapp.html?service=parcel&address=123 S Main St


and silverlight will zoom right to it!

Oh... the HtmlPage is in System.Windows.Browser add that reference and using statement.
0 Kudos
DavidMarquette
New Contributor
Thanks!  So I can just add this to my default.htm page and change "service" to my actualy service address of the parcel layer?
0 Kudos
MichaelKohler
Occasional Contributor II
No... not really. I didn't know that you were using the Configurable Viewer. This solution requires a working knowledge of how the silverlight ArcGIS api is used. If you wanted to use this it would need to go in the MapPage.xaml code behind. Then you would need to write your own function (I called mine Process_ParcelQS) to query the parcel layer to get the graphic shape and zoom to that graphic.
0 Kudos