spadez8
Joined: 21/06/2013 17:05:20
Messages: 1
Offline
|
I was looking at using geonames for my geocoding but I have a question about the feature class. Basically the feature class returns the kind of results, but I want to have more than one feature class:
Great for large states:
featureClass: "A",
Great for small places:
featureClass: "P",
I can't find a way for me to be able to search for both to get the best of both worlds. I tried removing that line entirely, but returns things like airports and such.
Here is my code: http://jsfiddle.net/spadez/nHgMX/2/
$(function() {
function log( message ) {
$( "<div>" ).text( message ).prependTo( "#log" );
$( "#log" ).scrollTop( 0 );
}
$( "#city" ).autocomplete({
source: function( request, response ) {
$.ajax({
url: "http://ws.geonames.org/searchJSON",
dataType: "jsonp",
data: {
featureClass: "P",
style: "full",
maxRows: 7,
name_startsWith: request.term,
country: "UK"
},
success: function( data ) {
response( $.map( data.geonames, function( item ) {
return {
label: item.name + (item.adminName1 ? ", " + item.adminName1 : "") + ", " + item.countryName,
value: item.name
}
}));
}
});
},
minLength: 1,
select: function( event, ui ) {
log( ui.item ?
"Selected: " + ui.item.label :
"Nothing selected, input was " + this.value);
},
open: function() {
$( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
},
close: function() {
$( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
}
});
});
My question is, can I search more than one feature class, so I can get results for both small towns and large states.Code:
[code]
|