|
POST
|
Awesome! I was testing a bit more and found the results pane is a little too flaky - this is still kludgy, but if you hook onto these events, it should work pretty well and is more intuitive to the user: on(search,'select-result', function(e) {
$("[aria-labelledby='search_input']").show();
});
on(search,'clear-search', function(e) {
$("[aria-labelledby='search_input']").hide();
});
on(search,'suggest-results', function(e) {
$("[aria-labelledby='search_input']").show();
});
on(map,'click', function(e) {
$("[aria-labelledby='search_input']").hide();
});
... View more
02-01-2016
08:57 AM
|
0
|
1
|
2318
|
|
POST
|
Ok, this is kind of a hack, but it should work: <!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.15/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="https://js.arcgis.com/3.15/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;
}
</style>
</script>
<script src="https://js.arcgis.com/3.15/"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></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: false, //needs to be false to keep search results open
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("http://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/CongressionalDistricts/FeatureServer/0"),
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("http://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,'select-result', function(e) {
$("[aria-labelledby='search_input']").show();
});
});
</script>
</head>
<body>
<div id="search"></div>
<div id="map"></div>
</body>
</html>
... View more
02-01-2016
08:26 AM
|
1
|
3
|
2318
|
|
POST
|
Looking over the API, there is a an "expanded" property and an "expand()" method - I'm looking into that now.
... View more
02-01-2016
07:59 AM
|
0
|
1
|
2318
|
|
POST
|
Jenna, Have you had a chance to review Search multiple sources | ArcGIS API for JavaScript? This should get you 90% of the way - that last part keeping the suggested results would need some work.
... View more
02-01-2016
07:51 AM
|
0
|
3
|
2318
|
|
POST
|
You should check out Walkthrough: Calling Managed Code from JavaScript Keep Robert's suggestion in mind - I would drop Silverlight ASAP.
... View more
02-01-2016
07:47 AM
|
1
|
0
|
1650
|
|
POST
|
Let me know how it goes - I have been looking to incorporate real-time/streaming feeds into some of our maps... just haven't had any time for it yet! The downside is that the GeoEvent Processor is a separate extension you'd have to purchase, and it might be overkill if your scope is limited, but they should have a trial just to see if it's the way to go for sure.
... View more
01-29-2016
12:05 PM
|
0
|
0
|
6263
|
|
POST
|
For built-in stuff, I know there's the GeoEvent Processor for Server that can create a service from GeoRSS - http://www.arcgis.com/home/item.html?id=29f0689ec924498c9baf3bb2812dc78c I haven't used the GeoEvent Processor before, so I can only go by the documentation, but you should be able to create a connector to most any real-time feed (Extending the GeoEvent Extension—Real-Time Data Feeds and Sensors (10.3 and 10.3.1) | ArcGIS for Server). RSS is listed, though - Input Connectors—Real-time Data Feeds and Sensors (10.3 and 10.3.1) | ArcGIS for Server - not sure if that's just GeoRSS...
... View more
01-29-2016
11:53 AM
|
3
|
2
|
6263
|
|
POST
|
I don't have an answer to your question, but a suggestion to get more views - did you mean to post this in the JavaScript API forum?
... View more
01-29-2016
11:28 AM
|
0
|
2
|
1040
|
|
POST
|
Doh, looks like the GeoNames demo account just exceeded its usage quote, lol
... View more
01-29-2016
11:26 AM
|
0
|
1
|
6263
|
|
POST
|
Michael, You could parse the RSS and create a JSON object, then a featureCollection, and then a featureLayer from the lat/longs and attributes, e.g. something like Feature collection | ArcGIS API for JavaScript Before you do that, though, would you mind using a third-party utility? If not, you may want to consider the geonames RSS to GeoRSS converter: http://api.geonames.org/rssToGeoRSS?feedUrl=http://feeds.reuters.com/reuters/worldNews&username=demo Then, just use the GeoRSS in the ArcGIS JSAPI - GeoRSS | ArcGIS API for JavaScript
... View more
01-29-2016
11:24 AM
|
0
|
6
|
6263
|
|
POST
|
Ok, I think I've resolved it, for now at least. Probably not the best idea, but, if I hardcode encoding in fetchAndPassBackToClient(), everything works! using (StreamReader sr = new StreamReader(byteStream)) becomes... using (StreamReader sr = new StreamReader(byteStream, Encoding.GetEncoding(28591))) Here's the full method: private bool fetchAndPassBackToClient(System.Net.WebResponse serverResponse, HttpResponse clientResponse, bool ignoreAuthenticationErrors) {
//System.Net.HttpWebResponse serverResponseAux = null;
//var req = (HttpWebRequest)WebRequest.Create(serverResponse.ResponseUri);
//serverResponseAux = (System.Net.HttpWebResponse)req.GetResponse();
if (serverResponse != null) {
using (Stream byteStream = serverResponse.GetResponseStream()) {
// Text response
if (serverResponse.ContentType.Contains("text") ||
serverResponse.ContentType.Contains("json") ||
serverResponse.ContentType.Contains("xml")) {
using (StreamReader sr = new StreamReader(byteStream, Encoding.GetEncoding(28591)))
//using (StreamReader sr = new StreamReader(byteStream, Encoding.GetEncoding(serverResponseAux.CharacterSet)))
//using (StreamReader sr = new StreamReader(byteStream))
{
string strResponse = sr.ReadToEnd();
if (
!ignoreAuthenticationErrors
&& strResponse.Contains("error")
&& (strResponse.Contains("\"code\": 498") || strResponse.Contains("\"code\": 499") || strResponse.Contains("\"code\":498") || strResponse.Contains("\"code\":499"))
)
return true;
//Copy the header info and the content to the reponse to client
copyHeaders(serverResponse, clientResponse);
clientResponse.Write(strResponse);
}
} else {
// Binary response (image, lyr file, other binary file)
//Copy the header info to the reponse to client
copyHeaders(serverResponse, clientResponse);
// Tell client not to cache the image since it's dynamic
clientResponse.CacheControl = "no-cache";
byte[] buffer = new byte[32768];
int read;
while ((read = byteStream.Read(buffer, 0, buffer.Length)) > 0)
{
clientResponse.OutputStream.Write(buffer, 0, read);
}
clientResponse.OutputStream.Close();
}
serverResponse.Close();
}
}
return false;
} I suppose I'll mark this as the answer - if anyone has any better ideas, let me know!
... View more
01-28-2016
02:04 PM
|
1
|
1
|
3589
|
|
POST
|
I would check out that county's property appraiser site and see if they make their GIS data accessible. If they don't, you can always call and ask... they might be able to send you an FTP link, or something like that. Each county may handle db structure differently, too. I'm not sure if some regulatory body in Colorado would have this better represented at the state level (dept. of health maybe?). Worst case scenario, if you can obtain a list with addresses, you can geocode and create a layer yourself.
... View more
01-28-2016
08:44 AM
|
1
|
0
|
2349
|
|
POST
|
Just to isolate this a bit more, I tried loading a static (from a shapefile), secured map service requiring the proxy - the same encoding issue occurred, so it doesn't appear to be an SQL oddity. I then removed security on the SQL-based map service and removed the proxy rule in my mapping application - the layer loads without issue. It appears there is some evidence that it is an encoding/decoding bug within the proxy - just need to isolate where.
... View more
01-28-2016
08:36 AM
|
0
|
0
|
3589
|
|
POST
|
If you search where MTFCC = "K2582", that should pull all of the cemeteries in the dataset. It looks like they just captured the largest of the largest as landmarks, so this ds probably wont be of any help. UPDATE: Another thing you can try, at the county level, the property appraiser sites. For example, Denver County posts a parcel layer: Denver Open Data Catalog: Parcels Here, you can dig in and check something like D_CLASS_CN in the shapefile. It seems cemeteries are classified as "cemetery building" and maybe also as "mortuaries".
... View more
01-28-2016
07:57 AM
|
0
|
0
|
2349
|
| 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
|