Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced field display for Nominatim search combo #309

Closed
GoogleCodeExporter opened this issue May 10, 2015 · 1 comment
Closed

Enhanced field display for Nominatim search combo #309

GoogleCodeExporter opened this issue May 10, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

See this email thread:

https://groups.google.com/forum/?hl=en#!topic/geoext-viewer-devel/_6aTZmerRMo

This is the initial request from Eddy:

".. wondering if it is possible to apply some kind of filter to the results of 
the Nominatim request, in order to just display street, housenumber and 
postalcode in the result.

http://open.mapquestapi.com/nominatim/v1/search?format=json&q="Unter den 
Linden"&addressdetails=1&countrycodes=de&bounded=1&viewboxlbrt=13.08820,52.341,1
3.76,52.67&

This request results in very long string which contains information about 
village, city, country and even continent. Doesn't really make sense for me, 
because my application is just for one city.....
Maybe one of you guys has alredy stumbled upon a hint that'll do the trick :-)"

Indeed the current Heron.widgets.search.NominatimSearchCombo does not allow 
custom display of search results. The cause is that these three aspects need to 
work in cooperation:

1- the search URL parameters: see 
http://open.mapquestapi.com/nominatim/#search. "addressdetails" need to be 
provided to get formatted adresses

2- the combo Store: should be configured to contain addressdetails. Not just 
"display_name".

3- formatting both the dropdown list and final result: an Ext.XTemplate can be 
provided for "tpl" config, but this is only for the dropdownlist

The first two are easy to provide within the default 
Heron.widgets.search.NominatimSearchCombo via 
the "url" property and a new "storeFields" property. The third requires also a 
new "displayTpl" property to provide an Ext template for displaying the result. 
If all templates  are set to null, the old behaviour (using "display_name" will 
be used.

Actually work has already begun since this will make the 
Heron.widgets.search.NominatimSearchCombo much more usable! See attached 
screenshots for the following config:

        {
            type: "namesearch",
            // Optional options, see NominatimSearchCombo.js, here we restrict search to The Netherlands.
            options : {
                url: 'http://open.mapquestapi.com/nominatim/v1/search?countrycodes=NL&addressdetails=1&format=json&limit=3',
                xtype : 'hr_nominatimsearchcombo',
                emptyText: __('Search Nominatim') + ' Netherlands',
                tpl: '<tpl for="."><tpl for="address"><div class="x-combo-list-item">{road} {city} {state} {postcode} {country}</div></tpl></tpl>',
                displayTpl: '<tpl for="."><tpl for="address">{road} {city} {state} {country}</tpl></tpl>'
            }
        }







Original issue reported on code.google.com by jus...@gmail.com on 24 Nov 2013 at 2:02

Attachments:

@GoogleCodeExporter
Copy link
Author

Fixed.  Any bugs/new features in new issue. Thanks all!

Original comment by jus...@gmail.com on 26 Nov 2013 at 10:09

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant