Add Maps in iPhone apps (MapKit)

The MapKit framework allows you to integrate a quite fully-featured map in your applications.

The MapKit framework allows you to integrate a quite fully-featured map in your applications. In this way, your user won’t need to quit your app to check the geographical information in the Maps app.

Let’s give a look at the MapKit and have some fun with the maps. Using Interface Builder you can embed a map in your app in few seconds. It is enough you just add a MKMapView object wherever you need and that’s it. But let’s try together.

Create a new View-based project and name it “Mapper”. The first thing we need to do is to add the MapKit framework. Go to Project -> Edit Active Target and choose the General tab. There, add the MapKit.framework to the Linked Libraries pressing the “+” button. Now, double click the MapperViewController.xib file. Then, drag a Map View object from the Library and drop it onto the View. Save and quit IB. Now, go back to Xcode and select Build and Run from the Build menu.

Map in Inspector
Map in Inspector

Do you like it? You got a fully featured map. You can zoom in and out and you can pan left and right and up and down. Now, re-open the MapperViewController.xib file and select the MapView you previously added to it. Open the Inspector and go to the Attributes pane.

As you can see, you can change different map attributes. For example, you can change the map type to Map, Satellite and Hybrid. You can allow the zooming and the scrolling and you can also activate the current user location. You can change these features in IB, but you can also change them programmatically. To do so, we need to create an outlet in your class and connect it to the map. Open MapperViewController.h and import the MapKit header. Add this line

#import <MapKit/MapKit.h>

Then, add the following outlet:

IBOutlet MKMapView *mapView;

Create also a property:

@property (nonatomic, retain) IBOutlet MKMapView *mapView;

Remember to synthesize the property and don’t forget to release it in the dealloc method. Now, open MapperViewController.xib and connect the File’s Owner outlet (mapView) with the map object you previously added (see Figure below).

Map connection
Map connection

Now, you can go back to the code (after saving in IB) and add the following lines inside the viewDidiLoad method of the MapperViewController.m:

-(void) viewDidLoad
{
 [super viewDidLoad];
 [mapView setMapType:MKMapTypeStandard];
 [mapView setZoomEnabled:YES];
 [mapView setScrollEnabled:YES];
 }

Setting the Region

If you want to represent a specific portion of the map with a specific zoom level, you need to define a Map Region. This is a C structure composed by the Center and the Span. The Center is represented by the Longitude and the Latitude of the Region center, while the Span defines how much of the map is visible and is also the zoom level. A large Span corresponds to a low zoom level, while a small Span corresponds to a high zoom level.

Let’s define the Region for our map. At the end of the viewDidLoad method, add the following code:

MKCoordinateRegion region = { {0.0, 0.0 }, { 0.0, 0.0 } };
region.center.latitude = 41.902245099708516;
region.center.longitude = 12.457906007766724;
region.span.longitudeDelta = 0.01f;
region.span.latitudeDelta = 0.01f;
[mapView setRegion:region animated:YES];

The region is defined around the San Peter Cathedral in Rome. Now, if you want to pan or zoom programmatically, you just need to change programmatically the Region. If you change the Span, you zoom. If you change the Center, you pan. Simple, no?

User Location

This is very simple too. If you want to show the user location, you just set the flag in IB, as previously discussed, or you just add the following line of code:

[mapView setShowsUserLocation:YES];

Converting coordinates

It is often useful to convert the geographical coordinate to the view coordinates and vice versa. You can do this, using these methods:

– convertCoordinate:toPointToView:
– convertPoint:toCoordinateFromView:
– convertRegion:toRectToView:
- convertRect:toRegionFromView:

Annotations

A map without any useful information on it is most of the time useless. The magic happens when the map helps you to find some service or some friend or when it shows any interesting information to your app. If you want to add information to the map you need to add annotations.
In the MapKit framework, an annotation is composed by two parts: an annotation object and an annotation view. The Annotation Object contains information related to the geographical coordinates, while the Annotation View represents the view associated to the annotation object that will be displayed on request.
An annotation object is any object that conforms to the MKAnnotation protocol. Let’s add an annotation object to our map. We need to define a new class. Right-click the Classes Group and select Add->New Files.

