We are using osmbonuspack's API on Android to get a geocordinate from an address in Barcelona. We are calling org.osmdroid.bonuspack.location.GeocoderNominatim class and method getFromLocationName()
When we search for address Desemparats 18, it returns no result. But if we search for Desemparats then we get 1 result. From the JSON response:
{
"place_id":"9805611",
"licence":"Data © OpenStreetMap contributors, ODbL 1.0. http:\/\/www.openstreetmap.org\/copyright",
"osm_type":"node",
"osm_id":"961073607",
"boundingbox":[
"41.3705229",
"41.3706229",
"2.1225643",
"2.1226643"
],
"lat":"41.3705729",
"lon":"2.1226143",
"display_name":"Mare de Déu dels Desemparats, Carrer Mossèn Jaume Busquets, la Torrassa, l'Hospitalet de Llobregat, BCN, Catalonia, 08094, Spain",
"class":"amenity",
"type":"place_of_worship",
"importance":0.101,
"icon":"http:\/\/nominatim.openstreetmap.org\/images\/mapicons\/place_of_worship_unknown3.p.20.png",
"address":{
"place_of_worship":"Mare de Déu dels Desemparats",
"pedestrian":"Carrer Mossèn Jaume Busquets",
"suburb":"la Torrassa",
"town":"l'Hospitalet de Llobregat",
"county":"BCN",
"state":"Catalonia",
"postcode":"08094",
"country":"Spain",
"country_code":"es"
}
}
It seems that the service does not have street address data for this one and so it only gave a random point on the street. And the reason Desemparats 18 returned without result is because it tried to match 18 with the post code.
Is there something we can do to get a more accurate response? i.e., be able to search for an address with a street/house number?
Or a question to MapQuest, is it really that Barcelona data is not rich enough? Because this address is really not remote.
Any thought and experience by anybody will be appreciated.
It is true that OSM only has very few addresses in this area. There is not much you can do about it except from improving it yourself. You could use a second geocoding service as fallback in case the preferred geocoder fails to return a valid result.
Related
Migrating from Dark Sky to Apple's WeatherKit service, I am seeing the API return only celsius temperature values. I am using this URL:
https://weatherkit.apple.com/api/v1/weather/en_US/45.6270162/-122.6808005?countryCode=US&timezone=America%2FLos_Angeles&dataSets=currentWeather
Based upon what I've read around the internet, this seems correctly formatted, so I don't know why I'm having this locale issue. I've read in other places people talking about how they get fahrenheit temperatures when retrieving weather data in America, so I'm not sure where I'm going wrong.
The docs indicate the WeatherKit REST API only returns metric values. Whenever a temperature-related value is described in the docs it explicitly includes " in degrees Celsius" in the description.
Example: https://developer.apple.com/documentation/weatherkitrestapi/currentweather/currentweatherdata
I wrote a little JS helper to convert the data in my apps:
const metricToImperial = {
cToF: (value) => value * 1.8 + 32,
mToMi: (value) => value / 1609.344,
kmToMi: (value) => value / 1.609344,
mmToIn: (value) => value / 25.4,
};
// example usage
const tempInF = metricToImperial.cToF(yourCelciusTemp);
console.log(tempInF);
I met the function when I read the code given by my senior classmates. she refused to tell me and let me search them on google. But I can't find the answer.
data = readimg1('G:\研究生\实验结果\实验\EDD ESD HR\师姐\数据\HR-shiyan\2018.09.17-DAY 9\A4-2_3D_000.IMG');
I = data(:,:,84);
I am trying to get address and city name of a LatLng point using google_geocoding:
var googleGeocoding =
GoogleGeocoding("MY_KEY");
var result = await googleGeocoding.geocoding.getReverse(LatLon(lat, lng));
print(result?.results?.first.formattedAddress.toString());
The result of the print:
Corso Italia, 22-24, 20122 Milano MI, Italy
I need to get only Corso Italia, the string before the comma and Milano, how can I get that?
I tried to use addressComponents, but I only got numbers (especially if I select locations in countries like Italy)
print(result?.results?.first.addressComponents?.first.longName.toString());
It may not be the most optimal but you could play with picking the string through the spaces and then make the string in such a way that you can have the sequence you want
I'm trying to recreate the information displayed for the current Wi-Fi network when option-clicking on the Wi-Fi status bar item. One of the parameters shown is the MCS Index, but I can't find any way to query this value using the CWInterface class, which is where I am getting most of the other data:
if let interface = CWWiFiClient.shared().interface() {
rssi = interface.rssiValue()
noise = interface.noiseMeasurement()
// etc.
}
Since both the Wi-Fi status bar item and the airport command line tool display the MCS Index, it seems like there should be some way to query it:
MacBook:~ mark$ /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I
agrCtlRSSI: -46
agrExtRSSI: 0
agrCtlNoise: -90
agrExtNoise: 0
state: running
op mode: station
lastTxRate: 878
maxRate: 1300
lastAssocStatus: 0
802.11 auth: open
link auth: wpa2-psk
BSSID: xx:xx:xx:xx:xx:xx
SSID: MyWiFi
MCS: 7
channel: 149,80
I've also seem some Python sample code that seems to indicate that the MCS Index should be available, but I don't see it in the docs or code completion.
Is there some way to get this value through Core WLAN or some other framework, or is this something I need to calculate based on other values?
I found another Python script wifi_status.py
which reports the WiFi status. From the lines
def wifi_status(properties=('bssid', 'channel', 'txRate', 'mcsIndex', 'rssi', 'noise')):
xface = CWWiFiClient.sharedWiFiClient().interface()
while True:
yield({name: getattr(xface, name)() for name in properties})
one can conclude that these attributes can be retrieved with
Key-Value Coding.
And that really works:
if let iface = CWWiFiClient.shared().interface() {
if let mcsIndex = iface.value(forKey: "mcsIndex") as? Int {
print(mcsIndex)
}
}
But I have now idea if that approach is officially supported,
or will work in the future, so use at your own risk.
In my code , the 100 stores are sharing the same attributes.
I thought it should create a different one every time.
(1..100).each do
store_attr = FG.attributes_for :store
store_attr[:account] = accounts.sample
stores << Store.create(store_attr)
end
FactoryGirl.define do
factory :store do
name Faker::Company.name
latitude 1.5
longitude 1.5
street Faker::Address.street_address
city Faker::Address.city
state Faker::Address.state
zip_code Faker::Address.zip_code
phone Faker::PhoneNumber.cell_phone
email Faker::Internet.email
website "https://#{Faker::Internet.domain_name}"
account nil
factory :complete_store do
name 'store_with_account'
account
end
end
end
I believe you need to put them inside a block -
street { Faker::Address.street_address }
Otherwise they will only be generated once and reused for all instances. You can read more here.