views:

655

answers:

5

Is it feasible, or advisable, to attempt to make a Google Maps mashup using C++? I would need to be able to display 150 some locations around a county and when people click on the push pin a picture of the location would need to pop up and perhaps a brief description of the landscape there.

C++ is the only language I know as it is all I have studied so far in school. This is not a homework assignment but rather something I thought I could do for work, and for fun.

+1  A: 

The GMaps API is all JavaScript, therefore any interactions you make with the map are via Javascript. However, there is no reason that you couldn't write a C++ based CGI application which generated the necessary JavaScript and HTML.

Tim
Having no knowledge of JavaScript or HTML that sounds like it might be complicated, but it also sounds interesting.
nmr
A: 

I wrote a flash application a while back to use the Google tile servers. It's really not so hard.

The maps are recursively sub-divided into 2x2 squares, and a formula can be derived.

This thread should prove interesting:

http://groups.google.com/group/google-maps-api/browse%5Fthread/thread/a09932b9a971cf26/9986f9a3cbc034e3?#9986f9a3cbc034e3

spender
A: 

Seeing as you probably only have beginner C++ (based on learning it at school) learning javascript and using the official google maps api is going to be infinitely easier than doing anything with it in C++. The example you describe (150 markers with pop-up) is trivial with the javascript API.

micmcg
+3  A: 

It's certainly feasible (as a standalone GUI application, for example). But, is it advisable? I wouldn't say so, unless you plan to do it as a learning project.

C++ is the only language I know as it is all I have studied so far in school.

You're supposed to pick up languages on your own.

Javascript has a familiar syntax, but it has functional features, and objects work differently. So just as a caution, when you learn it, don't think of it as a cpp-like scripting language; it's not.

hasen j
A: 

FWIW - It's really not very difficult to simply write some KML out to disk and then point GE at it. We did this to take a database of world-wide airport landing strips and have GE "fly" to the end of each runway and take a snapshot, save to disk, and move on.

Here's some similar code we did, for other sites of interest (can't find the runway code just now.)

FILE* pFile = std::fopen(fspec.c_str(),"w");
std::fprintf(pFile,"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
std::fprintf(pFile,"<kml xmlns=\"http://earth.google.com/kml/2.0\"&gt;\n");
std::fprintf(pFile,"    <Placemark>\n");
std::fprintf(pFile,"      <name>%s %s %s</name>\n",eosite.Ident.c_str(),epochStr.c_str(),eosite.Nomenclature.c_str());
std::fprintf(pFile,"      <LookAt>\n");
std::fprintf(pFile,"        <longitude>%Lf</longitude>\n",lon);
std::fprintf(pFile,"        <latitude>%Lf</latitude>\n",lat);
std::fprintf(pFile,"        <range>%0.5Lf</range>\n",aosRange); // range from eye to point site, consider altitude & angle
std::fprintf(pFile,"        <tilt>%0.5Lf</tilt>\n",(90.L - srtl::radtodeg(aosElev))); // Horizon is down 18 deg at iss typ. altitude
std::fprintf(pFile,"        <heading>%0.5Lf</heading>\n",srtl::radtodeg(aosAzimuth)); // calc az to target at aos or mel & insert here
std::fprintf(pFile,"      </LookAt>\n");
std::fprintf(pFile,"      <styleUrl>root://styles#default</styleUrl>\n");
std::fprintf(pFile,"      <Point>\n");
std::fprintf(pFile,"        <coordinates>%Lf,%Lf,%Lf</coordinates>\n", lon, lat, 0.L); // site coords
std::fprintf(pFile,"      </Point>\n");
std::fprintf(pFile,"    </Placemark>\n");
std::fprintf(pFile,"</kml>\n");
std::fclose(pFile);
pFile = NULL;
Brian D. Coryell