|
POST
|
I am trying to move the ESRI world geocoder to the bottom of my list sources for the search function, I believe the it is the first one in the sources array by default (Esri World Locator), as mentioned by Kelly Hutchins's Blog in this thread, https://community.esri.com/message/517562#517562 I have added four sources to the search function and I want to change the order so that ESRI world geocoder shows up at the end, I tried this changing the number in the array, sources: [4], it did not work Any help or suggestions will be great! Thanks
... View more
08-19-2015
08:58 AM
|
0
|
4
|
3871
|
|
POST
|
Creating a Tile Cache or Package that is Visible at All Scales Here is a complete workflow for getting the results you are looking for.
... View more
08-14-2015
11:45 AM
|
2
|
0
|
1383
|
|
POST
|
Here is the relevant JavaScript part of the code from the working sample modified by Owen Earley You would have to add the URL of the your GP service and input parameter pertaining to your GP service: require([
"esri/map",
"esri/dijit/Scalebar",
"esri/dijit/Search",
"esri/tasks/query",
"esri/tasks/Geoprocessor",
"esri/tasks/FeatureSet",
"esri/tasks/ParameterValue",
"esri/geometry/Circle",
"esri/graphic",
"esri/geometry/webMercatorUtils",
"esri/symbols/SimpleMarkerSymbol",
"esri/symbols/SimpleLineSymbol",
"esri/symbols/SimpleFillSymbol",
"esri/renderers/SimpleRenderer",
"esri/SpatialReference",
"esri/config",
"dijit/layout/BorderContainer",
"dijit/layout/ContentPane",
"esri/Color",
"dojo/dom",
"dojo/parser",
"dojo/on",
"dojo/dom-style",
"esri/layers/GraphicsLayer",
"dojo/domReady!"],
function (
Map,
Scalebar,
Search,
Query,
Geoprocessor,
FeatureSet,
ParameterValue,
Circle,
Graphic,
webMercatorUtils,
SimpleMarkerSymbol,
SimpleLineSymbol,
SimpleFillSymbol,
SimpleRenderer,
SpatialReference,
esriConfig,
BorderContainer,
ContentPane,
Color,
dom,
parser,
on,
domStyle,
GraphicsLayer) {
// Parse DOM nodes decorated with the data-dojo-type attribute
parser.parse();
//Step: Specify the output fields
// this should not be needed as nearly all query & select functions are performed on the client
esriConfig.defaults.io.proxyUrl = "/proxy";
map = new Map("mapDiv", {
basemap: "streets",
center: [-99.249, 31.954],
zoom: 7,
slider: true
});
var s = new Search({map: map}, "search");
s.startup();
var scalebar = new Scalebar({
map: map,
scalebarUnit: "dual"
});
//Buffer circle symbol based on user input distance for dispaly only, not used for selecting features
var circleSymb = new SimpleFillSymbol(SimpleFillSymbol.STYLE_NULL,
new SimpleLineSymbol(SimpleLineSymbol.STYLE_SHORTDASHDOTDOT,
new Color([105, 105, 105]), 2), new Color([255, 255, 0, 0.25]));
// GP
var gpTask = new Geoprocessor("YourGP service URL");
gpTask.setOutSpatialReference = map.spatialReference;
// Setup onTaskSuccess and onTaskFailure event handlers.
dojo.connect(gpTask, "onExecuteComplete", createSummaryTable);
dojo.connect(gpTask, "onError", createSummaryTableFailed);
//when the map is clicked create a buffer around the click point of the specified distance.
map.on("click", function (evt) {
// Add search radius graphic to map
var radius = parseInt(dom.byId("bufferDistance").value);
addRadiusGraphic(evt.mapPoint, radius);
// Project map point to geographic and send to GP Task
var ptGeo = webMercatorUtils.webMercatorToGeographic(evt.mapPoint);
runGpTask(ptGeo, radius)
});
function addRadiusGraphic(pt, radius) {
var circle = new Circle({
center: pt,
geodesic: true,
radius: radius,
radiusUnit: "esriMiles"
});
var graphic = new Graphic(circle, circleSymb);
map.graphics.clear();
map.graphics.add(graphic);
}
function runGpTask(pt, radius) {
console.log("Run GP Task: ", pt, radius);
//pt.attributes["OBJECTID"] = 1;
var gr = new Graphic(pt);
gr.setAttributes({"OBJECTID": 1});
// Create GP task params (input feature set and search distance)
var inputFeatures = new esri.tasks.FeatureSet();
inputFeatures.geometryType = "esriGeometryPoint";
inputFeatures.spatialReference = new SpatialReference(4326);
inputFeatures.features = [gr];
var SearchDistance = new esri.tasks.LinearUnit();
SearchDistance.distance = radius;
SearchDistance.units = "esriMiles";
var params = {
"PointFeatureSet_WGS": inputFeatures,
"Search_Distance": SearchDistance
};
console.log("Execute GP Task: ", params);
dom.byId("totalsInfo").innerHTML = 'Calculating...';
// Execute GP task
gpTask.execute(params);
}
function createSummaryTable(results, messages) {
console.log("createSummaryTable: ", results, messages);
var recSet = results[0].value;
var totBlocks = recSet.features.length;
var totTotalPopulation = 0;
var totHouseholdUnits = 0;
for (var x = 0; x < recSet.features.length; x++) {
totHouseholdUnits += recSet.features .attributes["SUM_HU100"];
totTotalPopulation += recSet.features .attributes["SUM_POP100"];
}
var htmlSummary = '<table id="resultsTable" cellspacing="0">' +
'<tr><td>Blocks</td><td align="right">' + totBlocks + '</td></tr>' +
'<tr><td>Total Population</td><td align="right">' + totTotalPopulation + '</td></tr>' +
'<tr><td>Housing Units</td><td align="right">' + totHouseholdUnits + '</td></tr>' +
'</table>';
dom.byId("totalsInfo").innerHTML = htmlSummary;
}
function createSummaryTableFailed() {
dom.byId("totalsInfo").innerHTML = "Processing Error";
}
}); Thanks.
... View more
08-14-2015
08:27 AM
|
0
|
0
|
764
|
|
POST
|
Hi Owen, I have modified the code in my application and is working now. Could you please delete the link to the URL of my service for the GP task and the source code, and I will paste the required code for others to refer. Thanks
... View more
08-03-2015
09:44 AM
|
0
|
3
|
3526
|
|
POST
|
Thanks, Owen for modifying the code and making it work. I will look at the changes.
... View more
07-31-2015
02:40 AM
|
0
|
0
|
3526
|
|
POST
|
Owen, I have republished the GP service in WGS84 and I have also set the out spatial reference in the model's environments settings to WGS 84. I have added the require and function in the application but do not what is the actual code that would be needed I got this from the API reference something like this? require(["esri/geometry/webMercatorUtils"], function(webMercatorUtils) {var pt = Point(0, 0), // a geographic point. result; if (webMercatorUtils.canProject(pt, map)) { result = webMercatorUtils.project(pt, map) } }); Here is the updated JS fiddlle, if you could please look at that and let me know if the code looks right? http://jsfiddle.net/1snzLwcm/ I have also updated my attachments to my original post, with new REST inputs and JSON image Thank you!
... View more
07-23-2015
01:54 PM
|
0
|
6
|
3526
|
|
POST
|
Owen, Thanks again for the quick response. So you mean that if I publish the service in WGS84 and add this, in GP task input params? like this param.geometries = [webMercatorUtils.webMercatorToGeographic(feature.geometry)]; and I will not have to worry about, setOutSpatialReference to map's spatial reference?
... View more
07-23-2015
11:07 AM
|
0
|
0
|
3526
|
|
POST
|
Ionara, I noticed that you have commented out this line in your code, why was that, do we not need this or did you have to republish your GP task again with the map's SpatialReference //gp.outSpatialReference = map.spatialReference, Thanks
... View more
07-23-2015
09:39 AM
|
0
|
0
|
750
|
|
POST
|
Owen, I thought the adding this to the code while a creating the GP task object should take care of the projection and match the input to the projection of the map : gpTask.setOutSpatialReference = map.spatialReference; Let me know if you think I still need to republish the service with SR 102100. Thanks.
... View more
07-22-2015
03:00 PM
|
0
|
9
|
3526
|
|
POST
|
Hi, I am working with GP task for the first time and I am having some trouble getting it to work. I have published a synchronous GP service and I am trying to use that in a JS web application. In my application all I want is a base map and I am using a map click to draw a buffer, with a user defined distance and select all the census block points that fall within that distance and output a summary of total block points, population and housing units within the buffer, I am not using a feature layer to select features or a result map service to draw the selected points on the map, but I want to use GP task to output a summary table. What I am trying to do is, add the buffer graphics on the map and use it to input GP task result, something like in his sample which is using the user defined polygon to input the GP task, and getting a summary of population for that area. http://developers.arcgis.com/javascript/sandbox/sandbox.html?sample=gp_zonalstats The GP task is working fine, because I added This GP task to the geoprocessing widget in the web app builder and it is doing exactly like I want it: I am having trouble adding it to JS application, here is a JS fiddle with what I have so far but is not working: This is what JSON from the service looks like: I have also attached the image of the model used to publish the service and the details from the REST service directory. Any help will be greatly appreciated!!
... View more
07-21-2015
11:55 AM
|
0
|
11
|
7508
|
|
POST
|
Hi David, I came across this thread, where DSwingley of ESRI says "Feature Layers don't support a layer's labels. When you create a feature layer from a layer in a map service, you get the geometry and attributes. If you want to label features, look into using a Text Symbol." https://community.esri.com/message/48730#48730
... View more
07-21-2015
07:48 AM
|
1
|
0
|
1400
|
|
POST
|
Hi Robert, I was just working on this yesterday and I have set multiple sources in search widget and they work fine, and I get suggestions when each one is selected, depending on the field I specified in the code. I want to know is there a way to change the title for "ESRI World Geocoder" to something else which is easier for everyone to understand, like " Search" or anything else. Thanks.
... View more
07-17-2015
10:40 AM
|
0
|
6
|
4670
|
|
POST
|
This tutorial shows how to label a FeatureLayer, step 5 using Label layer and specifying the field to use as the source for labels: Labeling features client-side | Guide | ArcGIS API for JavaScript
... View more
07-15-2015
08:05 AM
|
1
|
0
|
2643
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 12-15-2015 12:26 PM | |
| 1 | 02-26-2017 10:19 AM | |
| 1 | 06-02-2015 11:44 AM | |
| 1 | 06-09-2015 07:51 AM | |
| 1 | 03-24-2015 09:48 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|