Announcement

Collapse
No announcement yet.

New Idea for Google Maps Use Without Internet

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • New Idea for Google Maps Use Without Internet

    I had an idea for a use for Google Maps that would allow it to be used offline, where there's no internet connection, such as in a car. I've written a program that would allow you to type in a state and county, and then to type in the names of 2 roads that intersect. Then, when you hit enter, it brings up a map, generated by Google Maps of course, that shows the intersection and the surrounding roads, at 3 different zoom levels.

    Now, how the program works is simple. On the user's computer, CD, DVD, external hard drive, whatever, they have a directory filled with images of Google Maps, taken from print screens and then cropped, that would be named with according to the intersection of the 2 roads that they show. So, my program simply looks in the specified directories for state and county, and then looks to see if the matching intersection map searched for exists. If it does, it brings it up in the window.

    However, I've come across several problems that limit the use of this idea.

    1. The most obvious one is where the cropped images of the maps come from. There could be hundreds to thousands of intersections in a single county.

    2. If you did retrieve the maps yourself manually, you would have to know how to sort them correctly. As of yet, I've not found a source of maps that show where all of the counties in a given state are.

    Now, for number 1, I've thought about other ideas, such as a program that goes online, searches for an intersection in Google Maps, takes a screenshot of it, and then extracts just the image of the map. The problem with this, besides the fact that I don't know how to have the program automatically extract the image, is that the program would need to have a list of all of the intersections in a given county, which I have also failed to find anywhere online.

    I did come up with one possibility, which is to create a website similar in design to the WiGLE website, where users can submit, among other information, the location coordinates of wireless networks all over the country, and then other users can go online and freely search for this information. Similarly, users on this website could log onto it, search for a random intersection, or, look through a list of requested counties/ intersections, and then access Google Maps themselves and copy and extract the map image of the intersection that they would then submit to the website.

    The problem with this is that I don't have HTML coding experience, and so I wouldn't know how to setup a website like this.

    Anyway, I was just looking for comments, criticisms, ideas, whatever.

  • #2
    There is a similar thread for using Google Earth without internet. Some people have written a program that caches the images from google earth for offline use.

    Your idea seems good, but I think it would be very time consuming to manually crop the maps. maybe run an action in photoshop to do it for you. Also, I live in San Diego, there are countless intersections.

    Another question, will this be used for navigation or just to see a map?
    ~Puff

    View my worklog... I dare you... http://www.mp3car.com/vbulletin/showthread.php?t=77267

    Carputer Progress [||------------------] 10%

    Comment


    • #3
      Download the tiles directly, much simpler than all that screenshot malarky:

      http://web.media.mit.edu/~nvawter/projects/googlemaps/
      Old Systems retired due to new car
      New system at design/prototype stage on BeagleBoard.

      Comment


      • #4
        I know, I did really want to do that, and just have it retrieve the tile image. The only problem is, I've looked through countless Google Maps websites, and every single link to a Google Map tile I click on, I get sent to an error page that says that the requested URL was not found on the Google server.

        Comment


        • #5
          so is the software still available and working? Reading his rant amde it seem like it wasn't

          Comment


          • #6
            No, unfortunately it looks as if Google made him take his scripts and programs off of the internet.

            Back to what was said before about the tedious job of saving screenshots of maps, It just so happens that today, I stumbled across a free gold nugget called Autoit, which allows for complete automation of Windows, and so now I have a program that does the entire process by itself. You run it, it opens Internet Explorer, and about 10 seconds later you have a correctly labelled Google Map Bitmap, Jpeg, whatever format you want. As a side note, unfortunately the program does not support the 'Fn' key, and so I have to use Gadwin PrintScreen instead of the built in Print Screen key. But it still works fine, especially seeing as Gadwin is free as well!

            Anyway, here's the website for Autoit, for all who are interested. It really is an incredibly useful program, and the language is so easy to use, I wrote up the program described above in literally about 20 minutes.

            http://www.autoitscript.com/autoit3/

            Comment


            • #7
              Originally posted by Silentbob343
              so is the software still available and working? Reading his rant amde it seem like it wasn't
              So write some...! It's just HTML GET requests. The tiles are png.
              Old Systems retired due to new car
              New system at design/prototype stage on BeagleBoard.

              Comment


              • #8
                Here is some code I wrote for automating HTTP GETs. I haven't posted the bit that figures out the exact URLs, that would be naughty:

                Code:
                class HttpConnection
                {
                protected:
                	SOCKET m_socket;
                	bool m_connected;
                	const char *m_site;
                
                	bool readBytes(unsigned char *buffer, unsigned int size);
                	char readChar();
                	bool getLine(char *buffer, unsigned int buffersize);
                
                public:
                	HttpConnection(const char *site);
                	~HttpConnection();
                
                	bool connected() const;
                	bool grabAndSaveFile(const char *name, const char *file);
                };
                
                bool HttpConnection::readBytes(unsigned char *buffer, unsigned int size)
                {
                	// Then do a direct read
                	while (size)
                	{
                		// Find out how much is waiting
                		unsigned long waiting = 0;
                		do
                		{
                			int err = ioctlsocket(m_socket, FIONREAD, &waiting);
                			if(err)
                				return false;
                			if (!waiting)
                				Sleep(100);
                		}
                		while (!waiting);
                
                		// Clamp to the amount required
                    	if(waiting > size)
                        	waiting = size;
                
                		int ret = recv(m_socket, (char *)buffer, waiting, 0);
                		if (ret > 0)
                		{
                			buffer += ret;
                			size -= ret;
                		}
                	}
                	while(size);
                
                	return true;
                }
                
                char HttpConnection::readChar()
                {
                	unsigned char buffer;
                	if (readBytes(&buffer, 1))
                		return buffer;
                	return 0;
                }
                
                bool HttpConnection::getLine(char *buffer, unsigned int buffersize)
                {
                	int a;
                	unsigned int c = 0;
                	do
                	{
                		a = readChar();
                
                		if(isalpha(a))
                			a = tolower(a);
                
                		*buffer++ = (char)a;
                		c++;
                	}
                	while (((a == '\r') || (a != '\n')) && c < (buffersize - 1));
                
                	*buffer = 0;
                	return true;
                }
                
                HttpConnection::HttpConnection(const char *site)
                : m_socket(INVALID_SOCKET)
                , m_connected(false)
                , m_site(site)
                {
                	// Get the site details
                	struct hostent *hostEntry = gethostbyname(site);
                	if (hostEntry)
                	{
                		m_socket = socket(AF_INET, SOCK_STREAM, 0);
                		if (m_socket >= 0)
                		{
                			// Try opening the socket
                			struct sockaddr_in sockAddress;
                			memset((char *)&sockAddress,0,sizeof(sockAddress));
                			sockAddress.sin_family = AF_INET;
                			memcpy((char *)&sockAddress.sin_addr, hostEntry->h_addr, hostEntry->h_length);
                			sockAddress.sin_port = htons((short)80);
                			
                			m_connected = (connect(m_socket,(struct sockaddr *)&sockAddress,16) >= 0);
                		}
                	}
                }
                
                HttpConnection::~HttpConnection()
                {
                	if (m_socket != INVALID_SOCKET)
                		closesocket(m_socket);
                	m_socket = INVALID_SOCKET;
                	m_connected = false;
                
                }
                
                bool HttpConnection::connected() const
                {
                	return m_connected;
                }
                
                bool HttpConnection::grabAndSaveFile(const char *name, const char *file)
                {
                	// Generate and send the HTTP request
                	char str[1024];
                	sprintf(str, "GET /%s HTTP/1.1\r\nAccept: */*\r\nUser-Agent: Me\r\nHost: %s\r\nConnection: Keep-alive\r\n\r\n", name, m_site);
                
                	int err = send(m_socket, str, (int)strlen(str), 0);
                
                	// Iterate the lines until a blank one appears prior to the data
                	int header = 1;
                	int contentLength = 0;
                	int amountRead = 0;
                
                	// Receive and parse http header.
                	do
                	{
                		char line[1024];
                
                		getLine(line, 1024);
                
                		// Try getting the content length
                		if(!contentLength)
                			sscanf(line, "content-length: %d", &contentLength);
                
                		if(line[0]=='\n' || line[0]=='\r')
                			header = 0;
                	}
                	while(header);
                
                	// Grab file if we have a content length
                	if(contentLength)
                	{
                		unsigned char *buffer = new unsigned char [contentLength];
                		if (buffer)
                		{
                			readBytes(buffer, contentLength);
                
                			OutputDebugString("Grabbing ");
                			OutputDebugString(file);
                			OutputDebugString("\n");
                			FILE *fptr = fopen(file, "wb");
                			if (fptr)
                			{
                				fwrite(buffer, contentLength, 1, fptr);
                				fclose(fptr);
                			}
                
                			delete [] buffer;
                		}
                	}
                
                	return true;
                }
                Usage is along the lines of:

                Code:
                WSADATA wsaData;
                
                WORD wVersionRequested = MAKEWORD(2, 2);
                int err = WSAStartup(wVersionRequested, &wsaData);
                if(err == 0)
                {
                	{
                		// Conventional maps
                		HttpConnection	connection(<insert hostname here>);
                
                		if (connection.connected())
                		{
                			connection.grabAndSaveFile(<urlWithoutHostname>, <filenameToSaveAs>);
                			// Repeat grabAndSaveFile as many times as you need.
                		}
                	}
                	WSACleanup();
                }
                Old Systems retired due to new car
                New system at design/prototype stage on BeagleBoard.

                Comment

                Working...
                X