Any way of performing search (search widget) without displaying a map? Something like this "Find" sample:
Query data without a map | ArcGIS API for JavaScript 3.30
When I remove the map, it didn't work. Please share your thoughts.
Solved! Go to Solution.
Gotcha. Ok, if I understand now, you are basically just wanting to do some geocoding. If you don't want to use a map, then you won't want to use the Search widget. As I see it, you could use the Locator Task for this.
https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-Locator.html#
However, I do want to point out that Geocoding is a sometimes free and sometimes pay service. If you use the ArcGIS World Geocoding Service in a pay manner, then please review the instructions here:
https://developers.arcgis.com/rest/geocode/api-reference/geocoding-free-vs-paid.htm
If you have your own service to consume, or will be using the free operations explained in the link above, then here is a working sample as a proof of concept to get you started.
https://codepen.io/noash/pen/XWWdpge
The 3x sample that you posted a link to above does querying on a feature layer, which would be a different workflow, but one that you could implement yourself with the Query and QueryTask at 4.x and the logic of the CodePen sample.
You could try just using the SearchViewModel
SearchViewModel | ArcGIS API for JavaScript 4.13
And there's a similar 4x sample to that 3x sample that uses the Find Task
Basically my question is how to implement search with out a map being displayed like in that Query data without map sample. Any sample scripts?
Sorry, I'm not sure how to help here.
Is the goal to use the Search widget without a map? This widget requires a View, and the point of having a View is to view and interact with a map. I don't think that's possible to do.
Search | ArcGIS API for JavaScript 4.13
Or is the goal to query features from a layer similar to the 3x sample?
You can implement the same logic with the Query and QueryTask at 4.x.
Query | ArcGIS API for JavaScript 4.13
QueryTask | ArcGIS API for JavaScript 4.13
Or is the goal to do some geocoding and get the results from search locations without a map? Then you could use the SearchViewModel's search() method.
The goal is to do some geocoding and get the result with out a map i.e something which is done in this sample:
Gotcha. Ok, if I understand now, you are basically just wanting to do some geocoding. If you don't want to use a map, then you won't want to use the Search widget. As I see it, you could use the Locator Task for this.
https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-Locator.html#
However, I do want to point out that Geocoding is a sometimes free and sometimes pay service. If you use the ArcGIS World Geocoding Service in a pay manner, then please review the instructions here:
https://developers.arcgis.com/rest/geocode/api-reference/geocoding-free-vs-paid.htm
If you have your own service to consume, or will be using the free operations explained in the link above, then here is a working sample as a proof of concept to get you started.
https://codepen.io/noash/pen/XWWdpge
The 3x sample that you posted a link to above does querying on a feature layer, which would be a different workflow, but one that you could implement yourself with the Query and QueryTask at 4.x and the logic of the CodePen sample.
Perfect- Thanks
Do I need to have map enabled, if I need to use this location result for intersecting on another feature layer and extract an attribute out of that layer? Any samples?
Can you please provide an example for suggestLocations
Looking for an example like https://codepen.io/noash/pen/XWWdpge
I don't want a map but need character by character auto complete suggestions? Thanks.
I think there is a solution in this other thread: https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/search-widget-functionality-witho...
Here is another option: https://codepen.io/gavinr/pen/oNaYawp