开发者

Adding pin points to google map with static list of street addresses

I have a spreadsheet full of street addresses and I want to add them as pin points on a google map. Can anybody tell me if they must be converted to a geo-code to work with the google maps API? And if so, is there a tool that will output a list of addresses in a way where I can just plug it into some javascript and have it 开发者_开发知识库good to go?

... Or just some tips. I've never worked with the google maps API before.


You will need to geocode the street addresses to convert them to latitude/longitude values for your marker objects in Google Maps.

Since you have a static list of addresses, you probably just want to do the geocoding once, get the latitude/longitude values and associate them with the data points your have in the spreadsheet.

Once you have your data points with latitude/longitude associated, you can spin through them creating markers for each one. When you create your marker object, you specify a google.maps.LatLng object in the options:

var marker = new google.maps.Marker({
  position: new google.maps.LatLng(myLatitude, myLongitude), 
  map: map, 
  title:"Hello World!"});  

The map property on the options associates the new marker with the map object.


There's a free add-on for Google Spreadsheets called GeoSheets that makes it easy to geocode your list of addresses directly from the spreadsheet. You can also use GeoSheets to create a customizable and embeddable map to put on your website that can automatically update with each change to the data in your spreadsheet.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