1.1.1 • Published 4 years ago

openlayers-component v1.1.1

Weekly downloads
3
License
ISC
Repository
github
Last release
4 years ago

openlayers-wrapper-polymer3

Add maps into your application or page in an easy way 🌎

Installation

npm

npm install --save openlayers-component

unpkg

You can add the following in the \<head> of your html :

<script src="https://unpkg.com/openlayers-component@${version}/dist/main.js"></script>

Usage

Add the custom element tag where you want to show the map

<openlayers-map></openlayers-map>

You can add attributes to configure the initial view and the source of your base layer

<openlayers-map
   view-lon="-60.712829"
   view-lat="-31.641445"
   view-zoom="14"
   tile-source="http://a.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png"
>
</openlayers-map>

Size

Place the custom element in a div with the desired dimensions

<div class="map-container" style="width:100%;height: 300px;">
	<openlayers-map></openlayers-map>
</div>

Updating view dynamically

You can modify the view programatically, changing element attribute values

const map = document.querySelector("#map1");
map.setAttribute("view-lon","-60.62");
map.setAttribute("view-lat","-31.62");
map.setAttribute("view-zoom","11");

Add markers dinamically

const map = document.querySelector("#map1");
map.appendChild(new MapMarker({longitude:-60.698051,latitude: -31.614810, color:"#FFDC45"}));
map.appendChild(new MapMarker({longitude:-60.721049,latitude: -31.654999, color:"#46E8D4"})); 
map.appendChild(new MapMarker({longitude:-60.711903,latitude: -31.662787, color:"#0090FE"}));
1.1.1

4 years ago

1.1.0

4 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.10

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago