<!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>
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.
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.