Coder Social home page Coder Social logo

image-generator's Introduction

Static Image Generator

This JavaScript code allows you to download a set of satellite images from Google Maps API, given the latitude, longitude, and dimensions of the area you want to download. When entering a starting coordinate, use the most north western point of the area you require coverage over.

a site that has 4 user input fields for coordinates and a button to download images

Dependencies

The following dependencies are required:

  • jQuery
  • SweetAlert2
  • JSZip
  • FileSaver.js

Setup

  1. Clone the repository or copy the code into a new project directory.
  2. Install the dependencies listed above by running the yarn command in terminal.
yarn
  1. Create a new file named constants.js in the same directory as index.js.
  2. In constants.js, define your GOOGLE_API_KEY value and incrementor (see 'Incrementing distance between images' at bottom for info on incrementations) as shown below.
   export const GOOGLE_API_KEY = "your_google_maps_api_key_here"
   export const incrementor = 0.01
  1. To create dist build folder, run the following in your terminal
yarn run build

Usage

  1. Open index.html in your web browser, in vs code you can open the index.html and select the GoLive feature to easily start a local web server and preview the project in your browser.
  2. Enter the latitude and longitude of the area you want to download, as well as the surface area dimensions you would like to cover.
  3. Click the "Download Images" button to download a .zip file containing the requested images, this may take a minute depending on size of area.
  4. Click the "Generate CSV" button to download a CSV file populated with coordinates data.

Incrementing distance between images

On a Google Map coordinate, each decimal place corresponds to a different level of precision in the location data. The decimal places in the latitude and longitude coordinates represent progressively smaller units of distance as follows (for areas close to equator):

  • 0.1 degrees = 11.1 kilometers
  • 0.01 degrees = 1.1 kilometers
  • 0.001 degrees = 111 meters
  • 0.0001 degrees = 11.1 meters
  • 0.00001 degrees = 1.1 meters
  • 0.000001 degrees = 0.11 meters

image-generator's People

Contributors

elliotdoak avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.