|
POST
|
Here's a little hack that might get you in the right direction: <!DOCTYPE html>
<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
<title>ArcGIS API for JavaScript | Search widget with multiple sources</title>
<link rel="stylesheet" href="https://js.arcgis.com/3.23/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="https://js.arcgis.com/3.23/esri/css/esri.css">
<style>
html,
body,
#map {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
#search {
display: block;
position: absolute;
z-index: 2;
top: 20px;
left: 74px;
}
.searchMenu.suggestionsMenu>div>ul>li {
display: block;
white-space:pre;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://js.arcgis.com/3.23/"></script>
<script>
require([
"esri/map",
"esri/dijit/Search",
"esri/layers/FeatureLayer",
"esri/InfoTemplate",
"dojo/on",
"dojo/domReady!"
], function(Map, Search, FeatureLayer, InfoTemplate, on) {
var map = new Map("map", {
basemap: "gray",
center: [-97, 38], // lon, lat
zoom: 5
});
var search = new Search({
enableButtonMode: true, //this enables the search widget to display as a single button
enableLabel: false,
enableInfoWindow: true,
showInfoWindowOnSelect: false,
map: map
}, "search");
var sources = search.get("sources");
//Push the sources used to search, by default the ArcGIS Online World geocoder is included. In addition there is a feature layer of US congressional districts. The districts search is set up to find the "DISTRICTID". Also, a feature layer of senator information is set up to find based on the senator name.
sources.push({
featureLayer: new FeatureLayer("https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/CongressionalDistricts/FeatureServer/0"),
suggestionTemplate: "Name: ${NAME}",
searchFields: ["DISTRICTID"],
displayField: "DISTRICTID",
exactMatch: false,
outFields: ["DISTRICTID", "NAME", "PARTY"],
name: "Congressional Districts",
placeholder: "3708",
maxResults: 6,
maxSuggestions: 6,
//Create an InfoTemplate and include three fields
infoTemplate: new InfoTemplate("Congressional District",
"District ID: ${DISTRICTID}</br>Name: ${NAME}</br>Party Affiliation: ${PARTY}"
),
enableSuggestions: true,
minCharacters: 0
});
sources.push({
featureLayer: new FeatureLayer("https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/US_Senators/FeatureServer/0"),
searchFields: ["Name"],
displayField: "Name",
exactMatch: false,
name: "Senator",
outFields: ["*"],
placeholder: "Senator name",
maxResults: 6,
maxSuggestions: 6,
//Create an InfoTemplate
infoTemplate: new InfoTemplate("Senator information",
"Name: ${Name}</br>State: ${State}</br>Party Affiliation: ${Party}</br>Phone No: ${Phone_Number}<br><a href=${Web_Page} target=_blank ;'>Website</a>"
),
enableSuggestions: true,
minCharacters: 0
});
//Set the sources above to the search widget
search.set("sources", sources);
search.startup();
on(search,'suggest-results', function(e) {
$('.suggestionsMenu ul[role="menu"] li').each(function() {
$(this)[0].innerHTML = $(this)[0].innerHTML.replace(/Name:/g,'<strong>Name:</strong>')
$(this).after($('<input type="button" onclick="alert(\'' + $(this)[0].textContent + '\');" value="Click me">'));
});
});
});
</script>
</head>
<body>
<div id="search"></div>
<div id="map"></div>
</body>
</html>
... View more
01-17-2018
10:49 AM
|
3
|
1
|
1717
|
|
POST
|
I can reproduce the issue on my end... Anyone who wants to see can use the following: <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<title>Intro to MapView - Create a 2D map - 4.5</title>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<link rel="stylesheet" href="https://js.arcgis.com/4.5/esri/css/main.css">
<script src="https://js.arcgis.com/4.5/"></script>
<script>
require([
"esri/Map",
"esri/views/MapView",
"dojo/domReady!"
], function(Map, MapView) {
var map = new Map({
basemap: "streets"
});
var view = new MapView({
container: "viewDiv",
map: map,
zoom: 4,
center: [15, 65] // longitude, latitude
});
//console not logging in IE
view.on("key-down", function(evt){
console.log("key-down", evt);
});
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>
... View more
10-19-2017
01:10 PM
|
2
|
1
|
1025
|
|
POST
|
John, I have a mature app in 3.x that needed a modal. At the time, I decided to go with dijit/dialog: dijit/Dialog — The Dojo Toolkit - Reference Guide If I were doing it now, I'd probably go with a Bootstrap modal: Bootstrap Modals
... View more
08-15-2017
01:52 PM
|
1
|
2
|
3747
|
|
POST
|
I haven't tried this, but based on this thread - Pinch to Zoom - Disable rotation on mobile device 4.3 - it seems like you may want to check out adding a constaint on rotationEnabled. Setting this constraint (rotationEnabled: false) appears to have the side-effect of disabling pinch... which is what you're looking to do. Now, if this does work, I probably wouldn't rely on it with future versions as it seems like the behavior may change once v4 becomes mature. It seems weird that this would disable pinch (as stated in the thread), but it also seems weird that the API couples pinch zoom and pan with the drag event. It really seems like there needs to be a separate event for multiple input gestures, or something like that.
... View more
08-15-2017
01:40 PM
|
1
|
1
|
1270
|
|
POST
|
Thanks – as soon as I have the time to test, I’ll give it a go and report my findings. Regards, Chris Smith Programmer/Analyst 727.786.7955 phone ext. 251 | 727.786.5871 fax | csmith@geosolinc.com <mailto:csmith@geosolinc.com%20 > 1001 Omaha Circle, Palm Harbor, FL 34683 | geographicsolutions.com<http://www.geographicsolutions.com/> <http://www.geographicsolutions.com/> The information contained in this message may be privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer.
... View more
07-25-2017
12:50 PM
|
0
|
0
|
2593
|
|
POST
|
Rebecca, The rumblings are that ArcMap will go the way of the dinosaur, but not as a conscious effort on the part of Esri, but as Pro will become more capable and demand will shift from ArcMap. There's a roadmap of near and long-term coming features that was presented at UC - I'll see if I can dig-up the YouTube link when it becomes available.
... View more
07-21-2017
09:35 AM
|
0
|
3
|
1499
|
|
POST
|
Maybe something like this: on(this._geocoder, 'search-results', lang.hitch(this, function (result) {
if(result){
var _result = result.results[result.numResults - 1][0];
var _resultFeature = _result.feature;
var _resultFeatureAtrributes = _resultFeature.attributes;
var projectid = _resultFeatureAtrributes.PROJECT_ID;
_resultFeature.symbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([0, 255, 255]), 2), new Color([255, 255, 0, 0.25]))
console.log(_resultFeature);
window.history.pushState(projectid, null, "?projectid=" + projectid);
saveState.push(_resultFeatureAtrributes.PROJECT_ID);
this._selectProject(projectid);
var graphicExt = _resultFeature.geometry.getExtent();
//console.log(graphicExt);
mapobject.infoWindow.pagingInfo = true;
mapobject.infoWindow.pagingControls = true;
mapobject.infoWindow.titleInBody = true;
//mapobject.infoWindow.setTitle(result.results[result.numResults][0].feature.attributes.Description);
mapobject.infoWindow.setContent("<div style='font-size: 12px;line-height: 16px;font-weight: bold;'>" + _resultFeatureAtrributes.Description +"</div><div style='border-top: 1px solid #eee;margin-top: 6px;margin-bottom: 6px'></div>" +
"<table><tr><td style='padding-right: 5px;color: #888888;'>Project </td><td style='padding-right: 5px;color: #333;'>" + _resultFeatureAtrributes.PROJECT_ID + "</td></tr>" +
"<tr><td style='padding-right: 5px;color: #888888;'>Project Name </td><td style='padding-right: 5px;color: #333;'>" + _resultFeatureAtrributes.Description + "</td></tr>"+
"<tr><td style='padding-right: 5px;color: #888888;'>Project Details </td><td style='padding-right: 5px;color: #333;'>" + _resultFeatureAtrributes.PublicProjDesc + "</td></tr>"+
"<tr><td style='padding-right: 5px;color: #888888;'>Project Manager</td><td style='padding-right: 5px;color: #333;'>" + _resultFeatureAtrributes.ProjMgrName + "</td></tr>" +
"<tr><td style='padding-right: 5px;color: #888888;'>Project Cost ($) </td><td style='padding-right: 5px;color: #333;'>" + _resultFeatureAtrributes.ProjectCost + "</td></tr>" +
"<tr><td style='padding-right: 5px;color: #888888;'>Supervisor Districts </td><td style='padding-right: 5px;color: #333;'>" + _resultFeatureAtrributes.SuperDistricts + "</td></tr>" +
"<tr><td style='padding-right: 5px;color: #888888;'>TIM Zones </td><td style='padding-right: 5px;color: #333;'>" + _resultFeatureAtrributes.TIMZones + "</td></tr>" +
"<tr><td style='padding-right: 5px;color: #888888;'>Funding Sources </td><td style='padding-right: 5px;color: #333;'>" + _resultFeatureAtrributes.FundSources + "</td></tr>" +
"<tr><td style='padding-right: 5px;color: #888888;'>Construction Start </td><td style='padding-right: 5px;color: #333;'>" + _resultFeatureAtrributes.ConstrStartFY + "</td></tr></table>"
);
mapobject.infoWindow.show(graphicExt.getCenter());
mapobject.setExtent(graphicExt.expand(2));
}
})); Note, I only did a quick smoke test, so you might want to test thoroughly to make sure it's working as intended.
... View more
06-29-2017
10:37 AM
|
0
|
0
|
1034
|
|
POST
|
On initial load, I'm not able to get a drop-down, but if I start typing "7" and click on the recommendation "77123 Alder Drive..." I get the exception in the console. Debugging this line: result.results[result.numResults][0].feature.attributes.PROJECT_ID I see that you've got one result in the array, so result.numResults = 1. That's not a valid index since it is zero based... using this: result.results[0][0].feature.attributes.PROJECT_ID I got the result - "77123": Changing the js file in Chrome, it works. Here's the result: You might want to try "result.numResults - 1" in your code since it's zero based. I'd probably also refactor your function to reduce code replication.
... View more
06-29-2017
10:29 AM
|
0
|
1
|
1034
|
|
POST
|
Do you have the application accessible, either on your own site, or maybe something like JSFiddle? What template on GitHub are you using? Have you tried debugging result on 598?
... View more
06-29-2017
06:34 AM
|
0
|
3
|
1034
|
|
POST
|
Gabi, I'm afraid I don't have an answer for the Flex question - please forgive me, but I would strongly encourage you to move to the JSAPI. I know it may not be an easy task for mature products, but it really is a must as Flex is dead and the Flex API is no longer supported by Esri - whatever bugs or vulnerabilities you find will not be resolved. ArcGIS API for Flex | ArcGIS for Developers
... View more
06-07-2017
01:16 PM
|
0
|
0
|
841
|
|
POST
|
Something to keep in mind, April, if you decide to install Desktop on the server that's hosting ArcGIS Server, you could negatively impact performance when geoprocessing/doing stuff in Desktop.
... View more
06-07-2017
01:11 PM
|
0
|
0
|
2352
|
|
POST
|
Joe, Are you using IIS or an open source web server? We can provide some documentation on getting that rolling, if you need it.
... View more
06-07-2017
01:09 PM
|
1
|
0
|
1940
|
|
POST
|
In 3.x, I found a JSON layer, created dynamically from data in SQL, was usable up to about 10k records, depending on the browser/machine. In the end, I created a map service sourced from SQL views using data registered to the server, pulling top 2k based on the map extent. This works pretty well for our purposes, although I'll definitely keep three js in mind when v4 is ready for us to use - I'm impressed, although, I'd be curious to know how lower-end machines, maybe with integrated cards, handle the rendering.
... View more
06-07-2017
01:04 PM
|
1
|
0
|
2133
|
|
POST
|
No, it does not (with some limitations to keep in mind): Compatibility of ArcGIS Server 10.5 with earlier versions—Documentation | ArcGIS Enterprise
... View more
06-07-2017
12:57 PM
|
1
|
0
|
2352
|
|
POST
|
Do you need to show all 400k points? That's an awful lot of points to show on a map... can you work with dynamically siphoning something like top 5k from the db? As an aside, here's a neat little feature to help you determine client-side performance: Point Graphics Performance - JSAPI 3.20
... View more
06-06-2017
07:47 AM
|
1
|
0
|
2133
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-16-2020 01:25 PM | |
| 1 | 03-20-2019 09:07 AM | |
| 2 | 07-31-2015 07:31 AM | |
| 1 | 09-14-2015 12:14 PM | |
| 1 | 05-12-2015 12:04 PM |
| Online Status |
Offline
|
| Date Last Visited |
07-27-2023
02:30 AM
|