3.0.0 • Published 6 years ago

cmaps v3.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

Custom Maps

Control options and customization of the Google Maps colors, just 1,7 KB.

Install

yarn add cMaps

After installing, include the scripts in html.

<script src="node_modules/cMaps/dist/cMaps.min.js"></script>

Wrapper map need be something like:

<div id="map"></div>

Starting map

var map = new cMaps(options);

Options

OptionTypeDescriptionExampleRequired
wrapperIdstringContainer id map'map'true
KeystringGoogle API Key'api_key'true
pinLatnumberpin latitude-23.562353true
pinLngnumberpin latitude-46.503113true
mapLatnumbermap latitude-23.562353true
mapLngnumbermap latitude-46.503113true
stylesarraygoogle styles{},{}true
namestringMap name'cMaps'false
iconstringurl to pin the way'imgs/pin.png'false
zoomnumberInitial zoom map16false
zoomControlbooleanManual zoom controltruefalse
scrollwheelbooleanMouse scroll for zoomfalsefalse
mapTypeControlbooleanChoose the map type in the upper left cornertruefalse
draggablebooleanIf this option is false the map can not be draggedtruefalse
streetViewbooleanControl street viewfalsefalse

Usage

// *Example* Code that was exported from Styled Maps Wizard or Snazzy Maps
var styles = [{"featureType":"all","elementType":"labels","stylers":[{"visibility":"on"}]} ...];

var map = new cMaps({
  'name': 'cMap',
  'wrapperId':'map',
  'pinLat': -23.562353,
  'pinLng': -46.503113,
  'mapLat': -23.562353,
  'mapLng': -46.503113
  'styles': styles,
  'key': 'YOUR_API_KEY'
});

Style

Use the Styled Maps Wizard or Snazzy Maps to export a JSON with all possible options and include as a parameter to the cMap.

Disclaimer

In the example folder has an demonstration of everything working if necessary :)