> nominatim_osm <- function(address = NULL) + { + if(suppressWarnings(is.null(address))) + return(data.frame()) + tryCatch( + d <- jsonlite::fromJSON( + gsub('\\@addr\\@', gsub('\\s+', '\\%20', address), + 'http://nominatim.openstreetmap.org/search/@addr@?format=json&addressdetails=0&limit=1') + ), error = function(c) return(data.frame()) + ) + if(length(d) == 0) return(data.frame()) + return(data.frame(lon = as.numeric(d$lon), lat = as.numeric(d$lat))) + } > > nominatim_osm("תל-אביב") lon lat 1 34.78053 32.08048 > nominatim_osm("אילת") lon lat 1 34.94979 29.55693
--שלום לכולם - אשמח לעזרה,מחפש דרך מהירה ונוחה להמיר שם של עיר בעברית לפורמט מרחבי שאפשר לעבוד איתו עם חבילות נוספות (בפרט וויזואליזציה). לדוג' "אילת" ולקבל lat, long מתאיםהאם מכירים חבילה שיודעת לעשות משהו כזה?אם לא, אשמח לרעיונות לאיך לעשות את זה יעיל/מהיר ככל האפשרתודה!
You received this message because you are subscribed to the Google Groups "Israel R User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to israel-r-user-g...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/israel-r-user-group/510dbcbe-36c1-4f83-b15b-e6d26d24adb4%40googlegroups.com.