Last active
February 6, 2021 11:30
-
-
Save iamgeoknight/abb8b680fcccdbdf2964a81b1c20fb63 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Create and Render map on div with zoom and center | |
| */ | |
| class OLMap { | |
| //Constructor accepts html div id, zoom level and center coordinaes | |
| constructor(map_div, zoom, center) { | |
| this.map = new ol.Map({ | |
| target: map_div, | |
| layers: [ | |
| new ol.layer.Tile({ | |
| source: new ol.source.OSM() | |
| }) | |
| ], | |
| view: new ol.View({ | |
| center: ol.proj.fromLonLat(center), | |
| zoom: zoom | |
| }) | |
| }); | |
| } | |
| } | |
| let map = new OLMap('map', 9, [-96.6345990807462, 32.81890764151014]).map; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment