ropensci / FedData

Functions to Automate Downloading Geospatial Data Available from Several Federated Data Sources
https://docs.ropensci.org/FedData
Other
94 stars 22 forks source link

"template" dosen't work in get_ssurgo function? #37

Closed wzhang27 closed 6 years ago

wzhang27 commented 6 years ago

Dear all, I have boundaries for 1000+ watersheds. I am trying to get the ssurgo data for each watershed by applying like "template=watershed1" in the get_ssurgo function. But no matter which watershed I apply in, the function always returns completely the same thing. It seems like template=watershed1 doesn't work at all. Would somebody give me some advice? Thank you in advance!

bocinsky commented 6 years ago

My first guess is that you aren't changing the "label" argument, so get_ssurgo is simply retrieving the same data from disk over and over. If that's not it, can you show us some of your code?

wzhang27 commented 6 years ago

Hi! Dr. Bocinsky,

It might be due to the label issues. I though that was just the name that I could give to the dataset. But how can we know what label should be used for a certain area? Any suggestions? Thank you so much for your great help!

####### for(i in 1:length(ID)){ med=boundary[boundary$ID==ID[i],] med=Polygon(med[,-3]) med=Polygons(list(med),1) med0=SpatialPolygons(list(med))

data_retrv=get_ssurgo(template=med0,label='VEPIIN') med=as.data.frame(data_retrv$tabular[[5]])

sand

output$sand[i]=mean(med$sandtotal.r,na.rm=T) }

bocinsky commented 6 years ago

I think that’s probably it. You can name them anything you want… the label just names a downloaded dataset in your local file system so you don’t need to keep downloading the data over and over again. I would suggest perhaps your “ID” variable would make a good label.

I’m closing this for now. Feel free to re-open if need be.