Hi Rashid
This PHP/MySQL query gives the first 20 locations from centre within a
given radius.
Hope this is of help
See http://davie.easypagez.com/maps/map1.php
This is based on UK place names or postcodes.
Regards Davie
// Search the rows in the markers table
$query = sprintf("SELECT address, name, lat, lng, ( 3959 *
acos( cos( radians('%s') ) * cos( radians( lat ) ) *
cos( radians( lng ) - radians('%s') ) + sin( radians('%s') ) *
sin( radians( lat ) ) ) ) AS distance FROM markers HAVING distance <
'%s' ORDER BY distance LIMIT 0 , 20",
mysql_real_escape_string($center_lat),
mysql_real_escape_string($center_lng),
mysql_real_escape_string($center_lat),
mysql_real_escape_string($radius));
$result = mysql_query($query);
On Apr 28, 2:21 pm, rashid herrera <[email protected]> wrote:
> Hello Adan.
>
> Many thanks, I think this is what I need.
>
> All our points are stored in a database, as you can see here (click in the
> map menu), this is only one hotel of many, but all the lat and log are in
> the database, and we also have the lat long of the city.
>
> http://www.southerncostarica.biz/Dominical/cat-hotels/Hotel-Domilocos...
>
> <http://www.southerncostarica.biz/Dominical/cat-hotels/Hotel-Domilocos...>We
> have to test and try, but this is a good starting point.
>
> Thanks.
> ----
> Rashid Herrera M.
> Managerwww.GalleryWebs.Comwww.mercadeo-web.com
> Costa Rica Web Design and Search Engine Optimization Company.
> Off. 011.506. 2772-5911
> Cell. 011.506. 8354-5891www.SouthernCostaRica.Biz,
> Skype: gallerywebs
> Google talk: [email protected]
> Private Email or msn:
> [email protected]http://www.google.com/profiles/110767658068371718157
>
> 2011/4/27 AdamD <[email protected]>
>
>
>
>
>
>
>
> > Hi Rashid,
>
> > The answer to your question depends on how you are storing the points
> > (hotels in your example). If each hotel is a marker on your map, you
> > could iterate through each marker and calculate the distance between
> > the marker's location and the center of the map using the Haversine
> > formula (a rather complex series of math). Then, if the marker is
> > outside the appropriate distance, you can hide it.
>
> > A more elegant solution would be to store your points in a database
> > and query for only the ones within the allotted distance. This can be
> > done with any database, also using the Haversine formula. However,
> > there are now platforms that perform these "spatial queries" for you.
> > Some potential examples are SimpleGeo, Factual and Google's own Fusion
> > Tables. For the last of these, you can see the documentation for
> > "<spatial_condition>" here:
>
> >http://code.google.com/apis/fusiontables/docs/developers_reference.ht...
>
> > If the city is dynamic (ie, not always Valencia), you'll also need to
> > convert the city name to a latitude and longitude point before doing
> > any of the above.
>
> > Best of luck!
>
> > --Adam DuVander
> >http://mapscripting.com
>
> > On Apr 27, 11:30 pm, rashid herrera <[email protected]> wrote:
> > > Hello.
>
> > > I have a business directory, when someone go to one category, for example
> > > hotels in city=valencia then I want show a list of hotels in valencia, at
> > > the right side a google map with all those hotels and a little bar or
> > drop
> > > down menu that say:
> > > View hotels near:
> > > 5km, 10km, 20 km, 30km, 40 km, 50km, 70 km, 90 km, 120km.
> > > Then in the map the zoom change and the hotels are showed.
>
> > > What I don´t have any idea is how to do that? is there any manual
> > available?
>
> > > thanks.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google Maps JavaScript API v3" 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-js-api-v3?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" 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-js-api-v3?hl=en.