Select an Objective-C class as Subclass of NSObject and name it MyAnnotation. Open the MyAnnotation.h and add the bold code:

#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>

@interface MyAnnotation : NSObject
{
     CLLocationCoordinate2D coordinate;
     NSString *title;
    NSString *subtitle;
}
@property (nonatomic, assign) CLLocationCoordinate2D coordinate;
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *subtitle;
@end

Now, switch to the implementation file and add:

#import "MyAnnotation.h"

@implementation MyAnnotation

@synthesize coordinate, title, subtitle;

-(void)dealloc
{
    [title release];
    [subtitle release];
    [super dealloc];
}
@end

We have now our annotation class with the coordinates, a title and a subtitle for the Callout view (see below). Let’s instantiate an object and add it to the map.
Still in the viewDidLoad method add the following lines of code:

MyAnnotation *ann = [[MyAnnotation alloc] init];
ann.title = @"Rome";
ann.subtitle = @"San Peter";
ann.coordinate = region.center;
[mapView addAnnotation:ann];

Here, we created an ann object and set its title, subtitle and coordinates (for simplicity, I am setting the annotation coordinates to the map center, but you can put there any coordinates you like). You can create an array of annotations and then add it to the map.

Finally, we need to set our MapperViewController class as the delegate of the mapView. So, just add this line of code at the end of the viewDidLoad:

[mapView setDelegate:self];

and add the protocol name in the interface of the class:

@interface MapperViewController : UIViewController

The last step is to implement a delegate method that manages the annotations during the panning and zooming. The approach is very similar to the UITableView. We create a static identifier and we try to reuse the annotation view with the same identifier, as we do with the cell of the tableview. If we are not able to dequeue an annotation view, we need to allocate one. Then, we choose the pin color and allow a callout view. Then, we animate the drop of the pin.
Add the following code to the MapperViewController.m file:

- (MKAnnotationView *)mapView:(MKMapView *)mV viewForAnnotation:(id )annotation
{
    MKPinAnnotationView *pinView = nil;
    if(annotation != mapView.userLocation)
    {
         static NSString *defaultPinID = @"com.invasivecode.pin";
         pinView = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:defaultPinID];
         if ( pinView == nil )
            pinView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:defaultPinID] autorelease];
        pinView.pinColor = MKPinAnnotationColorPurple;
        pinView.canShowCallout = YES;
        pinView.animatesDrop = YES;
    }
    else
        [mapView.userLocation setTitle:@"I am here"];
    return pinView;
}

That’s it. Below, you can see the result.

MapKit on iPhone
MapKit on iPhone

Add UITextField in UIAlertView

Adding a UITextField to a UIAlertView is as simple as imstantiating the UITextField and adding it as a subview of your UIAlertView.

Hello All, here’s my experience with adding a UITextField to a UIAlertView. All of this is done in code, so there’s no interface builder(IB) to handle the layout.

Adding a UITextField to a UIAlertView is as simple as inistantiating the UITextField and adding it as a subview of your UIAlertView. I set eh background color of the test field to be white so you can see where it is.

UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:nil message:nil delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil];
UITextField *myTextField = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 45.0, 260.0, 25.0)];
[myAlertView addSubview:myTextField];
[myAlertView show];
[myAlertView release];

Here’s a pic of the abboration that is your custom UIAlertView thus far.

Add UITextField in UIAlertView - 1
Add UITextField in UIAlertView -1

After fiddling around with all the values for a while, I finally found the proper settings that allow the alert view to be displayed properly with the text field fully visible and functional. Since the UIAlertView isn’t “made” to support this type of user interaction, you have to specify a message component for the alert view. This provides enough spacing so that you can insert the text field which will cover the message and thus keep things from over lapping. Here’s the revised code and a picture of the properly formatted UIAlertView.

UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"Your title here!" message:@"this gets covered" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil];
UITextField *myTextField = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 45.0, 260.0, 25.0)];
[myTextField setBackgroundColor:[UIColor whiteColor]];
[myAlertView addSubview:testTextField];
[myAlertView show];
[myAlertView release];
Add UITextField in UIAlertView - 2
Add UITextField in UIAlertView - 2

