Location:

Ready to Work

This chapter describes some of the preparations for developing a map application using the NavInfo Map JS SDK.


Request a "REST API" key (AK)

AK is mainly used for request signatures and provides a reference for quota management. To avoid being stolen, please keep it in a safe place.To apply for AK, please contact lbs@navinfo.com.


Preparation page

1. Add the JS SDK's entry script tag to the page and replace "

                    <link rel="stylesheet" href="https://lbs.navinfo.com/open-map/static/ni-map.css?v=1229CD952A50EF9E">
                    <script type="text/javascript" src="https://lbs.navinfo.com/open-map/static/ni-map.js?v=1229CD952A50EF9E"></script>
                

2. Add a div tag as a map container and specify an id attribute for the div;

3. Specify height and width for the map container;

CSS
                    #map {
                        position: absolute;
                        top: 0;
                        bottom: 0;
                        width: 100%;
                    }
                

4. When doing mobile development, add viewport settings to the head to achieve the best rendering performance;

5. When using the NIMAP JS SDK, please add NIMAP. Acceesstoken = "your AK". The example code is as follows:

                    nimap.accessToken = "your AK"
                

6. Once you have completed the above preparations, you can do the development work and check out the Quick Start.

TOP