queries property
Get the query parameters for the request based on the service type.
For NominatimServiceType.search, returns a map of search parameters. For NominatimServiceType.reverse, returns a map of reverse geocoding parameters. For NominatimServiceType.status, returns a map with the format parameter. For NominatimServiceType.lookup, returns a map of lookup parameters.
Implementation
@override
Map<String, String>? get queries {
switch (type) {
case NominatimServiceType.search:
assert(searchRequest != null);
return {
"format": "jsonv2",
'q': searchRequest!.query,
'limit': "${searchRequest?.limit ?? 10}",
if (searchRequest?.street != null) 'street': searchRequest!.street!,
if (searchRequest?.city != null) 'city': searchRequest!.city!,
if (searchRequest?.county != null) 'county': searchRequest!.county!,
if (searchRequest?.state != null) 'state': searchRequest!.state!,
if (searchRequest?.country != null)
'country': searchRequest!.country!,
if (searchRequest?.postalCode != null)
'postalcode': searchRequest!.postalCode!,
"addressdetails":
"${(searchRequest?.addressDetails ?? true) ? 1 : 0}",
"extratags": "${(searchRequest?.extraTags ?? true) ? 1 : 0}",
"namedetails": "${(searchRequest?.nameDetails ?? true) ? 1 : 0}",
if (searchRequest?.language != null)
'accept-language': searchRequest!.language!,
if (searchRequest?.countryCodes != null &&
searchRequest!.countryCodes!.isNotEmpty)
'countrycodes': searchRequest!.countryCodes!.join(','),
if (searchRequest?.excludePlaceIds != null &&
searchRequest!.excludePlaceIds!.isNotEmpty)
'exclude_place_ids': searchRequest!.excludePlaceIds!.join(','),
if (searchRequest?.viewBox != null)
'viewbox':
'${searchRequest!.viewBox!.westLongitude},${searchRequest!.viewBox!.southLatitude},${searchRequest!.viewBox!.eastLongitude},${searchRequest!.viewBox!.northLatitude}',
if (searchRequest?.viewBox != null) 'bounded': '1',
if (language != null) 'accept-language': language!,
};
case NominatimServiceType.reverse:
assert(reverseRequest != null);
return {
"format": "jsonv2",
"lat": "${reverseRequest?.lat}",
"lon": "${reverseRequest?.lon}",
"addressdetails":
"${(reverseRequest?.addressDetails ?? true) ? 1 : 0}",
"extratags": "${(reverseRequest?.extraTags ?? true) ? 1 : 0}",
"namedetails": "${(reverseRequest?.nameDetails ?? true) ? 1 : 0}",
if (language != null) 'accept-language': language!,
};
case NominatimServiceType.status:
return {
"format": "json",
};
case NominatimServiceType.lookup:
assert(lookupRequest != null);
return {
"format": "jsonv2",
"osm_ids": lookupRequest?.osmIds ?? '',
"addressdetails":
"${(lookupRequest?.addressDetails ?? true) ? 1 : 0}",
"extratags": "${(lookupRequest?.extraTags ?? true) ? 1 : 0}",
"namedetails": "${(lookupRequest?.nameDetails ?? true) ? 1 : 0}",
"polygon_geojson":
"${(lookupRequest?.polygonGeojson ?? true) ? 1 : 0}",
if (language != null) 'accept-language': language!,
};
}
}