Cale Grainger
Cale Grainger

Reputation: 3

How can I create a search which gives a map as a result?

I'm looking for a mapping API, perhaps Google Maps, which I can use from (or at least mostly from) Javascript and/or jQuery. I want to be able to search for results in a location and have little markers appear over the area for the results.

Can Google Maps be used in this way? Could I mix Google Maps with my own database of listings, and make it so that when a user searched terms that matched listings in my database results from my database (in the form of markers indicating their location) would come up on the Google map on my webpage?

I would also like to customize the color and images on the map to fit the theme of my site, if that is possible.

Upvotes: 0

Views: 139

Answers (4)

Adrien Hadj-Salah
Adrien Hadj-Salah

Reputation: 206

Take a look to gmap3.net (http://gmap3.net/). It a great javascript plugin which help to build beautiful and consistent Google Maps.

I suggest you to:

1) Use HTML + Javascript and Gmap3.js to have a map with the data you want. Create fake data at first.

2) Then use Jquery and Ajax to query your database through Php. When you load your data, you can receive it in JSON, parse it in javascript and then display it on the map.

Have fun !

Upvotes: 1

Andrew Dwyer
Andrew Dwyer

Reputation: 446

You could quite easily build a web map client using Google Maps or the OpenSource OpenLayers library. Take a look at their examples page. You can simple copy and paste an complete example to get started.

GeoNames provides a number of services to search their massive database of locations. You'll just need to sign up for a free account. You can then develop a client to search the services and plot the points onto your map.

As for the maps themselves, the OpenLayers examples page provide all the code you need to use Google Maps, Bing, OpenStreetMaps, or a bunch of other map services.

Upvotes: 0

James Nicholson
James Nicholson

Reputation: 973

Have a look at the code samples of google maps api. Javascript yes!

https://developers.google.com/maps/documentation/javascript/examples/

Upvotes: 0

Sheena
Sheena

Reputation: 16242

Number 1 is a bit vague but anyway, the short answer is yes.

Searching for location data using google maps is a done thing. Searching for data within your own database is also pretty normal although server side scripting would be used here, not js. Then you just cross reference stuff.

Drawing markers n a google map is also dead simple. Just look at the api. You can easily attach different images to different markers.

Stuff you might find handy:

Is it possible to customize the color scheme of a Google Map?

https://developers.google.com/maps/tutorials/customizing/custom-markers

I can't give a more detailed answer without knowing more about your search criteria. Hope this helps

Upvotes: 0

Related Questions