Lamhot / php-google-map-api

Automatically exported from code.google.com/p/php-google-map-api
0 stars 0 forks source link

New Feature Request: Draw Radius Circle #1

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Draw a radius circle form a lat/lon point to x miles, or x feet.

ie: $map->DrawRadius($lon, $lat, '1.0', 'M');
$map->DrawRadius($lon, $lat, '1500', 'F');
$map->DrawRadius($lon, $lat, '1500', 'S');

where M = Miles, F = feet, S = Survey Feet

Thanks!

Original issue reported on code.google.com by rec9...@gmail.com on 7 May 2010 at 9:03

GoogleCodeExporter commented 9 years ago
I second this!  I have had this need many times!  If it could do this from an 
address that would be even better!  Also multiple circles on one map with a 
transparent color overlay.

Original comment by karp13@gmail.com on 9 Jul 2010 at 9:20

GoogleCodeExporter commented 9 years ago
I'd love this too

Original comment by dynamica...@gmail.com on 28 Nov 2010 at 12:15

GoogleCodeExporter commented 9 years ago
I second this too, as I was thinking of putting together my own dodgy job of 
this, but I'd rather leave it to someone who understands the API better.

Original comment by arf...@gmail.com on 4 May 2011 at 4:40

GoogleCodeExporter commented 9 years ago
I need this :) 

Original comment by mgundl...@gmail.com on 8 Jul 2011 at 10:16

GoogleCodeExporter commented 9 years ago
I needed this and used an aproximation. I used a polygon with many vertices to 
asimilate a circle. If you would like to use this:

    function addCircle($lon,$lat,$radius,$id,$color='',$weight=0,$opacity=0,$fill_color='',$fill_opacity=0){
        $i=0;
        for ($alpha=0;$alpha<360;$alpha=$alpha+15)
         {
             $coords[$i]["long"]=$lon+sin(deg2rad($alpha))*$radius;
             $coords[$i]["lat"]=$lat+cos(deg2rad($alpha))*$radius/1.413333;
             $i++;
         }
        $coords[$i]["long"]=$coords[0]["long"];
        $coords[$i]["lat"]=$coords[0]["lat"];
        $id = $this->addPolygonByCoordsArray($coords,$id,$color,$weight,$opacity,$fill_color,$fill_opacity);
        return $id;
    }

Original comment by Sorin.R...@gmail.com on 12 Jul 2011 at 10:29

GoogleCodeExporter commented 9 years ago
This is now supported by the javascript api 
(http://code.google.com/apis/maps/documentation/javascript/overlays.html#BasicSh
apes) - I'm working on a solution for the php side of things, but in the 
interim, something like this works:

var circleOptions = {
    strokeColor: "#FF0000"
    strokeOpacity: 0.8,
    strokeWeight: 2,
    fillColor: "#FF0000",
    fillOpacity: 0.35,
    map: mapmap /*default map id output by php class*/,
    center: new google.maps.LatLng(0,0),
    radius: 200000 /*radius in meters*/
};
circle = new google.maps.Circle(circleOptions);

Original comment by b...@mycnl.com on 18 Sep 2011 at 4:54

GoogleCodeExporter commented 9 years ago

Original comment by b...@mycnl.com on 25 Sep 2011 at 5:42