Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8261683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:29:44+00:00 2026-06-08T03:29:44+00:00

So, currently I have successfully compiled the program (with RInside ) for plotting coordinates

  • 0

So, currently I have successfully compiled the program (with RInside) for plotting coordinates on the static maps of Google (on Qt).

Now, I have to plot the coordinates on the map as they are received from the GPS.

Is it possible somehow to display the newly plotted points on the png “on the fly”?
I mean I don’t wish to read the png from the harddisk every time I receive a new point.


From here: http://cran.r-project.org/web/packages/png/png.pdf

This package provides an easy and simple way to read,write and display bitmap images stored in the PNG format. It can read and write both files and in-memory raw vectors.

Can this be of any help?


#include <RInside.h>
#include <Rcpp.h>
#include <iostream>

int main (int argc, char *argv[])
{
    std :: cout << "\nThank-SO :-)\n";

    RInside R (argc, argv);

    std :: string txtA = "library(RgoogleMaps)";
    std :: string txtB = "png(filename='Rg.png', width=480, height=480)";

    std :: string txtC = "lat = c(40.702147,40.718217,40.711614)";
    std :: string txtD = "lon = c(-74.012318,-74.015794,-73.998284)";
    std :: string txtE = "center = c(mean(lat), mean(lon))";
    std :: string txtF = "zoom <- min(MaxZoom(range(lat), range(lon)))";

    std :: string txtG = "MyMap <- GetMap(center=center, zoom=zoom, markers='&40.702147,-74.015794,blues%7C40.711614,-74.012318,greeng%7C40.718217,-73.998284,redc', destfile='My.png')";

    std :: string txtH = "tmp <- PlotOnStaticMap(MyMap,lat=c(40.702147,40.711614,40.718217),lon=c(-74.015794,-74.012318,-73.998284),cex=1.5,pch=20,col=c('red', 'blue', 'green'),add=F)";

    std :: string txtI = "dev.off()";

    R.parseEvalQ (txtA);
    R.parseEvalQ (txtB);
    R.parseEvalQ (txtC);
    R.parseEvalQ (txtD);
    R.parseEvalQ (txtE);
    R.parseEvalQ (txtF);
    R.parseEvalQ (txtG);
    R.parseEvalQ (txtH);
    R.parseEvalQ (txtI);

    return 0;
}

This is the C++ code written with RInside.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T03:29:46+00:00Added an answer on June 8, 2026 at 3:29 am

    You can plot the map yourself using the png package that you mention (or other tools), then you need some way of mapping between the plot coordinates and the gps coordinates.

    If the region of the map is small enough that you are happy with a cartesian approximation then a simple way is to use the updateusr function in the TeachingDemos package to change the plot coordinates to match with your lat/long information, you will need to know the lat and long for 2 points on the map and you can find their original coordinates using the locator function (or if they are corners then you may not need locator). Then you can just use the points function to add points on top of the map without needing to reread or replot it. This is probably fine if the map is of a city or smaller region, but could start to suffer from the approximation if you are trying to show a whole country.

    For different projections you can find a way to convert from lat/long to the current plots coordinates, then use points with the converted coordinates. The sp package and others may be of help here.

    A couple of other packages to consider (if the current functions in the package are not enough, you could still look at the code to get ideas and/or modify the code to use your png file(s)) are RgoogleMaps and ggmap.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have the following objects persisting successfully: Person first name, etc. Exams title,
I have the following script that successfully retrieves the current track and updates my
Currently have a drop down menu that is activated on a hover (from display:none
Currently have password protection on my main and sub directories, however I'd like to
I currently have a XSLT 2.0 Stylesheet that I am trying to remove empty
I currently have a table of concentrations, which are linked to a table of
I currently have one project that currently contains multiple packages. These packages make up
I currently have 4 tables. Product, Category, SubCategory, ProductSubCategory. Category has a OneToMany SubCategory
I currently have a form with inputs and name attributes. I'm able to get
I currently have a deployed app (fortworth.herokuapp.com) that I am attempting to sort movies

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.