[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
Thank you, Ben! This works well. Sincerely, Milu On Sun, Nov 4, 2018 at 11:08 PM Ben Tupper wrote: > Hi, > > I'm not sure about reading the datetime stamp directly form the file, but > you have enough info to convert the z-value which is well described in your > ncdf. I'm not familiar with

Re: [R-sig-Geo] Reordering geographical coordinates clockwise to make a polygon

2018-11-05 Thread Michael Sumner
alphahull or a hand-crafted "triangulate and cull long/large triangles" might be workable options (geometry and RTriangle have the fastest and most useful triangulation functions). It's not generally a tractable problem afaics. Some refs that came up in recent discussions:

Re: [R-sig-Geo] Reordering geographical coordinates clockwise to make a polygon

2018-11-05 Thread Edzer Pebesma
Sorry for my previous answer, I didn't get the question fully. I'm afraid I still don't get the question fully, but functions that might help are sf::st_line_merge (creates a LINESTRING from line pieces) and sf::st_polygonize (creates a polygon from a LINESTRING that forms a closed ring) On

Re: [R-sig-Geo] Reordering geographical coordinates clockwise to make a polygon

2018-11-05 Thread Patrick Giraudoux
Apologize to answer to myself: the way described below would work only if there are no concave "peninsula" towards north or south inside the polygon. Even thinking about an alternate solution, e.g. the Traveling Salesman Problem (TSP), ie. the shortest route linking all points, one could get

Re: [R-sig-Geo] Reordering geographical coordinates clockwise to make a polygon

2018-11-05 Thread Edzer Pebesma
Look for argument check_ring_dir in the documentation of sf::st_read. On 11/5/18 2:02 PM, Patrick Giraudoux wrote: > Dear listers, > > There is an interesting post here: > https://stackoverflow.com/questions/6989100/sort-points-in-clockwise-order > dealing on the issue. However, I would like