user680056
user680056

Reputation: 21

integrating google maps with django

am working on a project using django as the framework.i need to take input as in a location name from a text box, and submitting which should zoom that particular location in the google maps.can anyone please help me by sharing a helpful link to the information i require or any code snippets for the same.

Upvotes: 2

Views: 6106

Answers (1)

Dan
Dan

Reputation: 215

There are several ways to go about this. You can use the official Google Maps API but that will also give you a dynamic map, with controls and a details bubble. Here is my solution. It gives you a map as a static image.

img style="border: thin black solid;
     "src="http://maps.googleapis.com/maps/api/staticmap?
     center=***(Your '+' Separated Address)***&
     size=***(HxW)***&maptype=roadmap &
     markers=:http://i3.ghimg.com/img/smallMapPinHover_20110214.png***(Your + Separated Address)*** &
     sensor=false"
alt="Your map"/>    

I know that's pretty huge but it's not actually that complicated if you read it carefully.

  1. Replace the (Your + Separated Address) with your the address you want (eg center=123+Main+St+Orlando+FL)

  2. replace (HxW) with the size you want the map to be (eg size=124x124)

The reason you have to put the address in there twice is once for the map location, and once for the pin location. You can also change "maptype=roadmap" to other things like satellite.

I hope that wasn't too confusing. Good luck!

Upvotes: 5

Related Questions