bMap - Examples

1. Basic example2. Markers in constructor3. Markers, polylines & polygons
4. Marker sidebar5. Layer Sidebar6. AJAX Layers
7. Advanced AJAX8. Google Functions9. Custom Icons
10. Advanced marker events11. Image Overlay Function12. New sidebar features
V3 - Example 3V3 Example 5V3 Example 12
V3 API Custom Icons
Please note that unless stated, the examples shown here use the V2 of the google maps API - and bMap version 1.2.3
There are only three examples using the V3 API - and bMap 1.3

Markers added in the constructor:

How its done:

The constructor accepts the markers option. This is an object, the most important property is the data array. The data property is an array of marker objects, these are immediately rendered on the map.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
<script src="http://maps.google.com/maps?file=api&v=2&key=YOUR_GOOGLE_KEY" type="text/javascript"></script>
<script src="jQuery.bMap.1.2.3.js" type="text/javascript"></script>
<script type="text/javascript">

$(document).ready(function(){ 
	$("#map1").bMap({
		mapZoom: 11,
		mapCenter:[51.501690392607,-0.1263427734375],
		markers:{"data":[ //How to immediately add markers to the map
			{
				"lat":51.49757618329838,
				"lng":-0.1746654510498047, 
				"title":"Science Museum", 
				"body":"Exhibition Road, London SW7"
			},{
				"lat":51.47769451182406,
				"lng":-0.0009441375732421875, 
				"title":"Royal Observatory Greenwich", 
				"body":"Blackheath Ave, Greenwich, London SE10"
			}	//keep adding as many markers as you need....
		]}
	});
});

</script>
<div style="width:80%;height:400px;margin:0 auto" id="map1">
</div>

bMap Constructor Marker Options:

markers:
	name			string		visual name for the layer, appears in layerbar
	type			string		describes the type of layer
	visible			string		("true"/"false") if the layer should start visible
	data			array		array of bMap marker objects, rendered as GMarkers
	icon			integer		renders the marker with a custom icon from the icons array



Comments:

Markers with Address
kishan - 8/24/2010 11:07:34 PM
Nice Article,
I just wanted to know, how i can add Marker with Address option as i dont know "lat" and "lng".
Let me know, How I can do this ?
Address
Darren - 8/25/2010 2:52:36 AM
Hi,
Google do provide a geo-coding service, but I have not included it in bMap.
Others have added the ability to the insertMarkers function - where if you pass an address field in the object the latlng is geo-coded on the fly. In my opinion this is not efficient for most applications – because it means for every visitor to your page google is doing a lookup again and again! It would be more appropriate to do the geo-coding once, and store that value.
There are a few ways to get a latlang for a point. One user is using this website: http://itouchmap.com/latlong.html but the maps.google.com website can also be used (with the labs tools or by inspecting the url querystring of the embed code for the map you are looking at).
If you want to see how to do geo-coding then checkout the google code playground examples, or look at the centerAtAddress function in bMap.
Markers with Address
kishan - 8/25/2010 4:10:45 AM
Hi Darren, Thanks for your reply.
Can you please tell me how i can use centerAtAddress into markers instead of "lat" and "lng" ?
Address
Darren - 8/25/2010 4:58:37 AM
What I mean, is download bMap then take a look at the source-code. Find the centerAtAddress function at the end of the document, its quite a straight forward function. Then use it to adapt the bMap plugin to your needs.
Otherwise use the website I provided a link to, with it you can click the map and a marker appears and its location (latlng) is in the infowindow for the marker.
Getting Error
Xcellence IT - 9/24/2010 3:23:16 AM
Hi, We're getting error google.maps.MapTypeId is undefined, when trying to implement this.. even same example doesn't work too.
API error and code broke HTML
baroquedub - 9/23/2010 3:37:28 AM
dC's comment on 1 - Basic Example (http://www.blocsoft.com/bmap/examples.asp) has broken the page. Shame as he's obviously tried to paste in some code that would fix the error I'm also getting from v1.3: google.maps.MapTypeId is undefined
Maps API V3
Darren - 9/23/2010 11:49:46 AM
Hi,
I have fixed the comments - and I have uploaded some examples of using V3.
I have not found the time recently to take a closer look at the icon situation in V3, but it certainly is not hard - but I am trying to keep everything backwards compatible. If anyone makes a good attempt, EMAIL me the code and it may make it into the next release.

Darren
Marker wid address from DB
Gowtham - 10/7/2011 12:35:10 AM
Hi Darren, Thanks For dis superb plugin.I have got a info to ask u.My situation is dis,I have to show addresses of all markers wid latitude and longitude stored in my DB.Is dat possible wid bMap? Thnks..

Gowtham

 (*required)
 (*private)
 (*required)
 
© 2010 blocsoft.com All Rights Reserved. GPL License Privacy Policy Contact