Re: [R-sig-Geo] Merge dataframe with NetCDF file

2023-05-20 Thread Miluji Sb
; syntax is almost identical so it's an easy transition. terra has a writeCDF > function which may work (https://rdrr.io/cran/terra/man/writeCDF.html). > > Best Regards, > Alex > > -- > *From:* R-sig-Geo on behalf of Miluji > Sb > *Sent:* F

[R-sig-Geo] Merge dataframe with NetCDF file

2023-05-19 Thread Miluji Sb
Dear all, I am struggling to convert a dataframe with 49 years of data for 259,200 coordinates. How can I convert this dataset into a NetCDF file with the following attributes; class : RasterBrick dimensions : 360, 720, 259200, 10 (nrow, ncol, ncell, nlayers) resolution : 0.5, 0.5 (x, y)

Re: [R-sig-Geo] Combine two polygons

2023-04-28 Thread Miluji Sb
that help? > > Ben > > > On Fri, Apr 28, 2023 at 8:28 AM Roger Bivand wrote: > > > > Briefly, is sf::aggregate() what you are looking for? Or > terra::aggregate() if you read with terra::vect()? > > > > --- > > Roger Bivand > > Emeritus Profes

Re: [R-sig-Geo] Combine two polygons

2023-04-28 Thread Miluji Sb
ut here or > https://github.com/r-spatial/evolution/issues. > > Roger > > > > > > > (just as an aside, we can't hit the geodata vector urls directly with > gdal > > as we can with the rasters, as they are in an R specific format) > > > > Cheers, Mik

[R-sig-Geo] Combine two polygons

2023-04-27 Thread Miluji Sb
Dear all, I am using the country-level shapefile from GADM. I would like to merge Cyprus and North Cyprus into one polygon. Is this possible? I am using rgdal to read the shapefile, subset, and then rewrite it. Any help will be highly appreciated. ## world <- readOGR("~/gadm36_levels_shp", layer

Re: [R-sig-Geo] Extract CRU data

2023-01-25 Thread Miluji Sb
all the link URLs and hit a button that downloads everything > to a single folder. Once done, I can use standard R functions to list all > the downloaded files and read them. Took about 20 seconds to do for this > page, and now I have a folder of 292 .tmp.per files. > > Barry > &

[R-sig-Geo] Extract CRU data

