我正在尝试创建一列两行的网格。 第一行具有特定的高度,第二行应填充其余空间。 将容器div的高度设置为100%,没有任何变化。将高度设置为100vh会创建较小的空间和多余的滚动
plcUrl <- "https://apiv3.geoportail.lu/geocode/search?queryString="
getGeoDetails <- function(address)
{
query <- paste(addresses$address)
strurl <- as.character(paste(plcUrl,query))
rd <- fromJSON(URLencode(strurl))
df <- data.frame(matrix(unlist(rd), nrow = 22, byrow = T),stringsAsFactors = FALSE)
colnames(df)[1] <- "results_geop"
answer <- data.frame(lat = NA, lon = NA, accuray = NA, address_geop = NA, success = NA, geopID = NA)
answer$status <- df$results_geop[22]
#return Na's if we didn't get a match
if (df$results_geop[22] != "TRUE")
{
return(answer)
}
#else, extract what we need from the GeoPortail server reply into a dataframe
answer$lat <- df$results_geop[9]
answer$lon <- df$results_geop[8]
answer$accuracy <- df$results_geop[21]
answer$geopID <- df$results_geop[19]
answer$address_geop <- df$results_geop[6]
answer$success <- df$results_geop[22]
return(answer)
}
#initialise a dataframe to hold the results
geocoded <- data.frame()
startindex <- 1
row_addresses <- as.numeric(rownames(addresses))
# Start the geocoding process - address by address
for (j in startindex:row_addresses)
{
#query the GeoPortail geocoder
result = getGeoDetails(addresses[j])
print(result$status)
result$index <- j
#append the answer to the results file
geocoded <- rbind(geocoded, result)
#now we add all the results to the main data
addresses$lat_geop[j] <- geocoded$lat[j]
addresses$lon_geop[j] <- geocoded$lon[j]
addresses$accuracy[j] <- geocoded$accuracy[j]
addresses$address_geop[j] <- geocoded$address_geop[j]
addresses$geopID[j] <- geocoded$geopID[j]
addresses$success[j] <- geocoded$success[j]
return(j)}
这里有link进行问题演示。