Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7977587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:14:37+00:00 2026-06-04T09:14:37+00:00

I have a Google Maps Circle drawn on v3 api. When the user has

  • 0

I have a Google Maps Circle drawn on v3 api. When the user has plotted there circle (or polygon if they choose), they can save the data to the server. If the user has picked a radial search, the Centre coordinates and the radius in feet is stored to the database. This means when the user reloads his search, it can pull through the circle again (like below).

Example of load

I’m having 1 problem, however, which is when the user selects what search they would like to use. It loads the polygon fine, if they drew a polygon, and if it’s a circle it pulls through the marker on the center. However what I need is a function in static maps to draw a circle.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T09:14:40+00:00Added an answer on June 4, 2026 at 9:14 am

    A bit late in the game, but nothing I found solved my issue (serverside php only, no javascript).
    I ended up getting there in the end and have detailed my method here: http://jomacinc.com/map-radius/ and the short version is below.

    This PHP function will return an encoded polyline string of lat/lng points in a circle around the specified point, and at the specified radius. The function requires Gabriel Svennerberg’s PHP polyline encoding class available here (http://www.svennerberg.com/examples/polylines/PolylineEncoder.php.txt).

    function GMapCircle($Lat,$Lng,$Rad,$Detail=8){
     $R    = 6371;
    
     $pi   = pi();
    
     $Lat  = ($Lat * $pi) / 180;
     $Lng  = ($Lng * $pi) / 180;
     $d    = $Rad / $R;
    
     $points = array();
     $i = 0;
    
     for($i = 0; $i <= 360; $i+=$Detail):
       $brng = $i * $pi / 180;
    
       $pLat = asin(sin($Lat)*cos($d) + cos($Lat)*sin($d)*cos($brng));
       $pLng = (($Lng + atan2(sin($brng)*sin($d)*cos($Lat), cos($d)-sin($Lat)*sin($pLat))) * 180) / $pi;
       $pLat = ($pLat * 180) /$pi;
    
       $points[] = array($pLat,$pLng);
     endfor;
    
     require_once('PolylineEncoder.php');
     $PolyEnc   = new PolylineEncoder($points);
     $EncString = $PolyEnc->dpEncode();
    
     return $EncString['Points'];
    }
    

    You can now the use the above function to create a static map.

    /* set some options */
    $MapLat    = '-42.88188'; // latitude for map and circle center
    $MapLng    = '147.32427'; // longitude as above
    $MapRadius = 100;         // the radius of our circle (in Kilometres)
    $MapFill   = 'E85F0E';    // fill colour of our circle
    $MapBorder = '91A93A';    // border colour of our circle
    $MapWidth  = 640;         // map image width (max 640px)
    $MapHeight = 480;         // map image height (max 640px)
    
    /* create our encoded polyline string */
    $EncString = GMapCircle($MapLat,$MapLng, $MapRadius);
    
    /* put together the static map URL */
    $MapAPI = 'http://maps.google.com.au/maps/api/staticmap?';
    $MapURL = $MapAPI.'center='.$MapLat.','.$MapLng.'&size='.$MapWidth.'x'.$MapHeight.'&maptype=roadmap&path=fillcolor:0x'.$MapFill.'33%7Ccolor:0x'.$MapBorder.'00%7Cenc:'.$EncString.'&sensor=false';
    
    /* output an image tag with our map as the source */
    echo '<img src="'.$MapURL.'" />'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way I can have a google maps control on a web
I have drawn circle using circle = new google.maps.Circle({ map: map, radius: r, //
i have google Maps and when the user touch any point in the map
I have an application that uses the Google Maps API to geocode distances between
I have a dynamic map in Google Maps (API v2) I want to overlay
On my web page I have already a Google Maps API with a search
I have scoured stackoverflow and other forums including the google maps v3 api docs
I have google maps embedded in my website. Its has markers and when clicked,
I am developing an application via the Google Maps API (Version 3). I have
I'm using the Google Maps API and have added markers. Now I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.