I have a need where a user needs to zoom into a parcel based on what parcel id they give in the string...
for example
imagine this is the string http://webmap...?parcelid=<USER ENTERS PARCEL ID>?window=new
then click ok
now it should open up a new window and open that web map and zoom to that parcel id..
whats the way to make it happen?
Thanks
Gopi
This will be (Legacy) pseudo-code but essentially, create a barebones web map (something like an ESRI sample) and, in the map init function, perform a query for your parcel and then zoom to the result it returns. Here's something similar I did for a web map that would zoom into the location of a feature if a lat/long coordinate pair was passed as part of the URL:
//Evaluate the URL of this HTML page to determine if any parameters were passed with it
var htmlPagePath = window.location.toString();
var qLocation = htmlPagePath.indexOf('?');
if (qLocation < 1)
{
passedLatLong = false;
}
else
passLatLong = true;
//If a coordinate location was passed as a parameter, zoom the map to it
if (passedLatLong)
{
//Extract the lat/long coordinates passed as a parameter with the URL
var coordStr = window.location.toString().substr(qLocation + 1,window.location.toString().length);
var coords = new Array();
coords = coordStr.split(',');
//Create a lat/long point
var bridgeLoc = new esri.geometry.Point(coords[0],coords[1], new esri.SpatialReference({wkid:4326}));
//set the map extent based on the lat/long coordinate passed. The coordinate must be converted
//to Web Mercator since the web services used have been defined with that projection..
map.setExtent(pointToExtent(map,esri.geometry.geographicToWebMercator(bridgeLoc),3));
}
Obviously, in your case, you would perform a queryTask on your parcels using the supplied parcel ID and then zoom to the result.
The 'History API to track selected feature' sample in the help shows how to do this. The application checks for a url parameter called parcelid when it loads and will then zoom to the parcel.
History API to track selected feature | ArcGIS API for JavaScript
Kelly has a great answer. For example calling the sample page with parcel ids:
http://developers.arcgis.com/javascript/samples/exp_history/?parcelid=1919427026
http://developers.arcgis.com/javascript/samples/exp_history/?parcelid=1919427014
Once this is set up you just need to code your links from the other page to open in a new window:
<a href="http://developers.arcgis.com/javascript/samples/exp_history/?parcelid=1919427026" target="_blank">5190 Clarendon Crest Dr</a>
<br/>
<a href="http://developers.arcgis.com/javascript/samples/exp_history/?parcelid=1919427014" target="_blank">5157 Nob Hill Ct</a>