📄 finaldemo.html
字号:
//Need to pass in a polygon since that is what the GP service wants. Extent will not work
var features= [];
features.push(map.graphics.graphics[0]);
var featureSet = new esri.tasks.FeatureSet();
featureSet.features = features;
var params = { "Area_to_Zip":featureSet, "Email_Zip_To":dojo.byId("emailAddress").value };
gp.submitJob(params, clipshipcomplete, statusCallback);
}
//in the line gp.submitJob, the clipshipcomplete funciton below is defined to run when the job completes
//This simply alerts the user the gp job is done and clears the graphics (area of interest) off the map
function clipshipcomplete(jobInfo) {
alert("Clip and Ship has completed. You should receive an email any minute now....");
map.graphics.clear();
}
//This function gets called once every second after gp.submitJob has been called. It checks the status of the job
//It can be used to inform the user that geoprocessing jobs are still running- especially useful for large/lengthy geoprocessing operations
function statusCallback(jobInfo) {
dojo.byId("lblGPStatus").innerHTML = "Job Status: " + jobInfo.jobStatus;
}
//The remaining functions are for the Neighborhood Query (dropdown list in the upper right of the application)
function execute() {
queryTask.execute(query, showResults1);
}
function showResults1(results) {
var options = new dojo.data.ItemFileWriteStore({ data: { identifier: 'name', items: []} });
var s = "";
var nameArray = new Array();
for (var i = 0, il = results.features.length; i < il; i++) {
var featureAttributes = results.features[i].attributes;
for (att in featureAttributes) {
try {
if (att == "NAME")
nameArray.push(featureAttributes[att]);
} catch (ex) { }
}
}
nameArray.sort();
for (var i = 0; i < nameArray.length; i++) {
try {
options.newItem({ name: nameArray[i] });
} catch (ex) {
//alert(ex);
}
}
var comboBoxFetchStrategy = new dijit.form.ComboBox({
name: "prog3",
autoComplete: false,
store: options, onChange: zoomNeighborhood
}, dojo.byId("progCombo3"));
}
function zoomNeighborhood(value) {
var neighQuery;
neighQuery = new esri.tasks.Query();
neighQuery.returnGeometry = true;
neighQuery.outFields = ["NAME", "SHAPE"];
neighQuery.where = "NAME='" + value + "'";
queryTask.execute(neighQuery, zoomNeighborhoodResults);
}
//This function gets called when the combo box in the upper right of the application is changed.
//Specifically gets called from zoomNeighboorhood function above is executed and resultant polygon is found as a result
//Highlights the chosen neighborhood with a graphic on the map and zooms into it.
function zoomNeighborhoodResults(results) {
map.graphics.clear();
var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255, 255, 255, 0.35]), 1), new dojo.Color([255, 0, 0, 0.35]));
//QueryTask returns a featureSet. Loop through features in the featureSet and add them to the map.
for (var i = 0, il = results.features.length; i < il; i++) {
//Get the current feature from the featureSet.
//Feature is a graphic
var graphic = results.features[i];
graphic.setSymbol(symbol);
var infoTemplate = new esri.InfoTemplate();
infoTemplate.title = "${NAME}";
infoTemplate.content = "<b>NAME: </b>${NAME}";
graphic.setInfoTemplate(infoTemplate);
//Add graphic to the map graphics layer.
map.graphics.add(graphic);
map.setExtent(graphic.geometry.getExtent().expand(2));
}
}
//When the application loads, call the init function (first javascript function in html).
dojo.addOnLoad(init);
</script>
</head>
<body class="tundra">
<table width="100%">
<tr>
<td>
<img src="http://www.portlandonline.com/images/Header-Left.gif" border="0" width="390" height="60" style="border:1px solid silver;">
<br />
City of Portland Parcel and GIS mapping
</td>
<td align="right">
Quick Locate Neighborhood:<br />
<form action="#" method="GET">
<input id="progCombo3" />
</form>
</td>
</tr>
</table>
<table>
<tbody>
<tr>
<td>
<div style="position:relative;">
<div id="map" style="width:1200px; height:800px; border:1px solid #000;">
</div>
<div style="position:absolute; right:25px; top:10px; z-Index:999;">
<button dojoType="dijit.form.Button" onClick="TurnOffStreetMap();">Imagery</button>
<button dojoType="dijit.form.Button" onClick="TurnOffImagery();">Street Map</button>
</div>
<div style="position:absolute; right:10px; top:50px; z-Index:999;">
<div dojoType="dijit.TitlePane" title="Find Address" open="false" style="width:350px">
Address : <input type="text" id="address" size="50" value="7000 NE Airport Way, Portland, OR, 97218" /> <br/>
<i>(Address, City, State, Zip)</i>
<input type="button" value="Locate" onclick="locate()" /><br />
</div>
<div dojoType="dijit.TitlePane" title="Query Parcel by ID" open="false" style="width:350px">
<table>
<input id="parcelID" type="decimal" name="parcelID" value="21E10BB07200" dojoType="dijit.form.TextBox" /> <br/>
<button onclick = "QueryParcel()"; style="display: block;float: right; margin: 6px 0 20px 0; clear: both; border: 1px solid #999; background: #EEEEEE">Query and Pan to Parcel</button>
</table>
</div>
<div dojoType="dijit.TitlePane" title="Identify Attributes" open="false" style="width:350px">
<table>
Check the layer(s) you want to identify, then click the identify button below, then click on map to identify a feature. A graphic will appear on the feature you identified. Click the graphic again to obtain the attributes.
<br />
Option:<br />
<select id="layerOption">
<option value="all">All</option>
<option value="visible">Visible</option>
<option value="top">Top</option>
</select>
<br />
Layer Ids:<br />
<span id="toc"></span>
<button onclick = "syncIdentify()"; style="display: block;float: right; margin: 6px 0 20px 0; clear: both; border: 1px solid #999; background: #EEEEEE">Identify Feature</button>
</table>
</div>
<div dojoType="dijit.TitlePane" title="Clip and Ship" open="false" style="width:350px">
<table>
Click the button below, then draw a polygon of the area you would like data to be extracted
<br />
<button onclick = "initToolbar()"; style="display: block;float: right; margin: 6px 0 20px 0; clear: both; border: 1px solid #999; background: #EEEEEE">Draw Polygon to Clip to</button>
<br />
Email address to send .zip file
<br />
<input id="emailAddress" type="decimal" name="parcelID" value="" dojoType="dijit.form.TextBox" /> <br/>
<button onclick = "clipship()"; style="display: block;float: right; margin: 6px 0 20px 0; clear: both; border: 1px solid #999; background: #EEEEEE">Execute Clip and Zip</button>
<br />
<label id="lblGPStatus">Job Status: Not started</label><br>
</table>
</div>
<div dojoType="dijit.TitlePane" id="CensusTitle" title="Dynamic Census Data" open="false" style="width:350px">
<table>
Adjust the slider to change the definition query for the Census Block Group layer
<br />
Population Density
<div id="horizontalSlider" dojoType="dijit.form.HorizontalSlider"
value="0" minimum="0" maximum="10000" discreteValues="10001"
intermediateChanges="true"
showButtons="true" onChange="dojo.byId('popDens').value = arguments[0];" clickSelect="false">
</div>
<input id="popDens" type="decimal" name="popDens" value="0" dojoType="dijit.form.TextBox" disabled="'disabled'" /> / square mile
</table>
</div>
</div>
</div>
</div>
</td>
<td valign="top">
</td>
</tr>
</tbody>
</table>
<div dojoType="dijit.Dialog" id="MailingList" title="Mailing List">
<p>Addresses within buffer distance:</p>
<span id="MailingLabels"></span>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -