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

Basic example:

How its done:

In this example we have set the zoom level, and the center position (as an array format [lat,lng]). These are very similar to the Google declerations used in creating a map. There is another option mapType which is similar to the Google API, it accepts: G_NORMAL_MAP G_SATELLITE_MAP or G_HYBRID_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: 13,
			mapCenter:[51.501690392607, -0.1263427734375]
		});
	});
	
</script>
<div style="width:80%;height:400px;margin:0 auto" id="map1">
</div>

bMap Constructor Options:

(the IDs passed to bMap functions DON'T have the # used in jQuery selectors)

$(element).bMap(options);
options:
	mapCenter		array		latitude and logitude
	mapZoom			integer		starting zoom
	mapCanvas		string		the ID of the div to render the map
	mapSidebar		string		the ID of the div to render a clickable sidebar of the markers
	mapLayerbar		string		the ID of the div to render a clickable sidebar of the layers visible on the map
	mapType			integer		the type of map tiles to load (G_NORMAL_MAP G_SATELLITE_MAP G_HYBRID_MAP) refer to the google docs
	loadMsg			string		message shown on map during AJAX operations
	markers			object		bMap markers object, used to pre-draw some markers on the map
	icons			array		array of GIcon objects

If you don't know the LatLng of the place on the map you need, then you can use the following function to center the map: centerAtAddress. This is a wrapper for the google client geocoder.

$(document).ready(function(){ 
	$("#map1").bMap({
		mapZoom: 13
	});
	$("#map1").data("bMap").centerAtAddress("London, UK");
});



Comments:

Problems with maps
Mike - 7/5/2010 2:41:58 AM
Hi,

just discovered your script over the weekend and it looks really good however I have had no success so far trying it out with my own tests. Have copied your code completely - uploaded your JS and I'm using my own Google API key but just getting a blank screen. Your code looks great and very straightforward and well explained but - zilch! Not sure what else I can try - this code looks to be the most comprehensive JQuery plugin version I can find
Problem?
Darren - 7/29/2010 4:53:12 AM
There are many websites using bMap now, without too many issues. All I can suggest is that you check everything again, especially the API key from google. View the source of this page if it helps.
Darren
Re: Problems with maps
Rob - 8/22/2010 7:53:14 AM
Started yesterday to try this plugin. It seems to me to be the best and promising one among those available on the web.

Maybe check out the bMap js file name.

In the example above it is jquery.bmap.1.2.3.js but the one that you get from the download is named jQuery.bMap.1.2.3.js. Rename one of the two in such a case.
Filename issue
Darren - 8/23/2010 3:32:17 PM
Hi Rob,
Point taken - examples have been edited.
GMaps API v3
dC - 9/23/2010 5:49:08 AM
Great plugin, just found out about it with your 1.3 release and started playing with it. Was trying to run this example with the v3 API and was running into issues (think it was the new variable names in v3, was getting a google.maps.mapTypeId is undefined error from the code above).

I fixed my problem by changing the API include to:
<script src="http://maps.google.com/maps/api/js?sensor=false
Google V3
Darren - 9/23/2010 11:48:52 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
V3 API
Darren - 10/20/2010 10:01:32 AM
@dC
@Everyone using V3

Hi,
The following error:

google.maps.mapTypeId is undefined error

is caused when you use example code designed for the V2 API, it is not a problem with bMap - when you want to change the map type in the constructor - you need to use the GOOGLE CONSTANTS for the version of the google API you are using.

Darren
gpx track info
Imel - 11/11/2010 4:07:49 PM
Hi, is it possible to show gpx track info on a google map using jquery?
Solution for bMap v1.3
Mittaus - 12/7/2010 9:11:47 AM
change this:
Custom marker
Steve - 2/21/2011 9:15:36 PM
Do you have the syntax to add custom markers for API v3?
V3 Custom Marker Icons
Darren - 3/1/2011 8:03:19 AM
Hi,
The new version of bMap 1.3.1 now supports custom icons. Check out the new example!
Marker using address
vicky - 4/22/2011 12:13:12 AM
How l can set the markers without knowing the latitude and longitude of that area can l set the markers with the help of address
Marker using address
vicky - 4/22/2011 12:13:20 AM
How l can set the markers without knowing the latitude and longitude of that area can l set the markers with the help of address
Set marker on map
Eugene T - 10/14/2011 11:24:16 AM
Hi, guys!

I have a function to realize functionality of setting markers on map. I wrote it for a half in hour, so don't judge strictly =)

Here is (ver. of your plugin is 1.3.1):

/*
This sets up marker(s) by clicking on map.
Parameters:
obj_latitude - receive latitude as value
(if many is true, object will receive comma-separated values)
obj_longitude - receive longitude as value
(if many is true, object will receive comma-separated values)
many - false: one location (default)
true: many locations

Example: $("
Set marker on map
Eugene T - 10/17/2011 5:08:57 AM
Okay, if yo'll see it in action, just send me an email =)

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