After getting all that done, I ran into one more problem. When you touch the text field to enter text, the keyboard slides into view and covers part of the alert view.

Add UITextField in UIAlertView - 3
Add UITextField in UIAlertView - 3

To fix this, I created a translation transform and applied it to the alert view to move it higher up the screen so it wouldn’t interfere with the keyboard. With that done, this is what it looks like. You still need to set up delegate methods for the alert view and the text field, but those are pretty simple and straight forward.

UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"Your title here!" message:@"this gets covered" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil];
UITextField *myTextField = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 45.0, 260.0, 25.0)];
[myTextField setBackgroundColor:[UIColor whiteColor]];
[myAlertView addSubview:testTextField];
CGAffineTransform myTransform = CGAffineTransformMakeTranslation(0.0, 130.0);
[myAlertView setTransform:myTransform];
[myAlertView show];
[myAlertView release];
Add UITextField in UIAlertView - 4
Add UITextField in UIAlertView - 4

find iPhone’s Unique Device Identifier (UDID)

find iPhone’s Unique Device Identifier (UDID)

What is the UDID?

Each iPhone or iPod Touch has a Unique Device Identifier (UDID), which is a sequence of 40 letters and numbers that is specific to your device. It’s like a serial number but much harder to guess. It will look something like this: 2b6f0cc904d137be2e1730235f5664094b831186.
How do I get my UDID?

You can copy/paste your UDID from iTunes or email it directly from your device by using a free app from the App Store. 
Email Using the Free App

Install and run Ad Hoc Helper. It will create an email with your UDID.
Copy/Paste from iTunes

1) Launch iTunes and connect your iPhone.

2) In the right pane, locate the information about your iPhone, including its name, capacity, software version, serial number, and phone number.

Connect iPhone to iTunes

3) Reveal the Identifier by clicking on Serial Number:.

4) Copy the Identifier to your clipboard by choosing EditCopy.

Click on serial to show the UDID

5) The UDID should me in your clipboard. Now you can paste it in any program.

image caching in iphone sdk

Simple class to implement image caching in iPhone sdk. Caching images improves the performance of scrolling tables and other views.

If you’re pulling in web data such as images that doesn’t change but needs to be viewed multiple times, you’ll want to cache it. Caching images dramatically improves the performance of scrolling tables and other views.

Here is a very simple class, with which you can implement caching of images in your iPhone app.

ImgCache.h :


#import <UIKit/UIKit.h>

@interface ImgCache : NSObject {

}

- (void) cacheImage: (NSString *) ImageURLString;
- (UIImage *) getImage: (NSString *) ImageURLString;

@end

ImgCache.m :


#import "ImgCache.h"
#define TMP NSTemporaryDirectory()

@implementation ImgCache

- (void) cacheImage: (NSString *) ImageURLString
{
 NSURL *ImageURL = [NSURL URLWithString: ImageURLString];
 //generating unique name for the cached file with ImageURLString so you can retrive it back
 NSMutableString *tmpStr = [NSMutableString stringWithString:ImageURLString];
 [tmpStr replaceOccurrencesOfString:@"/" withString:@"-" options:1 range:NSMakeRange(0, [tmpStr length])];

 NSString *filename = [NSString stringWithFormat:@"%@",tmpStr];

 NSString *uniquePath = [TMP stringByAppendingPathComponent: filename];

 // Check for file existence
 if(![[NSFileManager defaultManager] fileExistsAtPath: uniquePath])
 {
 // The file doesn't exist, we should get a copy of it

 // Fetch image
 NSData *data = [[NSData alloc] initWithContentsOfURL: ImageURL];
 UIImage *image = [[UIImage alloc] initWithData: data];

 // Is it PNG or JPG/JPEG?
 // Running the image representation function writes the data from the image to a file
 if([ImageURLString rangeOfString: @".png" options: NSCaseInsensitiveSearch].location != NSNotFound)
 {
 [UIImagePNGRepresentation(image) writeToFile: uniquePath atomically: YES];
 }
 else if(
 [ImageURLString rangeOfString: @".jpg" options: NSCaseInsensitiveSearch].location != NSNotFound ||
 [ImageURLString rangeOfString: @".jpeg" options: NSCaseInsensitiveSearch].location != NSNotFound
 )
 {
 [UIImageJPEGRepresentation(image, 100) writeToFile: uniquePath atomically: YES];
 }
 }
}



