Jump to content

Mats

Members
  • Posts

    355
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by Mats

  1. I have a couple of customers on one.com (Danish company) and it's working out ok. I use mebo.se, a Swedish (pretty close to Denmark) web host, with very fast servers, great support at a low price.  

    • Like 1
  2. Here's the code:

    function convertGeoToPixel($lat, $lon)
      {
            $mapWidth = 38;
            $mapHeight = 109;
    
            $mapLonLeft = 16.37007904846189;
            $mapLonRight = 17.151481636352514;
            $mapLonDelta = $mapLonRight - $mapLonLeft;
    
            $mapLatBottom = 56.1947686858922;
            $mapLatBottomDegree = $mapLatBottom * M_PI / 180;
    
          $x = ($lon - $mapLonLeft) * ($mapWidth / $mapLonDelta);
    
          $lat = $lat * M_PI / 180;
          $worldMapWidth = (($mapWidth / $mapLonDelta) * 360) / (2 * M_PI);
          $mapOffsetY = ($worldMapWidth / 2 * log((1 + sin($mapLatBottomDegree)) / (1 - sin($mapLatBottomDegree))));
          $y = $mapHeight - (($worldMapWidth / 2 * log((1 + sin($lat)) / (1 - sin($lat)))) - $mapOffsetY);
    
          return array($x, $y);
      }
    $pposition = convertGeoToPixel($pl->map->lat, $pl->map->lng);
    echo  "<div class='litenkarta'><div class='punkt' style='left: {$pposition[0]}px; top: {$pposition[1]}px; '></div></div>";
    • Like 3
  3. Hi Rick!

    I use InputfieldMapMarker for the lat/lng coordinates (used for google/mapbox maps mainly) and the code from the SO link to convert the lat/lng to x/y pixel coordinate dynamicly. I'm only using the conversion on one image but i guess you could use 

    $image->width
    $image->height 
    

    to make it work with uploaded images.

×
×
  • Create New...