Custom global search provider stopped working
Hi,
I build a custom global search provider that queries an external geocoding service. This worked perfect in the HTML viewer 2.3: When clicking on a result, the map zooms in to show a pinpoint or a polygon (depending on the type of result), and the attributes were shown too.
I tested the same code with HTML viewer 2.6 and 2.7, and although the results are show in the result list, I only see a pinpoint (even for polygons), I can't zoom in, and I see no attributes. I checked this in the browser's debugger, and I can see that both the geometry and the attributes are filled correctly, so that is not what's going wrong here.
This is the code that I use to generate a featureset:
var featureSet = new infrastructure.FeatureSet();
featureSet.displayName.set("Geocoding results");
featureSet.iconUri.set(this.iconUrl);
for (var i: number = 0; i < docs.length; i++) {
var attributes: any = {};
for (var p in docs[i]) {
if (docs[i].hasOwnProperty(p)) {
attributes[p] = docs[i][p];
}
}
var geometry = this.parseWkt(docs[i].geometrie_rd);
var graphic = new esri.Graphic(geometry, null, attributes);
var feature = new infrastructure.Feature({ graphic: graphic });
feature.labelFormat.set("{weergavenaam}");
featureSet.addFeature(feature);
}
this.setStatusIdle();
I was wondering if anything has changed in the viewer itself with regards to the search provider?
0
-
I'm still struggling with this issue, hopefully someone at Latitude can shed some light here?
I just tested with HTML viewer 2.9, and it still doesn't work. Some things I found out:- In this viewer there's a new option to zoom to all search results, and this works.
- If I select a search result, press the ... button and then select 'Zoom to feature', this works
- If I switch to Table View, selecting a row also selects and zooms to that feature
- I still cannot open the attributes of a search result
- Clicking on a feature in the search result list does nothing.
- I tried the GeoNamesSearchProvider that comes with the samples of the HTML viewer, this one has the same problems
0 -
Hi Berend,
Looks like the sample site online is also [still] broken, so we'll get someone to look into that.
I suspect that there is a new requirement when dynamically generating the FeatureSet; perhaps we now have to add it to a FeatureSetCollection or tell the viewer that it is allowed to own (and thus present attributes for) this Featureset.
Regards,
-Malcolm0 -
My colleague discovered two small mistakes I made: - In ResourceManifest.xml I had set Library="false"
- The name of the library did not match the one in [device].json.js
0 -
OK Berend, with those adjustments were you able to get your code to work? If not let us know.
Regards,
-Malcolm0
Please sign in to leave a comment.
Comments
4 comments