How to calculate offset based on latitude and longitude - formula

How to calculate offset for time zones if only latitude and longitude are known?
For example: longitude = -94.52021, latitude = 32.31827. Offset = -360

Related

How do I extract data from two different netcdf models for particular depth bins?

I'm working with data from two different netCDF files. One is a model of organic flux and the other is a bathymetry model of seafloor depth link downloadThe flux model has 5 different variables:
Flux model:
double nav_lon[x,y]
axis: X
standard_name: longitude
long_name: Longitude
units: degrees_east
nav_model: grid_T
double nav_lat[x,y]
axis: Y
standard_name: latitude
long_name: Latitude
units: degrees_north
nav_model: grid_T
double flux_avg[x,y]
long_name: Seafloor downward organic carbon flux, average
units: mmol C / m2 / d
double flux_min[x,y]
long_name: Seafloor downward organic carbon flux, minimum
units: mmol C / m2 / d
double flux_max[x,y]
long_name: Seafloor downward organic carbon flux, maximum
units: mmol C / m2 / d
2 dimensions:
x Size:4320 cells (no dimvar)
y Size:2160 (no dimvar)
and the bathymetry model has 4 different variables:
Bathymetry model:
double nav_lon[x,y]
axis: X
standard_name: longitude
long_name: Longitude
units: degrees_east
nav_model: grid_T
double nav_lat[x,y]
axis: Y
standard_name: latitude
long_name: Latitude
units: degrees_north
nav_model: grid_T
double Bathymetry[x,y]
long_name: seafloor depth
units: m
double area[x,y]
long_name: grid cell area
units: m2
2 dimensions:
x Size:4320 (no dimvar)
y Size:2160 (no dimvar)
I want to extract the average POC flux (flu_avg) in the flux model for particular depths in the bathymetry model (depth bins I create: 250-500 m, 500-750 m, 750-1000 m, 1000-2000 m, and 2000-3000 m) at certain coordinates. How do I go about this?

Calculate 'nearest neighbour' when using group_by() in R

I am trying to find the centroids location of GPS coordinates within trackline segments. Then find the indexes of nearest neighbours between these centroid points and GPS coordinates in the same trackline segment.
So far I have found the centroid of each segment, and then found a method to get the indexes of these nearest neighbours to my GPS coordinates, but am unable to make R only find nearest neighbours within the same segment.
# Calculate the average Latitude/Longitude for each 'Segment'
data_update <- data %>% as.tibble() %>%
group_by(Segment) %>% mutate(ave_lat = mean(Latitude), ave_lon = mean(Longitude))
# Find the nearest neighbour
install.packages('RANN')
library(RANN)
closest <- RANN::nn2(data_update[,2:3], data_update[,4:5], k = 1, searchtype = "radius", radius = 1)
closest <- sapply(closest, cbind) %>% as_tibble
# closest produces two columns nn.idx and nn.dist - I need nn.idx only
# data_update[,2] = Longitude values (decimal degrees)
# data_update[,3] = Latitude values (decimal degrees)
# data_update[,4] = average longitude value for each Segment (decimal degrees)
# data_update[,5] = average latitude value for each Segment (decimal degrees)
I need to use nn2 to calculate the nn.idx within each 'Segment' rather than across the entire data frame as the code above is doing.
Does anyone know how to group the nn2 function to calculate the nearest neighbour by 'Segment'? I am open to non-tidyverse options also.
Example data can be found here: https://drive.google.com/file/d/16cZPo6kXIafU0ezAoy8EgB9CHVEDUTe-/view?usp=sharing

latitude and longitude to angle based on quadrat in r

I have a set of coordinates that I want to turn into an angle and do some Anova analysis. I used maptools trackAzimuth function to do it, but I keep losing one or two points. I assume it calculates angles between two coordinates. But I want 1 point (angle) on 1 latitude and longitude, for example at [-80.222, 30.555 to 45]. Since my longitude is in North America, it is in a negative value, do we have to convert into positive before converting it into angle? Please enlighten me on this. Following is my data;
Longitude Latitude
-104.952 39.71478
-104.952 39.7149
-104.54 39.7148
-104.955 39.70441
-104.966 39.7175
My codes:
setwd("C:/Users/data")
install.packages("maptools")
library(maptools)
data <- read.table("data.csv", header = T, sep = ",")
dfr<-data.frame(data[3:4])
angle<-data.frame(trackAzimuth(as.matrix(dfr)))
My results is:
Angle
-81.001
-95.57075
-175.254
-32.628
Here, I lost 1 latitude and longitude. And my angles are negative, I want positive angles on this. How do I do it? Please help.
Thanks

Convert local coordinates to decimal latitude and longitude given a known 0,0 point

I have data from a mapped region 100' x 100'. The data is spatially distributed with local x,y coordinates where x ranges from 0-100 and y ranges from 0-100. The actual location of my 0,0 point is known to be:
Latitude = 41.947901°
Longitude = -87.655815°
Can I convert my given 'local' coordinates to actual Lat/Long?
An x,y data.frame similar to the one I'm using can be developed from the following code:
xycords <- data.frame(x=rep(1:100,times=1,each=100),y=rep(1:100,times=100,each=1))

get longitude and latitude in EPSG:32750

I have mapinfo file and spatial type is point. I want to know longitude and latitude but in this file not include field to specific describe to longitude and latitude.
the CRS is WGS 84/UTM zone 50s (EPSG:32750). I have to export the file (.tab) using ogr but the result is not like a longitude and latitude.
this is the result:
POINT (238339.99924633466 9640080.0006718487)
POINT (238540.00219973351 9640080.0006718487)
POINT (238559.99837215125 9640080.0006718487)
POINT (238580.0027904133 9640080.0006718487)
If I want to get the longitude & latitude from this file is posible?how can?
You will have to run those points through a conversion to get a "normal" (cartesian) latitude and longitude coordinates from them. OSGeo.org has several libraries available to convert these points and translate them to global latitude and longitude points. FreeGIS.org also has a list of tools that you can sort by language. I believe that "Geo" people prefer to use longitude, latitude when describing points.
POINT( longitude latitude )

Resources