|
POST
|
This sample demonstrates how to add the search widget to a SceneView. The search widget provides a simple interface for searching features in FeatureLayers or geocoding locations with a Locator. Search allows you to enable suggestions as you type in the search box. When the search button is clicked, the search executes and the view uses goTo() to zoom to the top result.
... View more
01-03-2018
10:38 AM
|
0
|
0
|
386
|
|
POST
|
The search widget work with esri ground, but can not work with custom ground!! strange !!!
... View more
01-03-2018
08:17 AM
|
0
|
0
|
386
|
|
POST
|
no its not related to extent. I have another dem layer that it's extent has not this problem but serach widget can not add marker and zoom to
... View more
01-03-2018
08:06 AM
|
0
|
7
|
705
|
|
POST
|
my code is based on bellow link: Custom ElevationLayer - Exaggerating elevation | ArcGIS API for JavaScript 4.6
... View more
01-03-2018
07:51 AM
|
0
|
0
|
705
|
|
POST
|
did you test your suggest? I tested it and no result!!! why? var searchWidget = new Search({ sources: [{ featureLayer: new FeatureLayer("http://localhost/arcgis/rest/services/city_denver/FeatureServer/0", { outFields: ["*"] }), outFields: ["name","town"], displayField: "name", searchFields: ["name"], name: "name", placeholder: "example: denver", exactMatch: false, zoomScale:10000, maxResults:6, maxSuggestions:6, autoNavigate: true, enableSuggestions: true }], view: view }, "searchWidget"); view.ui.add(searchWidget, { position: "top-left" }); }); </script> </head> <body> <div id="searchWidget" style="direction:rtl"></div> <div id="viewDiv"></div> <span id="layerToggle"> <input type="checkbox" id="streetsLyr"> new base map </span> </body> </html>
... View more
01-03-2018
07:26 AM
|
0
|
11
|
705
|
|
POST
|
I am on local (Interanet) this sample is just to show problem for you
... View more
01-03-2018
07:23 AM
|
0
|
0
|
705
|
|
POST
|
var searchWidget = new Search({ sources: [{ featureLayer: new FeatureLayer("http://localhost/arcgis/rest/services/city_denver/FeatureServer/0", { outFields: ["*"] }), outFields: ["name","town"], displayField: "name", searchFields: ["name"], name: "name", placeholder: "example: denver", exactMatch: false, zoomScale:10000, maxResults:6, maxSuggestions:6, autoNavigate: true, enableSuggestions: true }], view: view }, "searchWidget"); view.ui.add(searchWidget, { position: "top-left" }); }); </script> </head> <body> <div id="searchWidget" style="direction:rtl"></div> <div id="viewDiv"></div> <span id="layerToggle"> <input type="checkbox" id="streetsLyr"> new base map </span> </body> </html>
... View more
01-03-2018
07:00 AM
|
0
|
14
|
798
|
|
POST
|
Thanks but I have problem after apply your suggestions too. this is my changes: var searchWidget = new Search({ sources: [{ featureLayer: new FeatureLayer("http://localhost:6080/arcgis/rest/services/city_denver/FeatureServer/0", { outFields: ["*"], }), outFields: ["name","town"], displayField: "name", searchFields: ["name"], name: "name", placeholder: "example: denver", exactMatch: false, zoomScale:10000, maxResults:6, maxSuggestions:6, autoNavigate: true, enableSuggestions: true }], view: view }, "search"); view.ui.add(searchWidget, { position: "top-left" }); }); </script> </head> <body> <div id="viewDiv"></div> <span id="layerToggle"> <input type="checkbox" id="streetsLyr"> new base map </span> </body> </html> and one more: var searchWidget = new Search({ sources: [{ featureLayer: new FeatureLayer("http://localhost:6080/arcgis/rest/services/city_denver/FeatureServer/0", { outFields: ["*"], }), outFields: ["name","town"], displayField: "name", searchFields: ["name"], name: "name", placeholder: "example: denver", exactMatch: false, zoomScale:10000, maxResults:6, maxSuggestions:6, autoNavigate: true, enableSuggestions: true }], view: view }, "searchWidget"); }); </script> </head> <body> <span id="layerToggle"> <input type="checkbox" id="streetsLyr"> new_base map </span> <div id="searchWidget" style="direction:rtl"></div> <div id="viewDiv"> </div> </body> </html>
... View more
01-02-2018
09:55 PM
|
0
|
16
|
798
|
|
POST
|
Hi this is my code with some web based map services that are temporary: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no"> <title>3d</title> <link rel="stylesheet" href="http://js.arcgis.com/4.6/esri/css/main.css"> <script src="http://js.arcgis.com/4.6/"></script> <style> html, body, #viewDiv { padding: 0; margin: 0; height: 100%; width: 100%; } #layerToggle { top: 20px; right: 20px; position: absolute; z-index: 99; background-color: white; border-radius: 8px; padding: 10px; opacity: 0.75; } #search { display: block; position: absolute; z-index: 2; top: 20px; left: 74px; } </style> <script> require([ "esri/Map", "esri/views/SceneView", "esri/layers/TileLayer", "esri/layers/ElevationLayer", "esri/layers/BaseElevationLayer", "esri/widgets/Search", "esri/layers/FeatureLayer", "dojo/dom", "dojo/on", "dojo/domReady!" ], function( Map, SceneView, TileLayer, ElevationLayer, BaseElevationLayer, Search, FeatureLayer, dom, on ) { var ExaggeratedElevationLayer = BaseElevationLayer.createSubclass({ properties: { exaggeration: 2.5 }, // The load() method is called when the layer is added to the map // prior to it being rendered in the view. load: function() { this._elevation = new ElevationLayer({ url: "http://localhost:6080/arcgis/rest/services/dem_denver/ImageServer" }); // wait for the elevation layer to load before resolving load() this.addResolvingPromise(this._elevation.load()); }, // Fetches the tile(s) visible in the view fetchTile: function(level, row, col) { // calls fetchTile() on the elevationlayer for the tiles // visible in the view return this._elevation.fetchTile(level, row, col) .then(function(data) { var exaggeration = this.exaggeration; // `data` is an object that contains the // the width of the tile in pixels, // the height of the tile in pixels, // and the values of each pixel data.values.forEach(function(value, index, values) { // each value represents an elevation sample for the // given pixel position in the tile. Multiply this // by the exaggeration value values[index] = value * exaggeration; }); return data; }.bind(this)); } }); /***************************************************************** * Create two TileLayer instances. One pointing to a * cached map service depicting U.S. male population and the other * pointing to a layer of roads and highways. *****************************************************************/ var transportationLyr = new TileLayer({ url: "http://localhost:6080/arcgis/rest/services/hill_denver2/MapServer", // This property can be used to uniquely identify the layer id: "streets", visible: false }); var housingLyr = new TileLayer({ url: "http://localhost:6080/arcgis/rest/services/hill_denver/MapServer", id: "ny-housing", opacity: 0.3 }); /***************************************************************** * Layers may be added to the map in the map's constructor *****************************************************************/ var map = new Map({ ground: { layers: [ new ExaggeratedElevationLayer() ] } }); /***************************************************************** * Or they may be added to the map using map.add() *****************************************************************/ map.add(transportationLyr); var view = new SceneView({ container: "viewDiv", map: map }); map.add(housingLyr); /***************************************************************** * The map handles the layers' data while the view and layer views * take care of renderering the layers *****************************************************************/ view.on("layerview-create", function(event) { if (event.layer.id === "ny-housing") { // Explore the properties of the population layer's layer view here console.log("LayerView for male population created!", event.layerView); } if (event.layer.id === "streets") { // Explore the properties of the transportation layer's layer view here // Explore the properties of the transportation layer's layer view here console.log("LayerView for streets created!", event.layerView); } }); /***************************************************************** * Layers are promises that resolve when loaded, or when all their * properties may be accessed. Once the population layer has loaded, * the view will animate to it's initial extent. *****************************************************************/ view.when(function() { housingLyr.when(function() { view.goTo(housingLyr.fullExtent); }); }); var streetsLyrToggle = dom.byId("streetsLyr"); /***************************************************************** * The visible property on the layer can be used to toggle the * layer's visibility in the view. When the visibility is turned off * the layer is still part of the map, which means you can access * its properties and perform analysis even though it isn't visible. *******************************************************************/ on(streetsLyrToggle, "change", function() { transportationLyr.visible = streetsLyrToggle.checked; }); var search = new Search({ sources: [{ featureLayer: new FeatureLayer("http://localhost:6080/arcgis/rest/services/city_denver/FeatureServer/0", { outFields: ["*"], }), outFields: ["name","town"], displayField: "name", searchFields: ["name"], name: "name", placeholder: "example: denver", exactMatch: false, zoomScale:10000, maxResults:6, maxSuggestions:6, autoNavigate: true, enableSuggestions: true }], view: view }, "search"); search.startup(); view.ui.add(searchWidget, { position: "top-right" }); }); </script> </head> <body> <div id="search" style="direction:rtl"></div> <div id="viewDiv"></div> <span id="layerToggle"> <input type="checkbox" id="streetsLyr"> new base map </span> </body> </html>
... View more
01-02-2018
11:27 AM
|
0
|
18
|
798
|
|
POST
|
No error, I cehcked firebog, this is response of search tools in web console: {"objectIdFieldName":"OBJECTID","globalIdFieldName":"","geometryType":"esriGeometryPoint","spatialReference":{"wkid":102100,"latestWkid":3857},"fields":[{"name":"town","alias":"town","type":"esriFieldTypeString","length":50}],"features":[{"attributes":{"town":"Denver"},"geometry":{"x": -11683227.6,"y":4837619.6}}]}
... View more
01-02-2018
08:38 AM
|
0
|
20
|
798
|
|
POST
|
I can use my base map as 3d, but when I use my base map the search widget dont work
... View more
01-01-2018
10:15 AM
|
0
|
22
|
798
|
|
POST
|
I can use search widget with esri ground and base map, but I have problem with my own
... View more
01-01-2018
08:45 AM
|
0
|
24
|
1281
|
|
POST
|
All of them are 102100 wkid and have cash. my feature service and my ground are on 10.5 and my basemap is on 10.2.2 What should I do?
... View more
01-01-2018
07:18 AM
|
0
|
26
|
1281
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 11-21-2017 07:19 AM | |
| 1 | 08-08-2018 11:09 PM | |
| 1 | 11-24-2017 03:46 AM | |
| 1 | 10-19-2014 03:54 AM |
| Online Status |
Offline
|
| Date Last Visited |
07-28-2021
04:28 PM
|