Earth topography

Earth topography

Program " Earth topography " is created for downloading and displaying static map image of selected location on our planet.

Map image is downloaded from Google server trough HTTPS request to Google static maps API service.

Purpose of this program would be fast, easy and low cost way to get and observe desired map of selected place on planet Earth.

Low cost mean that map image is downloaded in compressed JPEG format, that needs less data transfer trough Internet.

User interface is simple.

There is menu bar at the top of the program window with text box for typing in the name of location,

next is two combo boxes for selecting zoom factor and map type and last is get map button for starting map download.

3D Terrain button is not functional in this program version. In the final version, by click on this button user should be able to

observe real 3D terrain configuration of selected location.

Since there is API service authorization key restriction , provided key in program has time limit of one month.

When key time limit has expired , user have two options :

1. To open a free Google account and acquire its own personal key with practically no limits,

25 000 images per day. Download open source code of this program, enter key, build and use program.

This option is strongly recommended.

NOTICE :

Above conditions has been changed since july 16, 2018,

read article at Google Maps Platform.

2. To come back to this page and download program again with new key.

Read all details at :

Google static maps API overview

Google static maps api for developers

Google static maps API is excellent in recognizing names of places in different languages,

so there is no need to type in the names of locations in English, it can be done in almost any known language.

Location can be selected in several ways :

By entering the name of the City, Country

exmpl : Chicago, United States

or

By entering latitude and longitude coordinates

exmpl : 41.881832 , -87.623177

or

By entering the name of well known place

exmpl : Keops pyramid

or

By entering correct adress of the place

exmpl : King Peter I , Smederevo

Here is program code of the main part of program :

/************************************************************************

* Program Licence : *

* *

* Copyright 2017 , Perić Željko *

* (periczeljkosmederevo@yahoo.com) *

* *

* According to it's main purpose , this program is licensed *

* under the therms of 'Free Software' licence agreement. *

* *

* If You do not know what those therms applies to *

* please read explanation at the following link : *

* (http://www.gnu.org/philosophy/free-sw.html.en) *

* *

* Since it is Free Software this program has no warranty of any kind. *

************************************************************************

* Ethical Notice : *

* *

* It is not ethical to change program code signed by it's author *

* and then to redistribute it under the same author name , *

* especially if it is incorrect. *

* *

* It is recommended that if You make improvement in program code , *

* to make remarks of it and then to sign it with Your own name , *

* for further redistribution as new major version of program. *

* *

* Author name and references of old program code version should be *

* kept , for tracking history of program development. *

* *

* For any further information please contact code author at his email. *

************************************************************************/

/************************************

* List Of Revisions *

************************************

* *

* *

* *

************************************/

/******************************************************************************

* Program name : Earth topography *

* Program ver. : 1.0 *

* Created by : SharpDevelop *

* Code author : Perić Željko *

* Code language : C# *

* Date created : 6.4.2017 *

* Time created : 19:05 *

* *

* *

* Program Description : Program for downloading and visually representing *

* topography of selected location on planet Earth. *

* *

* *

* All the best, *

* Author *

* *

******************************************************************************/

using System;

using System.Drawing;

using System.IO;

using System.Net;

using System.Windows.Forms;

namespace Earth_topography

{

public partial class MainForm : Form

{

public MainForm()

{

//

// The InitializeComponent() call is required for

// Windows Forms designer support.

//

InitializeComponent();

//

//

//

}

void Get_Static_Map()

{

//

// Connect to Google web server and download static map

//

string Google_Server_Adress = "https://maps.googleapis.com/";

string Google_Query =

"maps/api/staticmap?" +

"center="+Place_Location.Text+"&" +

"zoom="+Zoom_Level.Text.ToLower()+"&" +

"size=640x640&" +

"scale=2&" +

"maptype="+Map_Type.Text.ToLower().Replace(" map","")+"&" +

"format=jpg&" +

"key=HERE-ENTER-USER-KEY";

// New bitmap for storing map

Bitmap Map_Data;

// Forms HTTP request

HttpWebRequest query = (HttpWebRequest)

WebRequest.Create(Google_Server_Adress + Google_Query);

// Connect to the server and make request for informations

// Declaration of a variable "response", type of HttpWebResponse

// must be derived from HttpWebRequest.GetResponse () instance

HttpWebResponse response = (HttpWebResponse) query.GetResponse();

// Create a variable "data", type of Stream and

// transfers the requested data from the

// instance of variable "response" type of Stream

Stream data = response.GetResponseStream();

// Read all the data and transfer them to the variable 'Map_data'

Map_Data = new Bitmap(data);

// Closes and frees up all resources

// that occupies the variable 'data'

data.Close ();

data.Dispose();

// Closes and frees up resources that occupies the variable

// 'response'.

// Frees connection to the Internet for reuse

response.Close ();

// Show image

Map.Image = Map_Data;

//

//

//

}

void Get_Map_Click(object sender, EventArgs e)

{

//

// Call Get_Map buton event handler

//

Get_Static_Map();

}

void Terrain_Click(object sender, EventArgs e)

{

MessageBox.Show(" This option is in developing fase. ",

" Notice ",

MessageBoxButtons.OK,

MessageBoxIcon.Information );

}

}

}

All the best,

Author.