On Mar 6, 8:41 am, schmke <[email protected]> wrote:
> I'm creating a heatmap from user and download data but some of my
> data has just country whereas some I have specific addresses.  The
> addresses work great and I can place my marker, but placing tens if
> not hundreds or markers in the same spot for the country only
> entries doesn't create a very interesting map.
>
> What I'd like is a way to specify a country and get a random
> lat/lng location within that country.  Yes, I could get a list of
> cities for every country and randomly code a random city, but I
> need to do this for potentially every country so would prefer to
> not have to compile the city list like that.
>
> My other idea is to geocode the country (should give the "center"
> of the country" and then add/subtract a random lat/lng value to get
> a random location, but countries vary so much in size this would be
> difficult to get a good distribution around a country.
>
> Other ideas?

Make a special random point in country geocoder:
1. Get polygons of the countries' boundaries.
2. Generate random lat/lng points within the LatLngBounds of the
polygon/country of interest
3. Verify it is within the polygon/country's bounds, repeat until it
is.
4. Save it in your database for that piece of data.

  -- Larry

>
> I'm posting this to the V2 forum as that is the API I've been using
> but could use the V3 API too.
>
> Thanks!
>
> Kevin

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API V2" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-api?hl=en.

Reply via email to