2023-01-24 Thread Miluji Sb
Greetings everyone, I have a question on extracting country-level data from CRU ( https://crudata.uea.ac.uk/cru/data/hrg/cru_ts_4.06/crucy.2205251923.v4.06/countries/tmp/). The data for each variable are available for individual countries and I am struggling to download all of them. Can I extract

Re: [R-sig-Geo] Convert geojson file to R

2022-11-28 Thread Miluji Sb
WGS 84 > > But leave out the query and you get that C code level error. Another > equivalent query would be "select * from countrymasks" (without the > "where" clause) but this > triggers the error too. Very odd. Worth reporting as a bug? > > Barry &g

Re: [R-sig-Geo] Convert geojson file to R

2022-11-28 Thread Miluji Sb
ead the file with sf. > > Try object <- sf::st_read("~countrymasks.geojson") > > On Mon, Nov 28, 2022 at 7:09 AM Miluji Sb wrote: > >> Greetings everyone, >> >> I would like to convert the geojson file ( >> >> https://drive.google.

[R-sig-Geo] Convert geojson file to R

2022-11-28 Thread Miluji Sb
Greetings everyone, I would like to convert the geojson file ( https://drive.google.com/file/d/18h3sOjZg5jp5euLTWRi5mC40Sja8TZDN/view?usp=sharing) to a dataframe - essentially obtain which has coordinates matched to a country. I have tried the following; ### states <-

Re: [R-sig-Geo] Field names abbreviated for ESRI Shapefile driver

2020-04-19 Thread Miluji Sb
iences > > > 2020.04.19. 17:37 keltezéssel, Miluji Sb írta: > > Greetings, > > > > i am trying to export a shapefile using the following command; > > > > st_write(weight.sf, "weight.shp, driver="ESRI Shapefile") > > > > But gett

[R-sig-Geo] Field names abbreviated for ESRI Shapefile driver

2020-04-19 Thread Miluji Sb
Greetings, i am trying to export a shapefile using the following command; st_write(weight.sf, "weight.shp, driver="ESRI Shapefile") But getting the following warning; 1: In abbreviate_shapefile_names(obj) : Field names abbreviated for ESRI Shapefile driver The variable names have the

Re: [R-sig-Geo] Extract VIIRS data in R

2020-03-20 Thread Miluji Sb
don't really know what the data is about, the plot generated > (attached) to me seems to indicate that you are trying to glue the wrong > latitudes and longitudes to your measurements. > > > > On 3/19/20 11:29 PM, Miluji Sb wrote: > > Thank you for your reply and the informatio

Re: [R-sig-Geo] Extract VIIRS data in R

2020-03-18 Thread Miluji Sb
ovarid4: WARNING I was asked to get a varid for >> dimension named number_of_pixels BUT this dimension HAS NO DIMVAR! Code >> will probably fail at this point" >> # [1] "vobjtovarid4: WARNING I was asked to get a varid for >> dimension named

[R-sig-Geo] Extract VIIRS data in R

2020-03-17 Thread Miluji Sb
Dear all, Hope everyone is keeping safe. I am trying to extract/read VIIRS nighttime lights data but the output seems rather strange. I have uploaded the file here so as not exceed the size limit of the email. ## Code ##

[R-sig-Geo] Match coordinates to regional polygon

2020-03-10 Thread Miluji Sb
Dear all, Re-sending because the message was too big due to the attachment, I am trying to match a large number of coordinates (attached) sub-national regions using GADM shapefile. Coordinates: https://drive.google.com/file/d/1PUsi4d0wP7hB6Aps6UmpXsnIPSD3I1sT/view?usp=sharing Shapefile:

Re: [R-sig-Geo] Convert data.frame/SpatialPointsDataFrame to raster

2019-08-01 Thread Miluji Sb
ntsDataFrame(try[,1:2],data=try, proj4string = >> CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs")) >> >> r<-rasterize(sp, y=raster(), field=try$TWL_5, fun=mean, background=NA) >> plot(r) >> >> Hope this helps somehow >> Good luck >> Hugo

Re: [R-sig-Geo] Convert data.frame/SpatialPointsDataFrame to raster

2019-07-31 Thread Miluji Sb
nal georeferenced dataset so > that we get an idea of what data you're using. > > Sorry, I cannot be of more help. > > On Wed, Jul 31, 2019 at 10:45 AM Miluji Sb wrote: > >> Dear all, >> >> I have georeferenced dataset with multiple variables and years. The

[R-sig-Geo] Convert data.frame/SpatialPointsDataFrame to raster

2019-07-31 Thread Miluji Sb
Dear all, I have georeferenced dataset with multiple variables and years. The data is at ~100 km (1° × 1°) spatial resolution. I would like to convert this into a raster. I have filtered the data for one year and one variable and did the following; try <- subset(df, year==2010) try <-

Re: [R-sig-Geo] Plot coordinates on world map with Robinson CRS - ggplot2

2019-02-18 Thread Miluji Sb
ge but you need quite a lot of > prior-won expertise there too, good luck). > > Cheers, Mike. > > On Mon, 18 Feb 2019 at 20:01 Miluji Sb wrote: > >> Dear all, >> >> I am trying to plot coordinates on a world map with Robinson CRS. While >> the >> world map

[R-sig-Geo] Plot coordinates on world map with Robinson CRS - ggplot2

2019-02-18 Thread Miluji Sb
Dear all, I am trying to plot coordinates on a world map with Robinson CRS. While the world map is generated without any issues, when I try to plot the points - I only get a single point. The code I am using and the coordinates data is below. What am I doing wrong? Any help/suggestions will be

[R-sig-Geo] Match European cities to Coordinates/NUTS 2

2018-11-05 Thread Miluji Sb
I have a dataframe (more than 50,000 observations), where one of the variables is the city that unit is location. The units are all in Europe. My goal is to assign NUTS-2 code to each of these cities. However, I am not aware of any direct way of achieving this, so I wanted to first assign

Re: [R-sig-Geo] Raster to rasterbrick does not preserve Date/Time

2018-11-05 Thread Miluji Sb
+ 24*60*60*zf > rbrick <- raster::setZ(rbrick, z, name = 'datetime') > > You'll need to think through the timezone issues that might arise. > as.POSIXct() has arguments that can help you with that. > > Cheers, > Ben > > > > On Nov 4, 2018, at 12:39 PM, Miluji

[R-sig-Geo] Raster to rasterbrick does not preserve Date/Time

2018-11-04 Thread Miluji Sb
Dear all, I have a raster with multiple variables and date/time information; time Size:17164 *** is unlimited *** standard_name: time bounds: time_bnds units: day as %Y%m%d.%f calendar: proleptic_gregorian bnds Size:2 My goal is

Re: [R-sig-Geo] Extract coordinates from rasterbrick

2018-08-14 Thread Miluji Sb
Aug 14, 2018 at 11:50 AM Bede-Fazekas Ákos > wrote: > > > Dear Milu, > > > > I think that you are looking for as.data.frame(x, xy = TRUE). > > > > HTH, > > Ákos Bede-Fazekas > > Hungarian Academy of Sciences > > > > > > 201

[R-sig-Geo] Extract coordinates from rasterbrick

2018-08-14 Thread Miluji Sb
Dear all, I have the following rasterbrick (x); class : RasterBrick dimensions : 112, 272, 30464, 7305 (nrow, ncol, ncell, nlayers) resolution : 0.25, 0.25 (x, y) extent : -132, -64, 24, 52 (xmin, xmax, ymin, ymax) coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84

Re: [R-sig-Geo] Spatial Downscaling in R

2018-03-15 Thread Miluji Sb
s in those interpolation > methods (e.g. regression kriging) that can handle auxiliary data. > > HTH, > Ákos Bede-Fazekas > Hungarian Academy of Sciences > > > > 2018.03.14. 22:15 keltezéssel, Miluji Sb írta: > >> Thanks again! Looking into this right now. >> >&

Re: [R-sig-Geo] Spatial Downscaling in R

2018-03-14 Thread Miluji Sb
Thanks again! Looking into this right now. Sincerely, Milu On Wed, Mar 14, 2018 at 9:54 PM, Michael Sumner <mdsum...@gmail.com> wrote: > Try ClimDown package, otherwise more generally raster function > disaggregate. > > Cheers > > On Thu, 15 Mar 2018, 06:53 Miluji

[R-sig-Geo] Spatial Downscaling in R

2018-03-14 Thread Miluji Sb
Dear all, Please forgive my inexperience with spatial downscaling. I am interested in spatial downscaling of global temperature to grid cell. Is there a package in R that can perform this function? Any help/guidance will be highly appreciated. Sincerely, Milu [[alternative HTML

[R-sig-Geo] ISO3 to 7 continents names

2017-09-07 Thread Miluji Sb
Dear all. Is it possible to convert.identify iso3 country names to the seven continent names? # Asia, Africa, Antarctica, Australia, Europe, South America, and North America, I have tried the following: ### region <- merge(countryExData,df,by.x='ISO3V10',by.y='iso3') where df is the name of

Re: [R-sig-Geo] Aggregation to

2017-09-01 Thread Miluji Sb
eux <loic.dutri...@conabio.gob.mx > wrote: > > > On 31/08/17 14:22, Miluji Sb wrote: > >> I have a set of coordinates: >> >> temp <- dput(head(gcp,10)) >> structure(list(lon = c(-180, -180, -179, -179, -178, -178, -177, >> -176, -176, -175), lat = c(67, 6

[R-sig-Geo] Aggregation to

2017-08-31 Thread Miluji Sb
I have a set of coordinates: temp <- dput(head(gcp,10)) structure(list(lon = c(-180, -180, -179, -179, -178, -178, -177, -176, -176, -175), lat = c(67, 68, 67, 68, 67, 68, 67, 66, 67, 66)), datalabel = "", time.stamp = "11 Aug 2017 16:10", .Names = c("lon", "lat"), formats = c("%9.0g", "%9.0g"),

Re: [R-sig-Geo] Problem in extracting data from GRIB files

2017-07-31 Thread Miluji Sb
es write.csv(joined_mm_day_year_names, file=file.path("C:/Users/Desktop/temp/",csvname)) } On Sat, Jul 29, 2017 at 12:36 AM, Michael Sumner <mdsum...@gmail.com> wrote: > > > On Sat, 29 Jul 2017 at 02:21 Miluji Sb <miluj...@gmail.com> wrote: > >&g

[R-sig-Geo] Problem in extracting data from GRIB files

2017-07-28 Thread Miluji Sb
Dear all, I have a set of coordinates for cities: structure(list(lon = c(3.7174243, 3.2246995, 2.928656, 33.3822764, 10.40237, 24.7535746, 7.2619532, -0.370679, -4.486076, -4.097899 ), lat = c(51.0543422, 51.209348, 51.21543, 35.1855659, 55.403756, 59.4369608, 43.7101728, 49.182863, 48.390394,

[R-sig-Geo] Question on Aggregation

2017-01-14 Thread Miluji Sb
I have the following GDP data by longitude and latitude at 0.5 degree by 0.5 degree. temp <- dput(head(ptsDF,10)) structure(list(longitude = c(-68.25, -67.75, -67.25, -68.25, -67.75, -67.25, -71.25, -70.75, -69.25, -68.75), latitude = c(-54.75, -54.75, -54.75, -54.25, -54.25, -54.25, -53.75,

Re: [R-sig-Geo] Elevation data

2017-01-13 Thread Miluji Sb
hanks again! Sincerely, Milu On Fri, Jan 13, 2017 at 3:35 PM, Loïc Dutrieux <loic.dutri...@conabio.gob.mx > wrote: > > > On 13/01/2017 10:59, Miluji Sb wrote: > > Thank you for your reply. This is what I did: > > > > ### > > library(data.table) > > library(raster) &g

Re: [R-sig-Geo] Elevation data

2017-01-13 Thread Miluji Sb
gt; R raster::getData("SRTM", ...) will return elevation rasters at 90m > resolution. > See: > https://www.rdocumentation.org/packages/raster/versions/2.5- > 8/topics/getData > http://www.cgiar-csi.org/data/srtm-90m-digital-elevation-database-v4-1 > > --Mel. > >

[R-sig-Geo] Difference in coordinates to country conversion

2017-01-12 Thread Miluji Sb
I have a set of coordinates at 1° x 1° which look like this: structure(list(longitude = c(-179L, -178L, -177L, -177L, -177L, -176L), latitude = c(-15L, -15L, -14L, 51L, 52L, -22L)), .Names = c("longitude", "latitude"), row.names = c("1", "2", "3", "4", "5", "6"), class = "data.frame") I am

[R-sig-Geo] Elevation data

2017-01-10 Thread Miluji Sb
Dear all. Is there a way to download global elevation data at the 1° x 1° resolution in R using a given set of coordinates? I know about the getData() function but can many coordinates be passed through this? Thanks! Sincerely, Milu [[alternative HTML version deleted]]

Re: [R-sig-Geo] Convert SpatialPointsDataFrame to SpatialPolygons or SpatialPolygonsDataFrame

2016-12-26 Thread Miluji Sb
, Milu On Mon, Dec 26, 2016 at 1:12 PM, Michael Sumner <mdsum...@gmail.com> wrote: > > > On Mon, 26 Dec 2016 at 22:39 Miluji Sb <miluj...@gmail.com> wrote: > >> Dear Michael, >> >> Merry Christmas and seasons's greetings! Thank you for your reply, I am >

Re: [R-sig-Geo] Convert SpatialPointsDataFrame to SpatialPolygons or SpatialPolygonsDataFrame

2016-12-26 Thread Miluji Sb
a is > organized. You could post sample data, or describe them in more detail. Do > you have actual polygons here or are you attempting to estimate them from > point data? > > To add more alternatives the new sf package simplifies the constructors a > lot, for a new family of

[R-sig-Geo] Convert SpatialPointsDataFrame to SpatialPolygons or SpatialPolygonsDataFrame

2016-12-24 Thread Miluji Sb
I have a SpatialPointsDataFrame with the following attributes. Is it possible to convert this to a SpatialPolygons or SpatialPolygonsDataFrame? Thank you! Sincerely, Milu class : SpatialPointsDataFrame features: 21441 extent : -179.5, 179.5, -89.5, 83.5 (xmin, xmax, ymin, ymax)

Re: [R-sig-Geo] Error in Spatial lag model

2016-11-20 Thread Miluji Sb
. Sincerely, Milu On Sun, Nov 20, 2016 at 8:29 PM, Roger Bivand <roger.biv...@nhh.no> wrote: > On Sun, 20 Nov 2016, Miluji Sb wrote: > > I have a dataset as below (with NAs). I am trying to run a spatial lagged >> model >> >> ## >> E2_mod_pdssat <

[R-sig-Geo] Error in Spatial lag model

2016-11-20 Thread Miluji Sb
I have a dataset as below (with NAs). I am trying to run a spatial lagged model ## E2_mod_pdssat <- as.data.frame(gcp_t_p[,c(2,3)]) names(E2_mod_pdssat) <- c("Lon", "Lat") row.names(E2_mod_pdssat) <- NULL coords_matrix <- as.matrix(E2_mod_pdssat) # create coordinate matrix IDs <-

Re: [R-sig-Geo] Merge data by latitude and longitude

2016-10-18 Thread Miluji Sb
Possible solution: http://stackoverflow.com/a/40075289/4373531 On Sun, Oct 16, 2016 at 3:32 PM, Miluji Sb <miluj...@gmail.com> wrote: > Dear all, > > I have two dataframe 1 by latitude and longitude but they always do not > match. Is it possible to merge them (e.g

[R-sig-Geo] Merge data by latitude and longitude

2016-10-16 Thread Miluji Sb
Dear all, I have two dataframe 1 by latitude and longitude but they always do not match. Is it possible to merge them (e.g. nearest distance)? # Dataframe 1 structure(list(lat = c(54L, 55L, 51L, 54L, 53L, 50L, 47L, 51L, 49L, 54L), lon = c(14L, 8L, 15L, 7L, 6L, 5L, 13L, 5L, 13L, 11L ), PPP2000_40

[R-sig-Geo] Climate data in R

2016-08-01 Thread Miluji Sb
Dear all, I have a set of coordinates. Is it possible to extract climate data (temperature and precipitation) by coordinates using the R packages such as rnoaa? For example; out <- ncdc(datasetid='ANNUAL', stationid='GHCND:USW00014895', datatypeid='TEMP') But instead of stationid can I pass a

Re: [R-sig-Geo] Country names from coordinates

2016-07-26 Thread Miluji Sb
rld) >> # [1] "+proj=eck4 +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 >> +units=m +no_defs +towgs84=0,0,0" >> >> pts <- SpatialPointsDataFrame(temp [, c(1,2)], temp, >> proj4string=CRS("+init=epsg:4326")) >> # Reproject World >&g

[R-sig-Geo] Country names from coordinates

2016-07-25 Thread Miluji Sb
I have the following data at 0.5 degree by 0.5 degree. temp <- dput(head(ptsDF,10)) structure(list(longitude = c(-68.25, -67.75, -67.25, -68.25, -67.75, -67.25, -71.25, -70.75, -69.25, -68.75), latitude = c(-54.75, -54.75, -54.75, -54.25, -54.25, -54.25, -53.75, -53.75, -53.75, -53.75), GDP =

Re: [R-sig-Geo] Aggregate data to lower resolution

2016-07-22 Thread Miluji Sb
.nl> wrote: > Hi Milu, > > The code you provided works perfectly on my computer. What doesn't work in > your case? Do you get an error message? > > Cheers, > Loïc > > > On 21/07/2016 22:57, Miluji Sb wrote: > >> Dear all, >> >> I have the f

[R-sig-Geo] Aggregate data to lower resolution

2016-07-21 Thread Miluji Sb
Dear all, I have the following GDP data by latitude and longitude at 0.5 degree by 0.5 degree. temp <- dput(head(ptsDF,10)) structure(list(longitude = c(-68.25, -67.75, -67.25, -68.25, -67.75, -67.25, -71.25, -70.75, -69.25, -68.75), latitude = c(-54.75, -54.75, -54.75, -54.25, -54.25, -54.25,

[R-sig-Geo] Convert ncdf data to dataframe

2016-06-02 Thread Miluji Sb
Dear all, I have used the following code to read in a ncdf file library(chron) library(lattice) library(ncdf4) library(data.table) ncname <- ("/file_path") ncfname <- paste(ncname, ".nc", sep = "") dname <- "ssl" # note: tmp means temperature (not temporary) ncin <- nc_open(ncfname)

Re: [R-sig-Geo] Match Coordinates to NUTS 2 ID

2016-05-27 Thread Miluji Sb
NA > 4 NA NA NA > 5CZ03 2 8.350082 2.222739 > 6CZ03 2 8.350082 2.222739 > > > > Yours sincerely / Med venlig hilsen > > Frede Aakmann Tøgersen > Specialist, M.Sc., Ph.D. > Plant Performance & Mode

[R-sig-Geo] Match Coordinates to NUTS 2 ID

2016-05-26 Thread Miluji Sb
Dear all, I have downloaded the NUTS 2 level data from library(“rgdal”) library(“RColorBrewer”) library(“classInt”) #library(“SmarterPoland”) library(fields) # Download Administrative Level data from EuroStat temp <- tempfile(fileext = ".zip") download.file("

[R-sig-Geo] Address from Wikimapia

2016-05-17 Thread Miluji Sb
Is it possible to convert latitude and longitude into addresses in R using Wikimapia mapping instead of Google? The reason being that Wikimapia addresses have more details. This is the code I have been using but this obtains the information from Google. library(data.table) library(ggmap)

Re: [R-sig-Geo] Aggregate FIPS data to State and Census divisions

2016-05-01 Thread Miluji Sb
g for you? You can specify, with a formula > interface, which column in a data.frame is the variable to summarise and > which are used as factors by which to "cut" the data. > > Cheers, > Roman > > On Sun, May 1, 2016 at 5:30 PM, Miluji Sb <miluj...@gmail.com> wr

[R-sig-Geo] Add Two-Headed Arrow in map legend

2016-04-08 Thread Miluji Sb
I am trying to draw maps for the world using: library(rworldmap) library(maptools) library(foreign) library(RColorBrewer) library(ggplot2) library(countrycode) tmp2<- dput(head(pece,10)) structure(list(iso3 = c("AUS", "AUT", "BEL", "CAN", "CHE", "CHL", "CZE", "DEU", "DNK", "ESP"), eps_score =