gis - Extracting point data from a large shape file in R -
i'm having trouble extracting point data large shape file (916.2 mb, 4618197 elements - here: https://earthdata.nasa.gov/data/near-real-time-data/firms/active-fire-data) in r. i'm using readshapespatial in maptools read in shape file takes while works:
worldmap <- readshapespatial("shp_file_name") i have data.frame of coordinates want extract data for. r struggling , either loses connection or freezes, 1 set of coordinates!
pt <-data.frame(lat=-64,long=-13.5) pt<-spatialpoints(pt) e<-over(pt,worldmap) could advise me on more efficient way of doing this?
or case need run script on more powerful (currently using mac mini 2.3 ghz processor)?
many thanks!
by 'point data' mean longitude , latitude coordinates? if that's case, can obtain data underlying shapefile with:
worldmap@data you can view in same way other data frame, example:
view(worldmap@data) you can access columns in data frame in same way would, except don't need @data, e.g.:
worldmap$latitude finally, recommended use readogr rgdal package rather maptools::readshapespatial former reads in crs/projection information.
Comments
Post a Comment