- (UIImage *) getImage: (NSString *) ImageURLString
{
 NSMutableString *tmpStr = [NSMutableString stringWithString:ImageURLString];
 [tmpStr replaceOccurrencesOfString:@"/" withString:@"-" options:1 range:NSMakeRange(0, [tmpStr length])];

 NSString *filename = [NSString stringWithFormat:@"%@",tmpStr];
 NSString *uniquePath = [TMP stringByAppendingPathComponent: filename];

 UIImage *image;

 // Check for a cached version
 if([[NSFileManager defaultManager] fileExistsAtPath: uniquePath])
 {
 NSData *data = [[NSData alloc] initWithContentsOfFile:uniquePath];
 image = [[UIImage alloc] initWithData:data] ; // this is the cached image
 }
 else
 {
 // get a new one
 [self cacheImage: ImageURLString];
 NSData *data = [[NSData alloc] initWithContentsOfURL:uniquePath];
 image = [[UIImage alloc] initWithData:data];

 }

 return image;
}


@end

installing zend debugger on xampp and setting it up with zend studio

installing zend debugger on xampp and setting it up with zend studio

If you have XAMPP installed, the Zend Optimizer will be installed by default, and this causes the standard installation of Zend Debugger to fail. Follow the steps below for success.

1) Make sure you have a running installation of XAMPP. Installing XAMPP is not part of this article. You can test your installation by entering http://localhost/xampp/ in a browser.

2) Enter http://localhost/xampp/phpinfo.php in the address bar of your browser. Note the information about Zend Extension Manager and Zend Optimizer. By the end of this article, Zend Debugger will be added.

3) Download the latest .zip file for cygwin_nt-i386 from http://downloads.zend.com/pdt/server-debugger/ and unpack into xamppphpzendDebuggerlibDebugger. Caution: In a standard XAMPP installation, the instructions in the README.txt file in this download will cause Apache not to start. See the following steps instead.

4) Rename the the subdirectories from “4_3_x_comp” etc. to “php-4.3.x” etc. see image.

install-zend-debugger-xampp
Rename directories

5) Copy the file dummy.php in the download to your Apache htdocs directory, for example xampphtdocsdummy.php. This what all the instructions and help files say, but I forgot it on one installation and didn’t notice any problems. It can’t hurt to do it though.

6) Search the PHPInfo that you ran in step 2 for the value “Loaded Configuration File”. Open this php.ini file in a text editor. You might want to save a copy of it before editing it.

7) If you have XAMPP you will find some lines in php.ini that look like this:

[Zend]
zend_extension_ts = “G:xamppphpzendOptimizerlibZendExtensionManager.dll”
zend_extension_manager.optimizer_ts = “G:xamppphpzendOptimizerlibOptimizer”
zend_optimizer.enable_loader = 0
zend_optimizer.optimization_level=15

;zend_optimizer.license_path =
; Local Variables:
; tab-width: 4
; End:

8 ) If you see the lines in step 7 and follow the instructions from README.txt in the download in step 3, you will be adding a second zend_extension_ts line. This will cause Apache not to start. Instead, add the following lines:
zend_extension_manager.debug_server_ts = “xamppphpzendDebuggerlibDebugger”
zend_debugger.allow_hosts = 127.0.0.1
zend_debugger.expose_remotely = allowed_hosts

9) Restart XAMPP, for example by calling xamppxampp_restart.exe. Reload PHPInfo; now it should look like this new image. Note the new information about Zend Debugger.

zend debugger
zend debugger

Face Detection in PHP using Open CV

Face Detection in Photos with PHP using OpenCV and PHP Facedetect extension

In this article, i will explain how possible this task can be achieved with simplicity with OpenCV and PHP Facedetect extension. Both are free to download and opensource.

Goal

To auto detect faces in a photo and draw pink box around the faces with a php script running a linux centos server. Please note that face detection and face recognition are two different things. To recognize a face you have to first detect a face and then do the required processing.

