Dear Abhishek,

Here is reproducible example, doing what you want to get. I guess.

Best,

Milan


library(plotGoogleMaps)

# Point data

data(meuse)
coordinates(meuse)<-~x+y
proj4string(meuse) <- CRS('+init=epsg:28992')

ma<-plotGoogleMaps(meuse,zcol="ffreq",
colPalette=c("#FFF7BC","#FEC44F","#D95F0E"),
                   filename='myMap82.html',mapTypeId= 'TERRAIN',
                   fitBounds=T)


#################
# Show text in markers

meuse$ffreq2 <- factor(meuse$ffreq, labels = c("One", "Two", "Three"))

ma<-plotGoogleMaps(meuse,zcol="ffreq2",
colPalette=c("#FFF7BC","#FEC44F","#D95F0E"),
                   filename='myMap82.html',mapTypeId= 'TERRAIN',
                   fitBounds=T)

#################
# Show just labels (text) without markers

ma<-plotGoogleMaps(meuse,zcol="ffreq2",
                   iconMarker= iconlabels(meuse$ffreq2,
colPalette=c("#FFF7BC","#FEC44F","#D95F0E")),
                   colPalette=c("#FFF7BC","#FEC44F","#D95F0E"),
                   filename='myMap82.html',mapTypeId= 'TERRAIN',
                   fitBounds=T)




On Wed, Jan 22, 2014 at 7:57 AM, Abhishek Kapoor <kapoor.ab@gmail.com>wrote:

> Hi Sir,
>
> is it possible to plot map using factor variable?
>
> I am trying to plot ATMs, Hospital, and restaurant location (Lat/Long) and
> with address but i m not getting desired result.
>
> Below is the code
>
>
> eq <- read.csv ('C:/Users/abc/Desktop/2013_08_01_NCR_Master.csv')
> str (eq)
>
> 'data.frame':   13430 obs. of  6 variables:
>  $ Type       : Factor w/ 3 levels "ATM","Hospital",..: 2 2 2 2 2 2 2 2 2 2
> ...
>  $ Lat        : num  28.5 28.5 28.4 28.6 28.7 ...
>  $ Lng        : num  77 77 77 77 77 ...
>  $ PhoneNumber: Factor w/ 5562 levels "","0","011 2004 4406",..: 4922 1
> 2610
> 1 1 2669 1 2652 1 4075 ...
>  $ Address    : Factor w/ 13394 levels "???, IGI Airport T3 Road, IGI
> Airport, New Delhi, DL",..: 11064 11071 13208 9306 12497 2644 10809 9722
> 6499 12089 ...
>  $ Type1      : int  2 2 2 2 2 2 2 2 2 2 ...
>
> coordinates(eq) = ~Lng + Lat
> proj4string(eq) = CRS("+proj=longlat +datum=WGS84")
> eq <- SpatialPointsDataFrame( eq , data = data.frame( id = row.names( eq )
> )
> )
>
> ma<-plotGoogleMaps(eq,zcol="Type", colPalette=c("#FFF7BC",
> "#FEC44F","#D95F0E"),filename='myMap82.html',mapTypeId= 'TERRAIN',
> fitBounds=T)
>
> but it is not producing desired results
> I want only 3 color bubbles by "Type" - ATM, Hospital & Restaurants
>
> I hope you can help me, this is my first time in R.
>
> I am using Windows and R is 3.0.2
> Thanks in advance
>
> Regards
> Abhishek
>
>
>
> --
> View this message in context:
> http://r-sig-geo.2731867.n2.nabble.com/plotGoogleMaps-Represent-Text-on-map-tp7585603.html
> Sent from the R-sig-geo mailing list archive at Nabble.com.
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



-- 
Milan Kilibarda

University of Belgrade,
Faculty of Civil Engineering,
Department of Geodesy and Geoinformatics,
Address: Bulevar kralja Aleksandra 73  11000 Belgrade, Serbia,
Mail:  kili@grf.bg.ac.rs

tel:+381 11 3218516

	[[alternative HTML version deleted]]

