|
POST
|
yea the answer for the link that I posted was the same var searchWidget = new Search{view: view1})
function mySubmitFunction () {
let element = document.getElementById("YourInputID")
let address = element.value
searchWidget.search(address).then((results) => {
console.log("Search widget results :", results)
})
})
... View more
03-20-2020
01:16 PM
|
0
|
0
|
1263
|
|
POST
|
just saw this....looks promising https://community.esri.com/thread/197592-parse-search-widget-to-a-html-search-form
... View more
03-20-2020
09:52 AM
|
0
|
2
|
1263
|
|
POST
|
I have a search widget in my app. After the search widget address is applied I have it run some code to return features within a certain distance. This all works great.... // SEARCH WIDGET
var searchWidget = new Search({
view: view,
popupEnabled: false
});
searchWidget.on("select-result", function () {
searchRadius();
}); But what I want to do is pass the Search Widget an Address not manually enter it in the widget. I want to read from a table and pass the individual addresses to the search widget and get the result from the code that have written. Can I pass the searchWidget an address? If so an examples out there?
... View more
03-20-2020
09:47 AM
|
0
|
3
|
1340
|
|
POST
|
Not sure if I have to correct group here... I am writing a GP Service that will accept a single parameter (address) this parameter will then be used to select all features within 50 miles and return a field value for each result in json or array of some sort. My question is How do I call this service from .NET C#, get the result and write the result to a variable that I can see in the console....
... View more
03-20-2020
08:49 AM
|
0
|
0
|
632
|
|
POST
|
Making great progress....will be posting my solution in the next day or so...Undral thank you for your guidance and thoughts.... weird transition from 3.x to 4.x
... View more
03-18-2020
04:11 PM
|
0
|
0
|
777
|
|
POST
|
instead of view.extent do I need to grab the center of the map or something.
... View more
03-18-2020
08:18 AM
|
0
|
0
|
4314
|
|
POST
|
this is what I am doing right now.... When the app loads it is supposed to locate all the WMAs within 500 miles (ridiculous number for testing). BUT it seems to only return what is in the current map view. THEN when you search an address (Toano, VA) it zooms there and then re-queries and returns the WMAs that are again within 500 miles...but AGAIN it seems to only return within the map view. If I change the distance to 1 mile or 500 miles I dont get a different return Trying to figure out what I am doing that is not applying the distance and units parameters... Edit fiddle - JSFiddle - Code Playground
... View more
03-18-2020
08:13 AM
|
0
|
1
|
4314
|
|
POST
|
I am shuffling a couple different approaches here....and getting very confused....I thank you for your patience... My problem is I cannot combine the two solutions. I have below....I want to use the first below but need a way to specify the distance....I cant figure that part out....combining the two solutions. I do not want to drive this from a map click.... This example works well with the geocoder where I can type in an address and when the map zooms it queries the features in the maps extent. OR I can simply pan the map and it reruns the query... This gives me a list of the features in the map that I can interact with.... If I can just set a parameter here I would be all set. ISSUES: I need to specify the distance in miles. I cannot figure that out. view.whenLayerView(featureLayer).then(function (layerView) {
// wait for the layer view to finish updating
layerView.watch("updating", function (value) {
if (!value) {
// query all the features available for drawing.
layerView
.queryFeatures({
geometry: view.extent,
returnGeometry: true,
orderByFields: ["WMA_Name"]
})
.then(function (results) {
graphics = results.features;
const fragment = document.createDocumentFragment();
var nameArray = []
graphics.forEach(function (result, index) {
const attributes = result.attributes;
const name = attributes.WMA_NAME;
nameArray.push(name);
// Create a list zip codes in NY
const li = document.createElement("li");
li.classList.add("panel-result");
li.tabIndex = 0;
li.setAttribute("data-result-id", index);
li.textContent = name;
fragment.appendChild(li);
});
alert("WMAs: " + nameArray);
// Empty the current list
listNode.innerHTML = "";
listNode.appendChild(fragment);
})
.catch(function (error) {
console.error("query failed: ", error);
//alert("query failed: ", error);
});
} // END OF VALUE ABOVE
}); // END OF LAYER WATCH
watchUtils.whenFalseOnce(layerView, "updating", function (val) {
// Query layer view statistics as the user clicks
// or drags the pointer across the view.
//view.on(["click", "drag"], function (event) {
view.on(["click"], function (event) {
// disables navigation by pointer drag
event.stopPropagation();
}); // END OF VIEW ON CLICK
}); // END OF WATCH UTILS
}); 2nd Solution I can use a view Map Click as such and specify the distance like the below view.on("click", function (event) {
var query = new Query();
query.geometry = event.mapPoint; // obtained from a view click event
query.distance = 10;
query.units = "miles";
query.spatialRelationship = "intersects";
view.whenLayerView(featureLayer).then(function (layerView) {
watchUtils.whenNotOnce(layerView, "updating")
.then(function () {
return layerView.queryObjectIds(query);
})
.then(function (ids) {
//console.log(ids); // prints the ids of the client-side
alert(ids);
});
});
});
... View more
03-17-2020
02:18 PM
|
0
|
0
|
4314
|
|
POST
|
I am doing this....is there a way to set a parameter to query in miles and not the view extent\ Where can I find a list of the available parameters for the .queryFeatures? layerView.watch("updating", function(value) {
if (!value) {
// query all the features available for drawing.
layerView
.queryFeatures({
geometry: view.extent,
returnGeometry: true,
orderByFields: ["WMA_Name"]
})
.then(function(results) {
graphics = results.features;
const fragment = document.createDocumentFragment();
graphics.forEach(function(result, index) {
const attributes = result.attributes;
const name = attributes.WMA_NAME;
... View more
03-17-2020
11:31 AM
|
0
|
0
|
4314
|
|
POST
|
This seems more logical BUT what I need is two fold... I want to retain the map click But I also want the user to type in an address, geocode it and use those XY coordinates So they can click and it does its thing. Or they can choose to type in an address and wuen they choose which one they want it automatically zooms to that location and uses that XY to fuel the query. Thoughts on how to add that? Can I just push an XY location here? query.geometry = view.toMap(event); If so what would the syntax look like? EDIT: Second question.... how do I remove the web map stuff....I want to use a straight feature layer RestEP
... View more
03-17-2020
09:22 AM
|
0
|
0
|
4314
|
|
POST
|
I am looking for a down and dirty example of taking an XY coordinate from user and running a buffer (set distance), then selecting all the poly features that touch or are within the buffer..... Any examples out there?
... View more
03-16-2020
12:11 PM
|
0
|
12
|
5189
|
|
POST
|
Fantastic....had to modify your code a bit, placing the var options= {} inside the click event in order to get it to read my input box contained the address to geocode... just a different workflow as I am not defaulting my address THANK YOU FOR YOUR INSIGHT AND HELP.....very appreciated. /* SNIP */
<div>
<h2>Using esri/request</h2>
<button class="button" id="btnQuery1" onclick="myFunction_Geocode()" >Populate Address</button>
<input id="inputUrl" name="esrirequest" type="text" value="" >
<input id="esriresult" name="esriresult" type="text" >
<button class="button" id="btnQuery2">Make Request</button>
</div>
<pre id="resultsDiv" class="resultsdivgeocode"></pre>
/* SNIP */ // SNIP
esriConfig.request.proxyUrl = 'proxy/proxy.ashx';
var resultsDiv = document.getElementById("resultsDiv");
var input = document.getElementById("inputUrl");
// Make the request on a button click using the value of the 'inputUrl' text.
on(btnQuery2, "click", function () {
var requestinputvalue = input.value;
var options = {
query: {
SingleLine: requestinputvalue,
outFields: "*",
forStorage: false,
f: 'pjson'
},
responseType: 'json'
};
alert(JSON.stringify(options));
var url = 'http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/findAddressCandidates';
esriRequest(url, options).then(function (response) {
// ALERT COMPLETE JSON RESPONCE FOR GEOCODING
console.log('response', response);
alert(JSON.stringify(response));
// ADDRESS
var address = response.data.candidates[0].address;
// X COORDINATE
var vXCoord = JSON.stringify(response.data.candidates[0].location.x);
// Y COORDINATE
var vYCoord = JSON.stringify(response.data.candidates[0].location.y);
// RETURN COMPLETE JSON FILE WITH GEOCODIN RESULTS
var responseJSON = JSON.stringify(response, null, 2);
resultsDiv.innerHTML = responseJSON;
// CREATE ARRAY FROM ADDRESS AND SPLIT INTO VARIABLES
var array = address.split(',', 4);
var array0 = (array[0]);
var array1 = (array[1]);
var array2 = (array[2]);
var array3 = parseInt(array[3]);
// UPDATE WEB PAGE INPUT BOXES
document.getElementsByName('idstreet')[0].value = (array0);
document.getElementsByName('idcity')[0].value = (array1);
document.getElementsByName('idstate')[0].value = (array2);
document.getElementsByName('idzip')[0].value = (array3);
document.getElementsByName('idx')[0].value = vXCoord;
document.getElementsByName('idy')[0].value = vYCoord;
});
});
// SNIP
... View more
02-28-2020
07:24 AM
|
0
|
0
|
1686
|
|
POST
|
Dang I was dancing all around the solution...thank you much last question....when I use the example above (js fiddle) and click on the map and it gives me decimal degrees... When I use the input box to geocode the entered address it appears to be returning the coordinates in Web Aux Mercator? Is there a parameter I can set to return the coordinates into decimal degrees?
... View more
02-27-2020
01:41 PM
|
0
|
2
|
2606
|
|
POST
|
I changed it to SEARCH-COMPLETE and I can get the number of results and the search term but I cant find out how to read the XY coordinates and the Match Address from the actual geocode? Anyone? // Search widget
var search = new Search({
view: view,
popupEnabled: false
});
search.on("search-complete", function (event) {
testnumber = event.numResults;
alert(testnumber);
//test = JSON.stringify(event.searchTerm);
test = event.searchTerm;
alert(test);
});
... View more
02-27-2020
12:27 PM
|
0
|
4
|
2606
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-20-2018 11:09 AM | |
| 1 | 09-10-2018 06:26 AM | |
| 1 | 09-15-2022 11:02 AM | |
| 1 | 05-21-2021 07:35 AM | |
| 1 | 08-09-2022 12:39 PM |
| Online Status |
Offline
|
| Date Last Visited |
09-19-2022
09:23 PM
|