2.0.0-beta008 • Published 5 years ago

vectormap-js-dev v2.0.0-beta008

Weekly downloads
30
License
Apache 2.0
Repository
github
Last release
5 years ago

Alt ThinkGeo

MapSuite

The mapsuite-vectormap.js is an open-source JavaScript SDK and an extension of OpenLayers to create maps for web and mobile devices. With the help of Map Suite vector styling schema - StyleJSON, you can easily create beautiful maps for your application.

With Map Suite VectorMap.js, you will have full access to OpenLayers, as well as any plugins or extensions created based on OpenLayers, for example, the "3rd party libraries" published on https://openlayers.org. With the help of them, you can easily create any styled map and put it anywhere, and build a customized geocoding or routings from other providers.

Wiki Documentation: http://wiki.thinkgeo.com/wiki/map_suite_api

Light Map Style

Alt ThinkGeo

Dark Map Style

Alt ThinkGeo

Hybrid Map Style

Alt ThinkGeo

Install

The official guide assumes intermediate level knowledge of HTML, CSS, and JavaScript, and have some experience of any front-end development editor, such as Visual Studio Code, Webstorm, Sublime Text or some similars. if you are totally new to frontend development, the easiest way to try out this library is using the "OpenCodePen Hello World exampleLayers". Feel free to open it in another tab and follow along as we go through some features.

2 options of installing Map Suite VectorMap.js:

  • Use NPM install

    npm install vectormap-js

    or

    npm install vectormap-js-dev

  • Include related in

Get Started

Set up a basic map with VectorMap.js in 6 steps (here take Visual Studio Code for example).

Step 1. Create a html page with name "index.html "

Step 2. In the <head>of your HTML page, import the vectormap.js and related css file.

<link rel="stylesheet" href="https://cdn.thinkgeo.com/vectormap/0.1.0/mapsuite-vectormap.css"></link>

<!-- latest minified version of vectormap.js -->

And add a height and width for the map:

 <style>
    #map {
        width: 800px;
        height: 600px;
    }
 </style>

Step 3. In the <body> of your HTML page, add a "map" div.

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

Step 4. At the bottom of the html page, add a JavaScript section to create an instance of map control, and add the vector layer.

<script>
    var worldStreetsLayer = new ol.mapsuite.VectorTileLayer("thinkgeo-world-streets-light.json", 
        {
            'apikey':'your-thinkgeo-gis-service-vector-tile-key'
        });
    let map = new ol.Map({
        layers: [worldStreetsLayer],
        target: 'map',
        view: new ol.View({
            center: ol.proj.fromLonLat([-96.79620, 32.79423]),
            zoom: 2,
        }),
    });
</script>

NOTE: Please check here on how to create your own ThinkGeo GIS Service Vector Tile key.

Step 5. Download one of Predefined open source styles and copy it to the directory where the index.html is. For example, we can call it "thinkgeo-world-streets-light.json".

After all the above steps completed, your HTML page should be:

<!DOCTYPE html>
<html>
    <head>
        <title>Sample Map</title>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="https://cdn.thinkgeo.com/vectormap/0.1.0/mapsuite-vectormap.css" type="text/css">
        <script src="https://cdn.thinkgeo.com/vectormap/0.1.0/mapsuite-vectormap.js"></script>
         <style>
            #map {
                width: 800px;
                height: 600px;
            }
         </style>
    </head>
    <body>
        <div id="map"></div>
        <script>
            var worldStreetsLayer = new ol.mapsuite.VectorTileLayer("thinkgeo-world-streets-light.json", 
            {
                'apikey':'your-thinkgeo-gis-service-vector-tile-key'
            });
            let map = new ol.Map({
                layers: [worldStreetsLayer],
                target: 'map',
                view: new ol.View({
                    center: ol.proj.fromLonLat([-96.79620, 32.79423]),
                    zoom: 2,
                }),
            });
        </script>
    </body>
</html>

Step 6. Run the page and a beautiful map there.

NOTE:

ThinkGeo Icon FontSet is an icon set, which is used in "Predefined open source styles" as POI icons. If you are using ready-to-go predefined styleJSON file downloaded, please add following code in "<Head>".

<script src="https://cdn.thinkgeo.com/icons-font/0.1.0/webfontloader.js"></script>
<script>
    WebFont.load({
        custom: {
            families: ["ThinkgeoFont"],
            urls: ["https://cdn.thinkgeo.com/icons-font/0.1.0/thinkgeo-font.css"]
        }
    });
</script>

Vector Tiles

Besides loading the traditional KML, GeoJSON, bitmap tiles etc., Map Suite vectormap.js draws its own tiles from vector tiles that contains the source data.

Map Suite GIS Service provides a free vector tile service (*.mvt) based on open data from OpenStreetMap, Natural Earth and some other data providers, with global coverage updated continuously. - sign up for an API Key here.

Styling

Map Suite vector styling schema - Vector StyleJSON is designed for you to specify data sources, layers and how to define and apply styles to layers. Please check the demo from "Predefined open source styles" or check related documentation at https://thinkgeo.gitbooks.io/map-suite-stylejson-specification/content/.

Browser Suport

mapsuite-vectormap.js is officially supported and tested on the last two versions of these browsers:

  • Mac OS: Chrome, Firefox, and Safari
  • Windows: Chrome, Firefox, IE11, and IE Edge
  • iOS: Safari, Chrome, Firefox
  • Android: Chrome

mapsuite-vectormap.js should also run in any brower with HTML5 support.

License

mapsuite-vectormap.js is licensed under the Apache 2.0.

2.0.0-beta008

5 years ago

2.0.0-beta007

5 years ago

2.0.0-beta006

5 years ago

2.0.0-beta005

6 years ago

2.0.0-beta004

6 years ago

2.0.0-beta003

6 years ago

2.0.0-beta002

6 years ago

1.0.0-beta030

6 years ago

1.0.0-beta029

6 years ago

1.0.0-beta028

6 years ago

1.0.0-beta027

6 years ago

1.0.0-beta026

6 years ago

1.0.0-beta025

6 years ago

1.0.0-beta024

6 years ago

1.0.0-beta023

6 years ago

1.0.0-beta022

6 years ago

1.0.0-beta021

6 years ago

1.0.0-beta020

6 years ago

1.0.0-beta019

6 years ago

1.0.0-beta018

6 years ago

1.0.0-beta017

6 years ago

1.0.0-beta016

6 years ago

1.0.0-beta015

6 years ago

1.0.0-beta014

6 years ago

1.0.0-beta013

6 years ago

1.0.0-beta011

6 years ago

1.0.0-beta009

6 years ago

1.0.0-beta008

6 years ago

1.0.0-beta006

6 years ago

1.0.0-beta005

6 years ago

1.0.0-beta004

6 years ago

0.1.0

6 years ago