Click here to Skip to main content
15,846,976 members
Articles / Programming Languages / C#
Article

Google Map Joiner

Rate me:
Please Sign up or sign in to vote.
3.32/5 (7 votes)
20 Dec 2007CPOL 39.3K   589   25   8
Merge some small print-screen maps to a big one
Screenshot -

Introduction

This code uses the mouse's move and drag events to move Google map, then copy the map of the current-screen, finally merge them to a big one.

Background

When I have to go to another city, I always need the help of maps. Because my mobile cannot access the Web when I travel, I always collect the Google map, then merge it into one big map, and put it into my mobile. The code I discuss below does the task.

Using the Code

First, open Google Map, select a place you want to copy.

Second, move the mouse to the left-top point of the useful map, then stop for two seconds; the code will remember the left-top point.

Third, move the mouse to the right-bottom point of the useful map, then stop for two seconds; the code will remember the right-bottom point.

Screenshot - example.JPG

Fourth, select how big the map will be. The code will copy the map as shown in the following picture. The current screen will be centered.

Screenshot - example.JPG

Finally, click start.

The mouse move code looks like this:

C#
[DllImport("user32.dll")]
static extern bool SetCursorPos(int x, int y);

[DllImport("user32.dll")]
static extern void mouse_event
    (uint mouseEvent, int dx, int dy, uint data, int extrainfo);

SetCursorPos(x1, y1);
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
Thread.Sleep(500);
SetCursorPos(x2, y2);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);

History

  • 15th December, 2007: Initial version
  • 21st December, 2007: Updated to delete Temp folder

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
China China
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralNice One Pin
mbaocha4-May-09 17:28
mbaocha4-May-09 17:28 
That was a nice one. I would've felt better if you can include feature to enable us edit google map. Wont that be possible?



_____________________________________________________________
Digital Map Nigeria | Street Level Map of Lagos Abuja Nigeria |
GIS company in Nigeria
GeneralIt can't work. Because i let mouse switched left & right button. Pin
Andy Byron27-Sep-08 9:02
Andy Byron27-Sep-08 9:02 
GeneralThis code sucks Pin
Member 271004229-Feb-08 14:37
professionalMember 271004229-Feb-08 14:37 
GeneralVery Good, But How can I add Latitude and Longitude to it Pin
kedanz2-Feb-08 18:12
kedanz2-Feb-08 18:12 
GeneralDANGER !!! Pin
carlop()18-Dec-07 5:12
carlop()18-Dec-07 5:12 
GeneralRe: DANGER !!! Pin
lovexia18-Dec-07 21:07
lovexia18-Dec-07 21:07 
GeneralRe: DANGER !!! Pin
lovexia18-Dec-07 21:10
lovexia18-Dec-07 21:10 
GeneralRe: DANGER !!! Pin
kesmellon20-Dec-07 16:36
kesmellon20-Dec-07 16:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.