We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11927
    • 105 Posts
    Does any one know of a good program or way to create a map that updates dynamically from information from a database?

    The information is the territories that are not for sale, so I would want to show the territories that are for sale in blue and the ones not for sale in gray. The territory boundaries are zip codes, roughly.

    I tried creating an image for each zip code and overlapping them, but that takes too long to load. Even if the files are gif I only load the images that not available which are gray over one image that is blue.
      You may or may not want to use the code I write. It's probably all against the syntax rules of php and MODx. smiley

      Carpet Cleaning
    • This might be of interest to you. http://dev.mysql.com/doc/refman/5.0/en/spatial-extensions.html

      Google Maps uses AJAX, and also has an API for letting you create your own maps http://code.google.com/apis/maps/index.html
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 4172
        • 5,888 Posts
        this script can merge transparent gifs of same size together and saves it to a new gif.
        You can run that script onSaveSomething.

        <?php
        
        $regions='calabria,abruzzo,toscana';
        $regions=explode(',',$regions);
        
        // Create image instances
        $src_path = $modx->getOption('assets_path').'images/map/';
        $src_url =  $modx->getOption('assets_url').'images/map/';
        
        $dest = imagecreatefromgif($src_path.'italia.gif');
        
        //Get the sizes of image   
            $srcx=imageSX($dest);
            $srcy=imageSY($dest);
        
        // Copy and merge images together
        foreach ($regions as $region){
            $src = imagecreatefromgif($src_path.$region.'.gif');
            imagecopymerge($dest, $src, 0, 0, 0, 0, $srcx, $srcy, 100);
        }
        
        
        // Save the image as a GIF
        $img = imagegif($dest,$src_path.'map.gif');
        
        // Output and free from memory
        $out = '<img src="'.$src_url.'map.gif"/>';
        // Free from memory
        
        imagedestroy($dest);
        imagedestroy($src);
        
        
        return $out;
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 11927
          • 105 Posts
          sottwell ~ Thanks for the information. I looked into google maps api from the link you gave me and the only way I could tell to color code zip codes is by having the exact boundaries of each zip code. Getting up to date information like that is pretty pricey. Thank you though.

          Bruno 17 ~ I’m still amazed by all the things that can be done with php. Thank you. I think this may be the way to go.
            You may or may not want to use the code I write. It&#39;s probably all against the syntax rules of php and MODx. smiley

            Carpet Cleaning