GithubHelp home page GithubHelp logo

isabella232 / google-maps-image-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from experience-monks/google-maps-image-api

0.0 0.0 0.0 156 KB

This is an easy way to consume the Google Maps Image API

License: MIT License

JavaScript 100.00%

google-maps-image-api's Introduction

#google-maps-image-api ##google-maps-image-api~BASE_URL Allows you to easily consume the Google Maps Image API.

Google Maps Image API allows you to get static images of a 2d map or streetview.

This module will return a promise or you can call it via a callback.

The callback will return an error (if an error occured) and and HTMLImageElement.

Options passed in correlate to properties you can pass to Google Maps Image API.

Here are parameter's you can pass through opts to render a static map:

{
	//// REQUIRED ////
	type: 'staticmap', // This value is required if you want to render a static map
	
	center: '40.714728,-73.998672', // This will be the center of your image. 
									// It can also be a street address
 

	
	//// OPTIONAL ////
	key: 'your api key', // Your Google API Key

	zoom: 14, // This will be how zoomed in the map will be. 0 is where you 
 		  // can see the entire world, 21 is where you see streets. 14 is default
 		  
	size: '320x240', // This is the pixel size of your map. Default 320x240
	
	scale: 1, // This property is meant for rendering maps with high pixel 
			  // resolutions eg. iphone 4+ is retina this value should be set to 2

	format: 'JPEG', // Possible valuse 'PNG', 'GIF', 'JPEG',

	maptype: 'roadmap', // What type of map you want to render 
						// 'roadmap', 'satellite', 'hybrid', and 'terrain'

	language: 'en', // Language in which you want the map to be rendered

 region: 'us', // Country code in: ccTLD. defines the appropriate borders to display, 
 			  // based on geo-political sensitivities

	markers: 'color:blue|label:S|11211|11206|11222',
	// Add markers to the map. For docs:
	// https://developers.google.com/maps/documentation/staticmaps/index#Markers

	path: 'color:0x0000ff|weight:5|40.737102,-73.990318|40.749825,-73.987963',
	// Add a path to the map. A path can be filled or just a line. For docs:
	// https://developers.google.com/maps/documentation/staticmaps/index#Paths

	visible: 'Toronto', // you can specify locations that should be visible on the 
				 		// rendered map. This can be either lat,long or a location name

	style: 'feature:administrative|element:labels|weight:3.9|visibility:on|inverse_lightness:true', 
	// this property will change how features are rendered eg. roads, parks, etc.
	// For docs:
	// https://developers.google.com/maps/documentation/staticmaps/index#StyledMaps
}

Here are the parameters you'd pass in to render a streetview:

{
	//// REQUIRED ////
	type: 'streetview',
	location: 'Toronto', // Location name or long,lat. 
						 // if you ommit location you must define pano
	pano: 'pano id', // An id for a specific panorama. If you omit 
					 // you must define a location

	//// OPTIONAL ////
	key: 'your api key', // Your Google API Key
	
	size: '320x240', // The size of your render in pixels

	heading: 45, // This is the compass heading which the camera is pointing at
				 // between 0 and 360. 0 == North

	fov: 90, // field of view expressed in degrees. (angle which determines how much you see)
			 // default is 90

	pitch: 0, // up down angle the camera is pointing at. 90 is straight up and -90 is straight down
}

Params

  • opts Object - These are options that will be used to render streetview and map images
  • callback function - Optionally you can use a callback over a promise. See above for details

Scope: inner member of google-maps-image-api
Returns: Promise - A promise is returned which will return an HTMLImageElement

google-maps-image-api's People

Contributors

mikkoh 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.