DATA SCIENCE-ZING
  • Resources
  • Books
  • Advertise with us
  • Contact

Mapping of 3-D road network of Denmark using R,plotGoogleMaps and googleVis packages

2/22/2016

0 Comments

 
This dataset is downloaded from UCI Machine Learning repository. The purpose of this analysis is to visualize the road network of Denmark. The attributes provided are latitude, longitude and altitude of the road. Visualization is done using R packages plotGoogleMaps and googleVis.

For detailed analysis and code visit my Github repository

Create a new category for Altitude field

spatial_network$altitude_category<-NA
spatial_network$altitude_category[spatial_network$altitude<0]<-"Very Low"
spatial_network$altitude_category[spatial_network$altitude>0 & spatial_network$altitude<50]<-"Low"
spatial_network$altitude_category[spatial_network$altitude>50 & spatial_network$altitude<100]<-"High"
spatial_network$altitude_category[spatial_network$altitude>100]<-"Very High"

Mapping using plotGoogleMaps and R

Picture
#Plotting using plotGoogleMaps

library(plotGoogleMaps)
spatial2<-spatial_network[1:50000,]
coordinates(spatial2)<- ~ longitude+latitude proj4string(spatial2) =CRS("+proj=longlat+datum=WGS84")
ic<iconlabels(attribute=spatial_network$altitude_category,colPalette=rainbow(4),icon=TRUE,at=NULL,height=10,scale=0.6)
spatial3<-SpatialPointsDataFrame(spatial2,data = data.frame(ID=row.names(spatial2)))
m<-plotGoogleMaps(spatial3,filename = "myMap1.html",iconMarker = ic)

Mapping using googleVis and R

Picture
# Plotting using googleVis

library(googleVis)
spatial_network$latlon <- paste(spatial_network$latitude, spatial_network$longitude,
    sep = ":")
map <- gvisMap(spatial_network, locationvar = "latlon", tipvar = "altitude_category",
    options = list(showTip = T, showLine = F, enableScrollWheel = TRUE, useMapTypeControl = TRUE,
        width = 1400, height = 800, allowHtml = TRUE))
plot
(map)
0 Comments
    Picture

      Subscribe now

    Subscribe to Newsletter
    Picture

    RSS Feed

    Categories

    All
    Basics
    Classification
    Clustering
    Courses
    Foreacsting
    Machine Learning
    Mapping
    R
    Regression
    Shiny
    Visualization

    Picture
    Picture
    Picture
    Picture
Proudly powered by Weebly
  • Resources
  • Books
  • Advertise with us
  • Contact