Code Monkey home page Code Monkey logo

Comments (1)

sckott avatar sckott commented on June 3, 2024

Some notes:

Find UTM zone for conversion

UTM reference map

This works for West longitudes only though (from SO)

long2UTM <- function(long) {
  (floor((long + 180)/6) %% 60) + 1
}
long2UTM(-149.9)

[1] 6

For all longitudes

long2utm <- function(lon, lat) {
  if(56 <= lat & lat < 64){
    if(0 <= lon & lon < 3){ 31 } else 
      if(3 <= lon & lon < 12) { 32 } else { NULL }
  } else 
  if(72 <= lat) {
    if(0 <= lon & lon < 9){ 31 } else 
      if(9 <= lon & lon < 21) { 33 } else 
        if(21 <= lon & lon < 33) { 35 } else 
          if(33 <= lon & lon < 42) { 37 } else { NULL }
  }
  (floor((lon + 180)/6) %% 60) + 1
}
long2utm(-60, 65)

21

Convert occ output lat/long coordinates to UTM

library(spocc)
dat <- occ(query='Accipiter striatus', from='gbif')
dat <- na.omit(dat@gbif@data)
coordinates(dat)=~longitude+latitude
proj4string(dat) = CRS("+init=epsg:4326")
spTransform(dat, CRS("+proj=utm +zone=11 +datum=WGS84 +units=m +no_defs +towgs84=0,0,0"))

Essentially would have to do this point by point

Since a data.frame we get back from a source we don't know what zones they are in ahead of time. Though I suppose we could do basic stuff, and just leave complicated stuff up to the user.

from spocc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.