Skip to content

KernelUD calculation - coordinates type / transformation from lat/long

3 messages · Ben, zuzana zajkova

3 days later
Ben
#
Hi Zuzana,

try this:
read in your data as 'dat'

Karea_xyUTM<- kernel.area(dat, id=rep('1', nrow(dat)))

20 0.001132550
25 0.001470329
30 0.001847845
35 0.002265101
40 0.002722095
45 0.003238697
50 0.003834776
55 0.004510333
60 0.005285235
65 0.006139616
70 0.007073473
75 0.008146416
80 0.009358443
85 0.010769164
90 0.012656748
95 0.015617275


# then
npoints = nrow(dat)
# convert to SpatialPoints
dat = SpatialPoints(dat, proj4string=CRS("+proj=longlat +datum=WGS84"))

#convert to UTM, be sure to include the zone. very important. This may 
be worng for several of your points since the area is so large.
datUTM<- spTransform(dat, CRS("+proj=utm +zone=24 +ellps=WGS84 
+datum=WGS84 +units=m +no_defs"))

# do the area calculation using the new coordinates only. Be sure to 
include names as a character. Leave out the 'h=' argument. That is where 
your error was occurring.
Karea_xyUTM<- kernel.area(as.data.frame(datUTM), id=rep('1', npoints), 
grid=500, unin ="m", unout = "km2")

20  135351.2
25  175756.6
30  219788.8
35  268222.6
40  322081.0
45  382727.9
50  452100.7
55  532989.0
60  625501.5
65  727065.3
70  840175.7
75  967684.5
80 1111777.1
85 1282512.1
90 1506315.1
95 1861067.6

This website is helpful

http://r.789695.n4.nabble.com/Converiting-longitude-latitude-to-utm-td4632377.html

Cheers,

Ben
On 9/13/2013 10:58 AM, zuzana zajkova wrote: