Select to view content in your preferred language

Finding a parcel via the address

1087
4
07-09-2010 06:59 AM
AndrewTheokas
New Contributor
One huge advantage to JavaScript is the amount of code available online. And, with minor modifications, this code can be grafted into your own web service's functionality. But there is one operation I have been unable to find . Because it is so basic in nature I assume that it must be available somehere! What I am looking for is a JavaScript API that will zoom the viewer to an urban parcel after having first provided the street address (St no - St Name - St name Suf)

From that point one can acquire the parcel ID and any other basic information as would be found in an assessing map. It seems that there are several options to do the reverse - find a parcel once the parcel ID is found. But ususally the address is known and not the parcel number. If anyone can point me to such a site where the code might be available I will greatly appreciate it. Many thanks.
0 Kudos
4 Replies
derekswingley1
Deactivated User
Geocode the address, use the lat,lng you get from that to search your parcel layer and then zoom to the result?
0 Kudos
TerryGiles
Frequent Contributor
Do the parcel data contain the address?  If so you could run a query task against the parcel layer in the map service & then zoom the extent of the feature(s) in the returned featureset.
0 Kudos
AndrewTheokas
New Contributor
Do the parcel data contain the address?  If so you could run a query task against the parcel layer in the map service & then zoom the extent of the feature(s) in the returned featureset.


Thanks for this. I am quite new to JS, which is why I have been looking for something already done that I could check over. What you say sounds quite correct bt unsure how to run the query.
0 Kudos
TerryGiles
Frequent Contributor
Sorry for the delay, I was out of the office all last week.  See the code below for a simple example.  It has an address harded coded but you could easily take the house # and street name from input boxes on the web page. 

Also look into the JavaScript reference & samples on http://resources.esri.com/arcgisserver/apis/javascript/arcgis/index.cfm?fa=home

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
    
    <title>Test</title> 
     
    <style type="text/css">
      @import "http://serverapi.arcgisonline.com/jsapi/arcgis/1.5/js/dojo/dijit/themes/tundra/tundra.css";

    </style>
  
    
    <script type="text/javascript"> djConfig = { parseOnLoad: true }</script>

    <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=1.5"></script>
  


    <script type="text/javascript">

      //make sure required modules loaded for map, nav tools, tasks
      dojo.require("dojo.parser");

      dojo.require("esri.map");
      dojo.require("esri.tasks.query");

     
      //global for the Map
      var map;

      //globals for various map services
      var BaseMap = new esri.layers.ArcGISTiledMapServiceLayer("http://maps1.larimer.org/ArcGIS/rest/services/mapsCached/Basemap/MapServer", {id:"BaseMap"});
      var qryLarco = new esri.tasks.QueryTask("http://maps1.larimer.org/ArcGIS/rest/services/mapsCached/Basemap/MapServer/133");

     function init() {
        
       var startExtent = new esri.geometry.Extent(3090061, 1415999, 3152561, 1465999, new esri.SpatialReference({ wkid: 2231 }));
        
       map = new esri.Map("mapDiv", { extent: startExtent});  
       map.addLayer(BaseMap);
       
  }
    
     

    function findParcel(){
      
        var query = new esri.tasks.Query();
        query.returnGeometry = true;
        query.outFields = ["parcelnum"];

        //goto city gardens
        query.where = "LOCADDRESSNUM='2145' and LOCSTREETNAME='CENTRE'";
        qryLarco.execute(query, zoomtoParcel );        
  
   }
    
   function zoomtoParcel(results){
    //remove all graphics on the maps graphics layer
        map.graphics.clear();

        var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASHDOT, new dojo.Color([255,0,0]), 2), new dojo.Color([255,255,0,0.5]));
        console.log(symbol);
        console.log(results);
     //example assumes only 1 feature returned    
     var graphic = results.features[0];
     graphic.setSymbol(symbol);

        //Add graphic to the map graphics layer.
        map.graphics.add(graphic);
        map.setExtent(graphic.geometry.getExtent());
           
    }
    
    dojo.addOnLoad(init);   
                
     </script>
      
      
  </head>
      
  <body class="tundra">
      <div id="mapDiv"  style="margin:1px; border:1px solid black; height:480px;width:600px;">
      </div>
      <button id="btnParcel" onclick="findParcel();">Find Parcel</button>
  </body>
  
</html>
  


0 Kudos