File:Kyllikki saari murder site minimum cost certain cost distance negative exponential ring 1 1 1 1.png

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Original file(750 × 611 pixels, file size: 178 KB, MIME type: image/png)

Captions

Captions

Kyllikki Saari murder site minimum cost certain cost distance negative exponential ring

Summary

[edit]
Description
English: Kyllikki Saari murder site minimum cost certain cost distance negative exponential ring. Ring maximum adjusted to bike.
Date
Source Own work
Author Merikanto
Camera location62° 08′ 58.71″ N, 21° 57′ 26.9″ E  Heading=90° Kartographer map based on OpenStreetMap.View this and other nearby images on: OpenStreetMapinfo

This image uses OpenStreetMap

Open Database Licence https://www.openstreetmap.org/copyright

"R" script to calculate raster from distance raster.

Distence raster must done separately with QGIS etc utility

"R 4.3.1 script

library(raster) library(movecost) library(sp)

library(leaflet) library(htmlwidgets) library(mapview) library(utils)

library("webshot")

  1. webshot::install_phantomjs()

conduk1=2

ratius1=0.5 ## radius of maximum rcoeff1=0.33 # exponet function concentration

distcoeff1=50

outPath = paste("./", "leaflethtmlgen.html", sep="")

lok1 <- SpatialPoints( rbind(c(21.95747269428545, 62.149641560706669 ) )) ## hauta lok2 <- SpatialPoints( rbind(c(21.957268833940159, 62.133740877230359) )) ## pyörä

pai1 <- SpatialPointsDataFrame(lok1, data.frame(row.names=row.names(lok1),

                       ID=1:length(lok1)))

pai2 <- SpatialPointsDataFrame(lok2, data.frame(row.names=row.names(lok2),

                       ID=1:length(lok2)))

dtm1<-raster("distancer.tif")


dtm1<-dtm1*conduk1



result <- movecost(dtm=dtm1, origin=pai1, destin=pai2, move=8, breaks=0.05)

  1. print (str(result))

plot(result$cost.surface) plot(result$accumulated.cost.raster)

r2<-result$cost.surface crs(r2) <- "+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"

writeRaster(r2, "costsurf", format = "GTiff", overwrite=TRUE)

r2<-result$accumulated.cost.raster crs(r2) <- "+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"

writeRaster(r2, "accost", format = "GTiff", overwrite=TRUE)

  1. distcoeff1=20 ## to pyörä/2

r3=r2-ratius1

  1. r3=dnorm(r3, 0, .5)
  2. r3=sin(r3*5)

r3=1*exp(-abs(r3*rcoeff1))

distexp1=exp(-dtm1/distcoeff1)

plot(distexp1)

r4=r3*distexp1

plot(r3)

writeRaster(r3, "ring0", format = "GTiff", overwrite=TRUE)

plot(r4)

writeRaster(r4, "distring0", format = "GTiff", overwrite=TRUE)

m <- leaflet() %>%

 addTiles() %>%
  setView(lng=21.95747269428545, lat=62.149641560706669, zoom =12)%>%  
 addMarkers(lng=21.95747269428545, lat=62.149641560706669, popup="Hauta") %>% 
 addMarkers(lng=21.957268833940159, lat=62.133740877230359, popup="Pyörä") %>% 
 addRasterImage(r3,opacity = 0.5)

m

saveWidget(m, file = outPath, selfcontained = FALSE, libdir = 'leafletwidget_libs')

  1. html_fl = tempfile(fileext = ".html")
  2. png_fl = tempfile(fileext = ".png")
 ## create standalone .html
  1. mapshot(m, url = "./out.html")
  2. browseURL(html_fl)
 ## create standalone .png; temporary .html is removed automatically unless
 ## 'remove_url = FALSE' is specified
 mapshot(m, file ="./out.png", selfcontained=FALSE)
  1. browseURL(png_fl)


Licensing

[edit]
I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current16:50, 28 August 2023Thumbnail for version as of 16:50, 28 August 2023750 × 611 (178 KB)Merikanto (talk | contribs)Uploaded own work with UploadWizard

There are no pages that use this file.