Requirements

– Linux server running Centos with SSH access

– PHP/Apache

– GD Library

– OpenCV [Download]

– PHP Facedetect extension [Download]

PHP facedetect extension is very simple. All you have to do is call a function face_detect(p) and it will give all the x,y coordinates in a photo where we draw a square. face_count() will output how many total faces in the given photo. For documentation see here

Installation

We install opencv and then we compile the php facedetect extension with php.

How to Install OpenCV

If you are running centos then one single line will install opencv.

  yum install opencv

OpenCV may also need the following depencies to work properly and you will need to install them as well.

 yum install ibpng libpng-dev zlib libjpeg libjpeg-dev libtiff libjasper swig python pkgconfig gtk gtk-dev

For more installation instructions on linux see here

The opencv will be installed in/usr/local/share/opencv and all the important facedetection training files known as “haar training” can be found in haarcascades folder in xml format (like haarcascade_frontalface_alt.xml)

How to test run OpenCV

Inorder to test run opencv you have to compile the samples folder. Go to /usr/local/share/opencv/samples/c/

Run this command to compile to binary.

 ./build_all.sh

If you find large number of errors and variables not declared like shown below..

  Package opencv was not found in the pkg-config search path.
    Perhaps you should add the directory containing `opencv.pc’
    to the PKG_CONFIG_PATH environment variable
    No package ‘opencv’ found
    ….

run

  export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
  ./build_all.sh

and then it will compile.

To test run the opencv run the following command in the c folder for a test.jpg photo.

  ./facedetect –cascade=”../haarcascades/haarcascade_frontalface_alt.xml” test.jpg

Since your server does not have Xwindow installed, you probably do not see the output just the processing time.

If you see error “error while loading shared libraries: libcxcore.so.2: cannot open shared object file: No such file or directory” then see this solution

Install PHP Facedetect Extension

Installing the PHP facedetect extension is very easy. Just download the package and compile it for PHP.

  wget [download_file_path]
  tar zxf facedetect-1.0.0

then

  phpize && configure && make && make install

If you see phpize command not found error, install php developer libraries

  yum install php-devel
    OR
  yum install php5-devel

then

open php.ini and make sure you add this line.

  extension=facedetect.so

Thats it! all the installation part is over!

Writing a PHP Script

Before you start writing php script make sure you copy all xml files in /usr/local/share/opencv/haarcascades folder to the web folder.

and this simple two lines to from php to call the function


<?php
//face_count() outputs total faces detected
// face_detect() outputs assoc array of x,y,width,height of each face recognized

$total= face_count('test.jpg','haarcascade_frontalface_alt.xml');
$coord= face_detect('test.jpg','haarcascade_frontalface_alt.xml');
print_r($coord);
?>

Make sure the path of xml files are correct else you would see a blank face or bool(false) output. Once you get this co-ordinates all we have to do is use php gd library to draw square around the face with the above coordinates.

This script will do that and you have call the script with photo file like this http://domain/face.php?file=test.jpg and the test.jpg file should be in the same folder


<?php
//face.php -> detects faces and draws a pink square on faces

function LoadJpeg($imgname)
{
 $im = @imagecreatefromjpeg($imgname); /* Attempt to open */
 if (!$im) { /* See if it failed */
 $im  = imagecreate(150, 30); /* Create a blank image */
 $bgc = imagecolorallocate($im, 255, 255, 255);
 $tc  = imagecolorallocate($im, 0, 0, 0);
 imagefilledrectangle($im, 0, 0, 150, 30, $bgc);
 /* Output an errmsg */
 imagestring($im, 1, 5, 5, "Error loading $imgname", $tc);
 }
 return $im;
}

$total= face_count($_GET['file'],'haarcascade_frontalface_alt.xml');
$ord= face_detect($_GET['file'],'haarcascade_frontalface_alt.xml');

$im = LoadJpeg($_GET['file']);
$pink = imagecolorallocate($im, 255, 105, 180);

if(count($ord) > 0) {

foreach ($ord as $arr) {
imagerectangle($im,$arr['x'] ,$arr['y'] , $arr['x']+$arr['w'],
$arr['y']+$arr['h'], $pink);
}

}
header('Content-Type: image/jpeg');
imagejpeg($im);
imagedestroy($im);
?>

Just remember haarcascade_frontalface_alt.xml are haar training files used for face detection. You can play around with other training files like to detect various body parts, not just faces.

  haarcascade_frontalface_alt.xml
  haarcascade_frontalface_alt_tree.xml
  haarcascade_fullbody.xml
  haarcascade_profileface.xml
  haarcascade_lowerbody.xml
  haarcascade_upperbody.xml

Conclusion and the Results

(standard test image used for image processing)

Face Detection with PHP
Face Detection with PHP

I have given multiple frontal detection photos to the script and the script performed well, despite few false face detections.

I should say i am pretty surprised the way the multiple faces are detected and the results are good with haarcascade_frontalface_alt.xml as training file . To get more accurate results, you need to do haar training to xml files to produce more accurate results.

Other Useful Links

Facedetection with pure PHP without OpenCV [visit site]

Facedetection with javascript [visit site]

OpenCV Face Detection Page [visit site]

Enjoy!

jQuery google map plugins

The plugins discussed here offer not only an easier method to install a map, they also offer the option to add extra functionality, should you choose to need them. They also all come with a varied degree of docs, some are extensive and some non-existent, so choose your plugin wisely.

At first glance the Google Map API may seem scary, I mean, were do you possibly start? You probably only want to display a simple map that displays directions to your clients address, you don’t really want an all singing and dancing interactive map with more options than necessary. There has to be a simpler way.
Of course there is, and as with almost all web site interactivity, jQuery does offer some simple and easy to use plugins.

The plugins below offer not only an easier method to install a map, they also offer the option to add extra functionality, should you choose to need them. They also all come with a varied degree of docs, some are extensive and some non-existent, so choose your plugin wisely.

I have also listed a couple of beginner jQuery and Google Map tutorials at the the bottom of the post. If you are taking your first steps within Google Maps, I suggest you start there.


gMap – Google Maps Plugin

gMap – Google Maps Plugin
gMap – Google Maps Plugin

gMap is a very flexible, highly customizable and lightweight (only 2KB) jQuery plugin that helps you embed Google Maps into your website. It can be customized in many different ways, all you need to do is to pass a JSON object to the GMap() function, click here for a complete list of properties that can be passed.


Google Maps jQuery Plugin

Google Maps jQuery Plugin
Google Maps jQuery Plugin

The Google Maps jQuery Plugin takes away a lot of the pain from working with the Google Map Api (which can be pretty indepth for all developer levels). It allows you to embed Google Maps on your web site with ease and there are also certains portions of the Map that can be controlled via CSS (div container, info window), so that the map will sit perfectly within your web design.


Mapbox – the jQuery Map

Mapbox – the jQuery Map
Mapbox – the jQuery Map

The jQuery mapbox() plugin is for creating relatively small scale, zoomable, draggable maps with multiple layers of content. This framework could be applied to games, development plans, or any layout that could benefit from pan and zoom functions.
Mapbox likes to think of its self as a basic plugin, yes it is easy to use, but with a wide array of advanced options, here are a list of all the settings and their defaults:


jQuery GPS

jQuery GPS
jQuery GPS

jQuery GPS is a jQuery plugin for people that want to add Google maps to their website, but don’t want their website to be bogged down with the features they don’t require.
All you have to do is add inputs for addresses by simply adding default or custom ID’s. You can even use any element to trigger the event, so it doesn’t need to be embedded inside a form.
With jQuery GPS you have the option to select the position/place on the map upon first load, and to open a toolip or image on that starting location.


jMapping – for creating Google Maps from semantic markup

jMapping – for creating Google Maps from semantic markup
jMapping – for creating Google Maps from semantic markup

This plugin is designed for quick Google Map implemention with a list of the locations that are specified within the HTML It allows for as much graceful degradation as possible by having as much semantic HTML as it allows.
The plugin expects the HTML for the locations to be grouped under a common element and expects the necessary metadata to be on the location element. This way the HTML semantically reflects all of those parts and information are associated with the specific location or place.


Googlemap jQuery Plugin by Dylan Verheul

Googlemap jQuery Plugin by Dylan Verheul
Googlemap jQuery Plugin by Dylan Verheul

This plugins makes it easy to put a Google Map on your page. Look at the source code of this page if you want to know how to use the plugin. Markers can be provided by a jQuery object (containing elements in the geo microformat) or an array of objects that provide lat, lng and txt for the popup (txt being optional).


imGoogleMaps – Multiple Addresses

This is a much simpler plugin than all the rest on this page, it has been developed to create a simpler implementation with minimal and basic options. When you think about it, in most situations all you will want from a map is for an end-user to be able to view the owner’s address and be able to map directions to that address, this plugin fits that bill.
This plugins map interface is similar to what you would see on Google Maps (auto mode), while also giving the developer the ability to style their own interface (manual mode).


jMaps Framework

The JMaps Framework provides a simple yet powerful API for Google’s mapping services, that offers simple jQuery methods to do functions such as: Geocode and reverse any valid address in the world via Google’s geocoding API; Search for directions to and from any location; Add and remove Markers; Add and remove polygons and polylines; Add and remove graphic layers on the map; Add and remove Google adsense layers; Add and remove Traffic layers; Get information back such as map center, map size, map type, etc.


jQuery-PlacePicker

jQuery-PlacePicker
jQuery-PlacePicker

jQuery-PlacePicker is a geocoding jQuery UI widget with support for Google Maps API v3 (and framework ready for others) that allow users to search for and select locations.


jQmaps

jQmaps is a very easy to use and popular plugin for Google Maps, that can add custom points, expandible ballons and hotspots links.
It does not offer any docs nor does it have any working demos. If you feel comfortable using it, go for it, if not try one of the plugins above.


jQuery and Google Maps Tutorial: The Basics

jQuery and Google Maps Tutorial: The Basics
jQuery and Google Maps Tutorial: The Basics

If you have never worked with the Google Map API before it can all seem daunting. What you need is a step-by-step guide that will cover the basics and give you a better understanding of everything that is going on, and that is what this tutorial covers.


AJAX Storing and Retrieving Points – Tutorial

AJAX Storing and Retrieving Points – Tutorial
AJAX Storing and Retrieving Points – Tutorial

Taking things a step further from the previous article, in this tutorial you will learn how to store and retrieve points with using AJAX and a server-side language. This tutorial will use PHP/MySQL on the server, but it is basic enough that re-writing in another language should not be difficult.


Getting started with jQuery

It can seem challenging to know where to begin with jQuery because this tiny library does many functions.

It can seem challenging to know where to begin with jQuery because this tiny library does many functions. Most of its concept borrowed from structured HTML and CSS.

So Let’s look what jQuery can do for us.

What jQuery does –

Access elements in a document – without a Javascript library you may need to write a lot of code to traverse Document Object Modal (DOM) tree. A robust and efficient mechanism is offered by jQuery to access elements in a document.

Modify the appearance of a web page – CSS offers a powerful method of influencing the way a document is rendered, but it falls short when web browsers do not all support the same standards. With jQuery, developers can bridge this gap, relying on the same standards support across all browsers. In addition, jQuery can change the classes or individual style properties applied to a portion of the document even after the page has been rendered

Alter the content of a document – Not limited to mere cosmetic changes, jQuery can modify the content of a document itself with a few keystrokes. Text can be changed, images can be inserted or swapped, lists can be reordered, or the entire structure of the HTML can be rewritten and extended—all with a single easy-to-use Application Programming Interface (API).

Respond to a user’s interaction – The jQuery library offers an elegant way to intercept a wide variety of events, such as a user clicking on a link, without the need to clutter the HTML code itself with event handlers.

Animate changes being made to a document – The jQuery library provide many animations built in such as fade in , fade out etc and provide easy to use API to create new one.

Retrieve information from a server without refreshing a page – The jQuery library removes the browser-specific complexity from this process, allowing developers to focus on the server-end functionality.

Simplify common JavaScript tasks – In addition to all of the document-specific features of jQuery, the library provides enhancements to basic JavaScript constructs such as iteration and array manipulation.