Announcement

Collapse
No announcement yet.

How implement a GIS Google Map with multiple occurencies

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How implement a GIS Google Map with multiple occurencies

    Hi all,

    I would like to implement an application that takes addresses data from a SC table and then, by itself , create a grouped Google Map or something like that where I can check
    different people of the group and their own address and data.
    Have a look to result here : http://batchgeo.com/map/4a0d8c69e9ec...e5a4cd09759e25

    Could then the map be visible under for instance as graph within a container ?
    Thanks
    Giovannino
    Attached Files

  • #2
    PHP Class for showing multiple point and markers

    please check my attachment, extractit, and load these 2 files as library:
    simpleGMapAPI.php
    simpleGMapGeocoder.php

    you can use it, say it in a blank application, then simply call like this:
    PHP Code:
    $map = new simpleGMapAPI();
    $geo = new simpleGMapGeocoder();

    //dimensi 600x600 pixel max utk versi GRaTiSaN
    $map->setWidth(600);
    $map->setHeight(600);
    $map->setBackgroundColor('#d0d0d0');
    $map->setMapDraggable(true);
    $map->setDoubleclickZoom(false);
    $map->setScrollwheelZoom(true);

    $map->showDefaultUI(false);
    $map->showMapTypeControl(true'DROPDOWN_MENU');
    $map->showNavigationControl(true'DEFAULT');
    $map->showScaleControl(true);
    $map->showStreetViewControl(true);

    $map->setZoomLevel(14); // not really needed because showMap is called in this demo with auto zoom
    $map->setInfoWindowBehaviour('SINGLE_CLOSE_ON_MAPCLICK');
    $map->setInfoWindowTrigger('CLICK');

    $map->addMarkerByAddress("Ravensberger Park 1 , Bielefeld""Ravensberger Spinnerei""Ravensberger Spinnerei""http://google-maps-icons.googlecode.com/files/museum-historical.png");
    $map->addMarkerByAddress("Universitätsstraße 25, Bielefeld""Universität Bielefeld""<a href=\"http://www.uni-bielefeld.de\" target=\"_blank\">http://www.uni-bielefeld.de</a>""http://google-maps-icons.googlecode.com/files/university.png");
    $map->addMarker(52.01494368.5275128"Sparrenburg Bielefeld""Sparrenburg, 33602 Bielefeld, Deutschland<br /><img src=\"http://www.bielefeld.de/ftp/bilder/sehenswuerdigkeiten/sehenswuerdigkeiten/sparrenburg-bielefeld-435.gif\"""http://google-maps-icons.googlecode.com/files/museum-archeological.png");

    $opts = array('fillColor'=>'#0000dd''fillOpacity'=>0.2'strokeColor'=>'#000000''strokeOpacity'=>1'strokeWeight'=>2'clickable'=>true);
    $map->addCircle(52.01494368.52751281500"1,5km Umgebung um die Sparrenburg"$opts);

    $opts = array('fillColor'=>'#00dd00''fillOpacity'=>0.2'strokeColor'=>'#003300''strokeOpacity'=>1'strokeWeight'=>2'clickable'=>true);
    $map->addRectangle(52.03388.48752.04148.502"Campus Universität Bielefeld"$opts);

    echo 
    "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
    echo 
    "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n";
    echo 
    "<head>\n";
    echo 
    "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />\n";
    echo 
    "<title>simpleGMapAPI test</title>";

    $map->printGMapsJS();

    echo 
    "</head>\n";
    echo 
    "\n\n<body>\n\n";

    // showMap with auto zoom enabled, kalo set false, harus isi zoom levelnya
    $map->showMap(true);

    echo 
    "</body>\n";
    echo 
    "</html>\n"
    please check more carefully in this section:
    PHP Code:
    $map->addMarkerByAddress("Ravensberger Park 1 , Bielefeld""Ravensberger Spinnerei""Ravensberger Spinnerei""http://google-maps-icons.googlecode.com/files/museum-historical.png");
    $map->addMarkerByAddress("Universitätsstraße 25, Bielefeld""Universität Bielefeld""<a href=\"http://www.uni-bielefeld.de\" target=\"_blank\">http://www.uni-bielefeld.de</a>""http://google-maps-icons.googlecode.com/files/university.png");
    $map->addMarker(52.01494368.5275128"Sparrenburg Bielefeld""Sparrenburg, 33602 Bielefeld, Deutschland<br /><img src=\"http://www.bielefeld.de/ftp/bilder/sehenswuerdigkeiten/sehenswuerdigkeiten/sparrenburg-bielefeld-435.gif\"""http://google-maps-icons.googlecode.com/files/museum-archeological.png"); 
    you can use array multi dimension for handling the latlong data (but still i have trouble passing a multi diension array to blank application from other application).

    i hope this simple example will help you showing many points and markers. it seems using Google Map API V.3 already. you don't need any API key.
    this example using blank application and still i don't have any idea how to "close" this blank application when it shows as modal. so i use blank application to open in another window (target _blank). and let the users close the window after they see the map :P
    Attached Files
    -Iwan P-

    Comment


    • #3
      Originally posted by iwanpc View Post
      PHP Class for showing multiple point and markers

      please check my attachment, extractit, and load these 2 files as library:
      simpleGMapAPI.php
      simpleGMapGeocoder.php
      Hi iwanpc, could you upload the api´s again? it is not longer available... thank you!

      Comment


      • #4
        Hi Ivan, thanks so much for interesting post. I will try to implement it also if I'm not so confident with complex coding ;-))
        I've tried to download the file but It seems not availble.
        Bye

        Comment


        • #5
          iwanpc the download is available again.. but: I insert the the both libaries (with upload) as project libaries.
          now, I tried to create a blank app and paste the test php... but I get an error, with the tags ?> and <? like:
          PHP Code:
          ?>
          require_once("simpleGMapAPI.php");
          require_once("simpleGMapGeocoder.php");

          $map = new simpleGMapAPI();
          $geo = new simpleGMapGeocoder();

          $map->setWidth(600);
          $map->setHeight(600);
          $map->setBackgroundColor('#d0d0d0');
          $map->setMapDraggable(true);
          $map->setDoubleclickZoom(false);
          $map->setScrollwheelZoom(true);

          $map->showDefaultUI(false);
          $map->showMapTypeControl(true, 'DROPDOWN_MENU');
          $map->showNavigationControl(true, 'DEFAULT');
          $map->showScaleControl(true);
          $map->showStreetViewControl(true);

          $map->setZoomLevel(14); // not really needed because showMap is called in this demo with auto zoom
          $map->setInfoWindowBehaviour('SINGLE_CLOSE_ON_MAPCLICK');
          $map->setInfoWindowTrigger('CLICK');

          $map->addMarkerByAddress("Ravensberger Park 1 , Bielefeld", "Ravensberger Spinnerei", "Ravensberger Spinnerei", "http://google-maps-icons.googlecode.com/files/museum-historical.png");
          $map->addMarkerByAddress("Universitätsstraße 25, Bielefeld", "Universität Bielefeld", "<a href="http://www.uni-bielefeld.de" target="_blank">http://www.uni-bielefeld.de</a>", "http://google-maps-icons.googlecode.com/files/university.png");
          $map->addMarker(52.0149436, 8.5275128, "Sparrenburg Bielefeld", "Sparrenburg, 33602 Bielefeld, Deutschland<br /><img src="http://www.bielefeld.de/ftp/bilder/sehenswuerdigkeiten/sehenswuerdigkeiten/sparrenburg-bielefeld-435.gif"", "http://google-maps-icons.googlecode.com/files/museum-archeological.png");

          $opts = array('fillColor'=>'#0000dd', 'fillOpacity'=>0.2, 'strokeColor'=>'#000000', 'strokeOpacity'=>1, 'strokeWeight'=>2, 'clickable'=>true);
          $map->addCircle(52.0149436, 8.5275128, 1500, "1,5km Umgebung um die Sparrenburg", $opts);

          $opts = array('fillColor'=>'#00dd00', 'fillOpacity'=>0.2, 'strokeColor'=>'#003300', 'strokeOpacity'=>1, 'strokeWeight'=>2, 'clickable'=>true);
          $map->addRectangle(52.0338, 8.487, 52.0414, 8.502, "Campus Universität Bielefeld", $opts);

          echo "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n";
          echo "<html xmlns="http://www.w3.org/1999/xhtml">\n";
          echo "<head>\n";
          echo "<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />\n";
          echo "<title>simpleGMapAPI test</title>";

          $map->printGMapsJS();

          echo "</head>\n";
          echo "\n\n<body>\n\n";

          // showMap with auto zoom enabled
          $map->showMap(true);

          echo "</body>\n";
          echo "</html>\n";

          <?
          I get output like:
          HTML Code:
          require_once("simpleGMapAPI.php"); require_once("simpleGMapGeocoder.php"); $map = new simpleGMapAPI(); $geo = new simpleGMapGeocoder(); $map->setWidth(600); $map->setHeight(600); $map->setBackgroundColor('#d0d0d0'); $map->setMapDraggable(true); $map->setDoubleclickZoom(false); $map->setScrollwheelZoom(true); $map->showDefaultUI(false); $map->showMapTypeControl(true, 'DROPDOWN_MENU'); $map->showNavigationControl(true, 'DEFAULT'); $map->showScaleControl(true); $map->showStreetViewControl(true); $map->setZoomLevel(14); $map->setInfoWindowBehaviour('SINGLE_CLOSE_ON_MAPCLICK'); $map->setInfoWindowTrigger('CLICK'); $map->addMarkerByAddress("Ravensberger Park 1 , Bielefeld", "Ravensberger Spinnerei", "Ravensberger Spinnerei", "http://google-maps-icons.googlecode.com/files/museum-historical.png"); $map->addMarkerByAddress("UniversitÀtsstraße 25, Bielefeld", "UniversitÀt Bielefeld", "http://www.uni-bielefeld.de", "http://google-maps-icons.googlecode.com/files/university.png"); $map->addMarker(52.0149436, 8.5275128, "Sparrenburg Bielefeld", "Sparrenburg, 33602 Bielefeld, Deutschland
          '#0000dd', 'fillOpacity'=>0.2, 'strokeColor'=>'#000000', 'strokeOpacity'=>1, 'strokeWeight'=>2, 'clickable'=>true); $map->addCircle(52.0149436, 8.5275128, 1500, "1,5km Umgebung um die Sparrenburg", $opts); $opts = array('fillColor'=>'#00dd00', 'fillOpacity'=>0.2, 'strokeColor'=>'#003300', 'strokeOpacity'=>1, 'strokeWeight'=>2, 'clickable'=>true); $map->addRectangle(52.0338, 8.487, 52.0414, 8.502, "Campus UniversitÀt Bielefeld", $opts); echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo ""; $map->printGMapsJS(); echo "\n"; echo "\n\n\n\n"; $map->showMap(true); echo "\n"; echo "\n";
          Could you imagine whats wrong?

          btw: schöne Grüße von Dresden nach Bielefeld ;-)

          Comment


          • #6
            wow... it was 4 yrs old example. perhaps when i was still using SC 6 or 7 :-lol.
            this is my example step by step, shown in these attached pics.

            and also here is i upload again the 2 libraries.
            so far, it works well, but it works faster when i deploy in the real server which is connected to the internet instead of this trial server in my PC.

            probably u can check better example and libraries in this link below:
            https://www.phpclasses.org/package/6...-Maps-API.html

            @ny_unity: just an example... a very old example
            Attached Files
            -Iwan P-

            Comment

            Working...
            X