views:

64

answers:

2

Hello evertbody,

First i am a beginner in programming in general, i am trying to create a program for using gps locations from Lightroom on a map in googlemaps.

When i use the print the strings below ti the screen i see 5 different value's, this is also what i want, but...

I want to create also 5 different markers on the map this is done by the addMarkerByCoords Function but how can i use the 5 vaulue per strings in the funtion ?

I have tried array, foreach but i cannot getting to work. The not working part can and proberly will be my fault. LOL

 print_r ("$Loncoord");
 print_r ("$Latcoord");
 print_r ("$gui");

//$map->formatOutput = true;

  $map->addMarkerByCoords("$Loncoord","$Latcoord","$gui",'<b>Old Chicago</b>');

Can somebode give me a hint ?

To: Jonathan Sampson: outputs print_r :-5.68166666667, +24.6513888889,IMG_3308,index.html,Landschap

To: Anti Veeranna I removed the " marks (and the program stll works), but can you explain why this is better ?

And to the others Thank you very very much for the effort,work and really quick responses.

A: 
$map->addMarkerByCoords(Array($Loncoord, $Latcoord, $gui, '<b>Old Chicago</b>));

??

MiffTheFox
+2  A: 

Assuming that this is PHP, you could us an array of arrays, and then loop.

Something like this:

$items = array(
    array( 
      'long'     => 12.34567,
      'lat'      => 34.56789,
      'gui'      => '????',
      'location' => 'old chicago'
    ),

    ...

    array( 
      'long'     => 12.34567,
      'lat'      => 34.56789,
      'gui'      => '????',
      'location' => 'old chicago 5'
    )
);

foreach ($items as &$item) {
    $map->addMarkerByCoords(
         $item['long'],
         $item['lat'],
         $item['gui'],
         $item['location']
    );
}

unset($item);
mschmidt42