Skip to content

dismo:::gmap - how to obtain a 1:1 plot

5 messages · Alexandre Villers, Ivailo, Robert J. Hijmans

#
Dear R-geo folks,

I am trying to plot some points with gmap(), but the resulting plot is
not the same quality as the (temporarily) stored TIFF file.

My workflow is as follows:

1. get the point coordinates and make them a SpatialPointsDataFrame
2. get a map tile containing the points: localities_map <-
gmap(localities, type = 'terrain', scale = 2) # to get a larger tile
3. re-project localities to Mercator
4. plot(localities_map) and
5. add the points

The the problem is that the resulting plot seems not to be a 1:1
representation of the TIFF file it's based on. I have also tried to
plot directly to a png() device, and even when specifying the size
*and* resolution reported by the RasterLayer where the gmap object is
stored, the plotted map (especially the labels) looks somewhat jagged.

 Is there a way to produce a plot that contains the stored TIFF file
as it is (i.e. 1:1)?

Thanks,
Ivailo
--
UBUNTU: a person is a person through other persons.
#
Hi,

There is an asp options in par. It works with plot and image
plot(x,y, asp=1) or image(x, asp=1) should produce what you're looking for

HTH

Alex
On 02/07/2013 10:31, Ivailo wrote:
#
On Tue, Jul 2, 2013 at 2:40 PM, Alexandre Villers
<villers.alexandre at gmail.com> wrote:
Thank you for the suggestion, Alex, but "asp=1" does not solve the
problem. The final plot is still does not reach the quality of the
downloaded map tile :(

Ivailo
--
UBUNTU: a person is a person through other persons.
#
Ivailo,

You make it very hard to help you because you do not provide a
reproducible example. I do not know what TIFF file you refer to
(probably a .gif file?). The get a better looking plot, you may want
to try something like:

libary(dismo)
g <- gmap('Reykyavik')
plot(g, interpolate=TRUE, maxpixels=10^8)

Robert
On Tue, Jul 2, 2013 at 12:28 PM, Ivailo <ubuntero.9161 at gmail.com> wrote:
#
On Wed, Jul 3, 2013 at 12:51 AM, Robert J. Hijmans <r.hijmans at gmail.com> wrote:
Thank you for the response, Robert!

Of course I mean the temporary .gif file. Here is the one I got from
the Reykyavik example you suggested: http://i.imgur.com/M39o5Lg.gif

Plotting `g` without any arguments as in

png("reykyavik.png")
g <- gmap('Reykyavik')
plot(g)
dev.off()

results in the following: http://i.imgur.com/2l0bgb0.png

The code from your example produces http://i.imgur.com/3whIsfw.png
which is clearly looking better, but I was wondering if I can get a
plot identical to the very tile (http://i.imgur.com/M39o5Lg.gif) the
plots are based on.

Cheers,
Ivailo
--
UBUNTU: a person is a person through other persons.