|
POST
|
I am updating an old flex application to WAB 2.8 and in configuring the identify widget, I cannot get it to see the layer from the eSearch results. I am using 4 map service REST layers for the search, and I have 7 other REST service layers that are being used as base layers, and connected through the Local Layer widget. All of these layers are from the same map service. The identify widget can see all of the layers connected through the Local layer widget (visible in layer list), but cannot see the query results from any of the layers that are configured in the eSearch widget. I did check the box in the widget config to 'Add Result as Operational Layer' and the search results show up on the map as expected. I compared the config settings from the xml file of the older flex app to the new file and they are identical. Not sure what I am missing, but the identify widget in the old flexviewer app can see the results from the eSearch just fine. By the way, both apps, old and new, are using the exact same map service, so I am fairly certain the issue is not with the map service, but something to do with the eSearch widget config. Any ideas of what I might be missing? Thanks! I almost forgot. When I do get results from one of the base layers, 'No Results Found' still shows at the top of the Results pane.
... View more
05-25-2018
06:51 AM
|
0
|
2
|
951
|
|
POST
|
The second option worked perfectly Robert. Thank you
... View more
05-22-2018
09:45 AM
|
0
|
1
|
794
|
|
POST
|
Just wandering if it was possible to locate the Full Screen widget to the widget pool instead of having it appear in the top right corner of the map. I have a panel widget that opens at startup, and it covers the Full Screen widget, so I need to relocate it. I tried placing the widget in the widget pool of the config file, but this isn't working. It just places an icon in the header controller that doesn't do anything. I know I can change the position of the Full Screen widget to another location on the map, but the top right just makes the most sense, so it would be nice the header controller would be the best place.
... View more
05-22-2018
06:28 AM
|
0
|
3
|
1035
|
|
POST
|
Robert, It looks like that may be working right now, however I am fairly certain I tried that before with no success. I will let you know if anything changes. Thanks!
... View more
04-18-2018
09:44 AM
|
0
|
0
|
942
|
|
POST
|
I want to know if anyone else has had an issue with clearing the cache in explorer. I had to make some minor changes in a widget.js file because of IE incompatibility issues, but when I cleared the cache and restarted IE, the same problem persists and the console shows the old code!! I tried the published procedure, but it is not working. Driving me nuts! lol
... View more
04-18-2018
08:10 AM
|
0
|
2
|
1339
|
|
POST
|
Thanks for that suggestion Robert. I couldn't really find a good way to check to see if location services are enabled on a mobile device. It seems that simply using the if statement from above does nothing. Here is what I came up with and it works so-so, but is susceptible to false error messages since it relies on the phones connection and can time out. My reasoned that if I attempted to get the current latitude when the widget loads and it failed, I could assume that the devices location services are not enabled. I think the best method to test for this would be to query the phone settings, but I don't know how you would go about doing that especially since every device is different. if (window.appInfo.isRunInMobile) {
var content = this.nls.noGPSMobileContent;
function displayMessages(msg) {
if (this.widgetErrorNode) {
domAttr.set(this.widgetErrorNode, "innerHTML", msg);
}
showMessage(msg);
}
function showMessage(msg) {
var alertMessage = new Message({
message: msg
});
alertMessage.message = msg;
}
var latitude = null;
navigator.geolocation.getCurrentPosition(function (position) {
latitude = position.coords.latitude;
console.log("latitude", latitude);
}, function (error) {
switch(error.code) {
case error.PERMISSION_DENIED:
displayMessages("User denied the request for Geolocation.");
break;
case error.POSITION_UNAVAILABLE:
displayMessages("Location information is unavailable.");
break;
case error.TIMEOUT:
displayMessages("The request to get user location timed out. Make sure your location services are enabled");
break;
case error.UNKNOWN_ERROR:
displayMessages("An unknown error occurred.");
break;
}
}, {
timeout: 10000,
enableHighAccuracy: true
});
}
... View more
03-20-2018
07:17 AM
|
0
|
0
|
2692
|
|
POST
|
Does anyone know a good way to check to see if location services are enabled/disabled on a mobile device? I have tried using the following with no luck: var isMobile = window.matchMedia("only screen and (max-width: 760px)");
if (isMobile.matches) {
if (!window.navigator.geolocation) {
this._displayWidgetError(this.nls.noGPSMobileContent);
}
}
I am just trying to alert the user with a popup that states that location services must be enabled to use the 'My Location' tool in the widget. I tried locating the above code in the startup() function, as well as the function where the locate button is initiated, and finally in the function that gets called when the button is clicked, but to no avail.. I am just wandering if there is a better method to do this for mobile devices, but haven't found much via Google.
... View more
03-07-2018
12:37 PM
|
0
|
2
|
3023
|
|
POST
|
Yes, when you create a new LocateButton, you will get a button with all of the css similar to the 'mylocation' button. You have to create a space for the new button, so just create a <div> in your HTML file with an attach point to hold the button. I have two buttons on my NearMe widget, so my HTML looks like this: <div class="buttonContainer">
<div class="esriCTSelectLocationDiv esriCTImgButtons esriCTSelectLocation esriCTHidden" data-dojo-attach-point="selectLocation"
value aria-haspopup="true" title="Locate on Map"></div>
<div class="esriCTLocateHeader">${nls.locateHeaderText}</div>
<div class="esriCTGeoLocationDiv esriCTGeoLocate" data-dojo-attach-point="myLocation"></div>
<div class="esriCTMyLocationHeader">${nls.myLocationHeaderText}</div>
</div> Hope this helps
... View more
02-27-2018
05:36 AM
|
0
|
0
|
1540
|
|
POST
|
Aster, I just called the _geoLocated function inside the _initWidgetComponents,, along with all of the other NearMe widget components. _initWidgetComponents: function () {
var featureLayer = new FeatureLayer(this.config.searchLayers[0].url);
//create graphic layer to add buffers
this._bufferGraphicLayer = new GraphicsLayer();
this.map.addLayer(this._bufferGraphicLayer);
//create graphic layer to add search location graphic
this._highlightGraphicsLayer = new GraphicsLayer();
this.map.addLayer(this._highlightGraphicsLayer);
//Create search widget
this._createSearchInstance();
//initialize buffer distance slider
this._createSlider();
// initialize legend
this._createLegendOnLoad(featureLayer);
//initialize loading indicator
this._initLoading();
//initialize layer list widget
this._initLayerList();
// show bufferslider widget if configured layers
// are not polygon type and intersect polygon flag is disabled
this._setBufferSliderVisiblity();
//initialize geo locate butto
this._geoLocateButton();
this._connectGeoLocateHandler();
//connect set location tool button handler if tool is configured
if (this.config.showLocationTool) {
this._connectSelectLocationHandler();
}
//create tool-tip to be shown on map move
this._mapTooltip = domConstruct.create("div", {
"class": "tooltip",
"innerHTML": this.nls.selectLocationToolTip
}, this.map.container);
domStyle.set(this._mapTooltip, "position", "fixed");
domStyle.set(this._mapTooltip, "display", "none");
//reset the widget's components on window resize and on widget open
this.own(on(window, 'resize', lang.hitch(this, this._onWindowResize)));
},
... View more
02-26-2018
01:34 PM
|
0
|
1
|
1540
|
|
POST
|
Got it to work, I just went back to what I was doing before and replaced 'originCoords' with the actual coordinates. Then I used a global variable to hold the original Desc content and reset whenever there is another 'onClick' or position change event. There is probably a more efficient method, but I can always change it later. _initWorkflow: function (evt) {
this.config.searchLayers[0].popupInfo.description = this._popupDesc; //global var
//console.log("global popupDesc: ", this._popupDesc);
var selectedFeature, horzontalSliderNode;
//clear previous results
this._clearResults(true);
//get selected feature
selectedFeature = this._getSelectedFeatureFromResult(evt);
//get and configure selectedFeature lat/long for google directions
var normalizedVal = webMercatorUtils.xyToLngLat(selectedFeature.geometry.x, selectedFeature.geometry.y);
_originLongitude = normalizedVal[0];
_originLatitude = normalizedVal[1];
var originCoords = _originLatitude + ',' + _originLongitude;
var result = this._popupDesc.replace(new RegExp ('originCoords', 'i'), originCoords);
this.config.searchLayers[0].popupInfo.description = result;
... View more
02-20-2018
08:29 AM
|
0
|
0
|
1030
|
|
POST
|
Robert, The {Latitude},{Longitude} in the Desc are attribute fields in the feature class, and are capturing the destination coordinates for Google maps. What I want to do is capture the origin coordinates taken from the users location, or from a click on the map to insert into Google maps 'starting point' in the directions pane. I have everything set up correctly to capture the coordinates, I am just having trouble figuring out how to insert the coordinates dynamically into a variable in the href link located in the config file. I hope this makes sense, and I know there is a fairly straight forward way to do this, but it is escaping me! Using the replace() method actually works, but as you said I am replacing a string, not a variable, so there is no easy way to update the coordinates whenever someone clicks the map again. I can easily create a 'key' in the config file that is null, and can be easily accessed and updated whenever the origin position changes on the map, but I don't know how to 'connect' this to a variable in the href link further down in the config file. That way the href link would update as the origin coordinate key updates. I am about 90% certain this is just about finding the right syntax, but easier said than done! I am working on the indexOf angle right now, but I still need to use a variable or placeholder in the href link so I can clear in out/redefine it whenever there is another click event, or the origin position changes. Thanks!
... View more
02-20-2018
06:38 AM
|
0
|
0
|
1030
|
|
POST
|
I have a details panel in my nearme widget that shows details for a particular facility which are taken from the layer attributes. A 'directions' link is located at the bottom of the details panel, so that when clicked, Google Maps opens in another browser window. As of right now, the destination autofills with the coordinates of the facility in detail, which grabs the coordinates from the 'latitude' and 'longitude' fields in the table. It is proving to be more of a challenge to get the 'origin' to autofill, since I need to grab these coordinates from the widget.js file dynamically (which is not the issue), and then insert them into the popup 'description' in the config.json file (this is proving more difficult). Below is the code from the config file and the js file. The "description" is where I need to insert the origin coordinates. I know the href link works, because I tested in by hard coding the origin coordinates. I have tried coming at this from two ways. The first, by inserting a key/value into the config file for the originLat and originLong and then grabbing the coordinates from the 'selectedFeature, and inserting them into the config file values. This is simple enough, but I don't know how the grab them and place them into the href link in the description. I tried using a placeholder, but I cannot find the right syntax, and I am not sure that it is possible. I also tried placing the coordinates directly into the href link by using the replace() method, but it isn't working. I think this has to do with the fact that the entire description is wrapped in quotes, and I think replace() will only work on the entire string. Am I going about this the wrong way? I am open to any suggestions! //nearme widget config.json
{
"fontColor": "#000000",
"searchLayers": [
{
"originLatitude": null,
"originLongitude": null,
"popupInfo": {
"title": "{Facility_Name}",
"fieldInfos": [
{
"fieldName": "OBJECTID",
"label": "OBJECTID",
"tooltip": "",
"visible": false,
"stringFieldOption": "textbox"
},
{
"fieldName": "Shape",
"label": "Shape",
"tooltip": "",
"visible": false,
"stringFieldOption": "textbox"
},
{
"fieldName": "Longitude",
"label": "Longitude",
"tooltip": "",
"visible": false,
"format": {
"places": 2,
"digitSeparator": true
},
"stringFieldOption": "textbox"
},
{
"fieldName": "Latitude",
"label": "Latitude",
"tooltip": "",
"visible": false,
"format": {
"places": 2,
"digitSeparator": true
},
"stringFieldOption": "textbox"
},
],
"description": "<table width='100%'>\n<tbody>\n<tr><td width='50%'>Street Address</td><td>{popup_Address}</td></tr>\n<tr><td width='50%'>City</td><td>{City}</td></tr>\n<tr><td width='50%'>State</td><td>{ST}</td></tr>\n<tr><td
width='50%'>Zip Code</td><td>{Zip_Code}</td></tr>\n<tr><td width='50%'>Permit Type</td><td>{Permit_Type}</td></tr>\n<tr><td width='50%'>Comments</td><td>{Comments}</td></tr>\n<tr><td width='50%'>Phone</td><td><a href=\"tel:{Phone}\">{Phone}</a></td></tr>\n<tr><td width='50%'>Alternate Phone</td><td><a href=\"tel:{Alt_Phone}\">{Alt_Phone}</a></td></tr>\n<tr><td colspan='2'><br /><a href='https://www.google.com/maps?saddr= originCoordsGoHere &daddr={Latitude},{Longitude}'>Directions</a>\n</td>\n</tr>\n</tbody>\n</table>",
"showAttachments": false,
"mediaInfos": []
//code from nearme widget.js file
//method 1
_initWorkflow: function (evt) {
var selectedFeature, horzontalSliderNode;
//clear previous results
this._clearResults(true);
//get selected feature
selectedFeature = this._getSelectedFeatureFromResult(evt);
//console.log("selectedFeature = ", selectedFeature);
//get and configure selectedFeature lat/long for google directions
var normalizedVal = webMercatorUtils.xyToLngLat(selectedFeature.geometry.x, selectedFeature.geometry.y);
_originLongitude = normalizedVal[0];
_originLatitude = normalizedVal[1];
this.config.originLongitude = _originLongitude;
this.config.originLatitude = _originLatitude;
//method 2
_initWorkflow: function (evt) {
var selectedFeature, horzontalSliderNode;
//clear previous results
this._clearResults(true);
//get selected feature
selectedFeature = this._getSelectedFeatureFromResult(evt);
var jsonDesc = this.config.searchLayers[0].popupInfo.description;
if (jsonDesc.includes("originCoords")) {
alert("originCoords found!");
var originCoords = _originLatitude + ',' + _originLongitude;
jsonDesc.replace("originCoords", "this is not working");
} else {
alert("originCoords not found");
}
... View more
02-19-2018
06:24 AM
|
0
|
3
|
1161
|
|
POST
|
Thanks Robert. Once again you set me on the right track! Here is the working code in case anyone else is interested. _geoLocateButton: function() {
if(this._zoomScale === null) {
var zoomScale = parseInt(this._bufferParams.BufferDistance)*1609;
} else {
var zoomScale = this._zoomScale;
}
this._myLocation = new LocateButton({
map: this.map,
scale: zoomScale,
highlightLocation: false,
useTracking: false,
"class": "esriCTGeoLocate"
}, domConstruct.create("div", {}, this.myLocation));
this._myLocation.startup();
},
_connectGeoLocateHandler: function () {
//handle select location button click event
this.own(this._myLocation.on('locate', lang.hitch(this, this._onGeoLocate)));
},
_onGeoLocate: function (evt) {
this.map.infoWindow.hide();
if (this._searchInstance) {
this._searchInstance.clearSearchText();
}
var geometry = evt.graphic
console.log(geometry);
this._initWorkflow({
"feature": geometry,
"isFeatureFromMapClick": false
});
},
... View more
02-14-2018
07:27 AM
|
0
|
4
|
1540
|
|
POST
|
Ok, I have to ask a very stupid question because this is frustrating me and I know it can't be that hard. I added the LocateButton to the 'NearMe' widget so anyone who needs to do a search for facilities in his/her area can search from their current gps position. Simple enough, accept that in order to tie the button to a search, I need to create a buffer around the gps position, only I can't figure out how to access the actual coordinates the My Location widgets zooms to. I won't post all of the code, just the snippets I added to the nearme widget for the LocateButton to work. _geoLocateButton: function() {
if(this._zoomScale === null) {
var zoomScale = parseInt(this._bufferParams.BufferDistance)*1609;
} else {
var zoomScale = this._zoomScale;
}
console.log("zoomScale =", zoomScale);
this._myLocation = new LocateButton({
map: this.map,
scale: zoomScale,
highlightLocation: false,
useTracking: false,
"class": "esriCTGeoLocate"
}, domConstruct.create("div", {}, this.myLocation));
this._myLocation.startup();
},
_connectGeoLocateHandler: function () {
//handle select location button click event
on(dojo.query('.zoomLocateButton'), 'click', lang.hitch(this, function() {
this._onGeoLocateClick();
}));
},
_onGeoLocateClick: function (evt) {
this.map.infoWindow.hide();
if (this._searchInstance) {
this._searchInstance.clearSearchText();
}
//the function below needs a point feature produced from an event. I may be wrong,
// but the LocateButton doesn't seem to output a point 'feature'. It can be
// configured to 'highlight' the zoomed to location, but is that the same thing?
// I guess the question is, how to I take the 'result' of LocateButton and turn it
// into a usable point feature that can be passed to the _initWorkflow(evt) function?
this._initWorkflow(evt);
},
... View more
02-13-2018
08:29 AM
|
0
|
7
|
1791
|
|
POST
|
Wow, you know I have been doing this job for about a year now, and I don't think I ever looked at the default splash widget, I have always worked with our custom splash widget. I guess I just assumed they were virtually the same except for a few modifications. Things can get a little confusing when you are working with widgets that have been modified by different folks, everyone has his/her own way of doing things. Sorry about the confusion! I will mark this as answered since I found the work-around and I hope I didn't waste too much of your time!
... View more
01-30-2018
01:44 PM
|
0
|
0
|
287
|
| Title | Kudos | Posted |
|---|---|---|
| 8 | 10-28-2025 10:15 AM | |
| 2 | 10-14-2025 06:36 AM | |
| 1 | 09-16-2022 09:31 AM | |
| 1 | 06-13-2024 05:45 AM | |
| 1 | 06-26-2025 06:28 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-06-2025
04:20 AM
|