olamaps-web-sdk 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +141 -0
- package/README.md +98 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +51280 -0
- package/dist/olamaps-web-sdk.umd.js +2201 -0
- package/package.json +26 -0
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
Copyright (c) 2024, OlaMaps
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
-------------------------------------------------------------------------------
|
|
5
|
+
|
|
6
|
+
Copyright (c) 2023, MapLibre contributors
|
|
7
|
+
|
|
8
|
+
All rights reserved.
|
|
9
|
+
|
|
10
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
11
|
+
are permitted provided that the following conditions are met:
|
|
12
|
+
|
|
13
|
+
* Redistributions of source code must retain the above copyright notice,
|
|
14
|
+
this list of conditions and the following disclaimer.
|
|
15
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
16
|
+
this list of conditions and the following disclaimer in the documentation
|
|
17
|
+
and/or other materials provided with the distribution.
|
|
18
|
+
* Neither the name of MapLibre GL JS nor the names of its contributors
|
|
19
|
+
may be used to endorse or promote products derived from this software
|
|
20
|
+
without specific prior written permission.
|
|
21
|
+
|
|
22
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
23
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
24
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
25
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
26
|
+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
27
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
28
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
29
|
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
30
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
31
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
32
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
33
|
+
|
|
34
|
+
-------------------------------------------------------------------------------
|
|
35
|
+
|
|
36
|
+
Contains code from mapbox-gl-js v1.13 and earlier
|
|
37
|
+
|
|
38
|
+
Version v1.13 of mapbox-gl-js and earlier are licensed under a BSD-3-Clause license
|
|
39
|
+
|
|
40
|
+
Copyright (c) 2020, Mapbox
|
|
41
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
42
|
+
are permitted provided that the following conditions are met:
|
|
43
|
+
|
|
44
|
+
* Redistributions of source code must retain the above copyright notice,
|
|
45
|
+
this list of conditions and the following disclaimer.
|
|
46
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
47
|
+
this list of conditions and the following disclaimer in the documentation
|
|
48
|
+
and/or other materials provided with the distribution.
|
|
49
|
+
* Neither the name of Mapbox GL JS nor the names of its contributors
|
|
50
|
+
may be used to endorse or promote products derived from this software
|
|
51
|
+
without specific prior written permission.
|
|
52
|
+
|
|
53
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
54
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
55
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
56
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
57
|
+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
58
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
59
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
60
|
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
61
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
62
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
63
|
+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
64
|
+
|
|
65
|
+
-------------------------------------------------------------------------------
|
|
66
|
+
|
|
67
|
+
Contains code from glfx.js
|
|
68
|
+
|
|
69
|
+
Copyright (C) 2011 by Evan Wallace
|
|
70
|
+
|
|
71
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
72
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
73
|
+
in the Software without restriction, including without limitation the rights
|
|
74
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
75
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
76
|
+
furnished to do so, subject to the following conditions:
|
|
77
|
+
|
|
78
|
+
The above copyright notice and this permission notice shall be included in
|
|
79
|
+
all copies or substantial portions of the Software.
|
|
80
|
+
|
|
81
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
82
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
83
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
84
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
85
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
86
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
87
|
+
THE SOFTWARE.
|
|
88
|
+
|
|
89
|
+
--------------------------------------------------------------------------------
|
|
90
|
+
|
|
91
|
+
Contains a portion of d3-color https://github.com/d3/d3-color
|
|
92
|
+
|
|
93
|
+
Copyright 2010-2016 Mike Bostock
|
|
94
|
+
All rights reserved.
|
|
95
|
+
|
|
96
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
97
|
+
are permitted provided that the following conditions are met:
|
|
98
|
+
|
|
99
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
100
|
+
list of conditions and the following disclaimer.
|
|
101
|
+
|
|
102
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
103
|
+
this list of conditions and the following disclaimer in the documentation
|
|
104
|
+
and/or other materials provided with the distribution.
|
|
105
|
+
|
|
106
|
+
* Neither the name of the author nor the names of contributors may be used to
|
|
107
|
+
endorse or promote products derived from this software without specific prior
|
|
108
|
+
written permission.
|
|
109
|
+
|
|
110
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
111
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
112
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
113
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
114
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
115
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
116
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
117
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
118
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
119
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
120
|
+
|
|
121
|
+
-------------------------------------------------------------------------------
|
|
122
|
+
|
|
123
|
+
Copyright Vis.gl contributors.
|
|
124
|
+
|
|
125
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
126
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
127
|
+
in the Software without restriction, including without limitation the rights
|
|
128
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
129
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
130
|
+
furnished to do so, subject to the following conditions:
|
|
131
|
+
|
|
132
|
+
The above copyright notice and this permission notice shall be included in
|
|
133
|
+
all copies or substantial portions of the Software.
|
|
134
|
+
|
|
135
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
136
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
137
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
138
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
139
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
140
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
141
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# OlaMaps Web SDK
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/olamaps-web-sdk)
|
|
4
|
+
[](LICENSE.txt)
|
|
5
|
+
|
|
6
|
+
The official OlaMaps Web SDK provides a powerful and easy-to-use interface for integrating maps into your web applications. This repository contains the distribution files and serves as the public interface for issues, feature requests, and discussions.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
#### CDN Usage
|
|
11
|
+
|
|
12
|
+
Add the following script tag to your HTML file's `<head>` section:
|
|
13
|
+
|
|
14
|
+
```html
|
|
15
|
+
<script src="https://www.unpkg.com/olamaps-web-sdk@latest/dist/olamaps-web-sdk.umd.js"></script>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
#### Package Manager
|
|
19
|
+
|
|
20
|
+
Install via npm:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm i olamaps-web-sdk
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Then use in your project by imports like:
|
|
27
|
+
|
|
28
|
+
```javascript
|
|
29
|
+
import { OlaMaps } from "olamaps-web-sdk";
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Usage
|
|
33
|
+
|
|
34
|
+
#### Initialization
|
|
35
|
+
|
|
36
|
+
First, initialize `OlaMaps` with your `API key`:
|
|
37
|
+
|
|
38
|
+
```javascript
|
|
39
|
+
const olaMaps = new OlaMaps({
|
|
40
|
+
apiKey: [YOUR_API_KEY],
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
#### Rendering map
|
|
45
|
+
|
|
46
|
+
1. Add a container element to your HTML
|
|
47
|
+
|
|
48
|
+
```html
|
|
49
|
+
<div id="[MAP CONTAINER ID]"></div>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
2. Initialize the map with your desired configuration
|
|
53
|
+
|
|
54
|
+
```javascript
|
|
55
|
+
const map = olaMaps.init({
|
|
56
|
+
style: [ADD THE LINK OF TILES STYLE JSON HERE],
|
|
57
|
+
container: [MAP CONTAINER ID],
|
|
58
|
+
center: [INITIAL LAT LAN POSITION],
|
|
59
|
+
zoom: [SET ZOOM NUMBER]
|
|
60
|
+
})
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Documentation & Resources
|
|
64
|
+
|
|
65
|
+
For complete documentation and integration guides, visit our [Web SDK Documentation](https://maps.olakrutrim.com/docs/sdks/web-sdk/setup).
|
|
66
|
+
Check out our [examples directory](/examples) for various implementation scenarios.
|
|
67
|
+
|
|
68
|
+
### Community Support & Issue Tracking
|
|
69
|
+
|
|
70
|
+
All bug reports, feature requests, and general issues should be raised through GitHub.
|
|
71
|
+
|
|
72
|
+
- [Create a bug report](https://github.com/ola-maps/olamaps-web-sdk/blob/main/.github/ISSUE_TEMPLATE/bug_report.md)
|
|
73
|
+
- [Request a feature](https://github.com/ola-maps/olamaps-web-sdk/blob/main/.github/ISSUE_TEMPLATE/feature_request.md)
|
|
74
|
+
- [Browse existing issues](https://github.com/ola-maps/olamaps-web-sdk/issues)
|
|
75
|
+
|
|
76
|
+
For general questions and discussions, visit our [discussions](https://github.com/ola-maps/olamaps-web-sdk/discussions) page
|
|
77
|
+
For commercial support, contact us at [support@olakrutrim.com](mailto:support@olakrutrim.com)
|
|
78
|
+
|
|
79
|
+
## Distribution Files
|
|
80
|
+
|
|
81
|
+
The SDK includes the following distribution files:
|
|
82
|
+
|
|
83
|
+
- `dist/olamaps-web-sdk.umd.js` - UMD build (minified)
|
|
84
|
+
- `dist/index.js` - ES Module
|
|
85
|
+
- `dist/index.d.ts` - TypeScript definitions
|
|
86
|
+
|
|
87
|
+
## Versioning
|
|
88
|
+
|
|
89
|
+
We use SemVer for versioning. For available versions, see the releases page.
|
|
90
|
+
|
|
91
|
+
## Contributing
|
|
92
|
+
|
|
93
|
+
While this repository doesn't contain the source code, we welcome:
|
|
94
|
+
|
|
95
|
+
- Bug reports
|
|
96
|
+
- Feature requests
|
|
97
|
+
- Documentation improvements
|
|
98
|
+
- Usage examples
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { GeolocateControlOptions } from 'maplibre-gl';
|
|
2
|
+
import { Map as Map_2 } from 'maplibre-gl';
|
|
3
|
+
import { MapOptions } from 'maplibre-gl';
|
|
4
|
+
import { MarkerOptions } from 'maplibre-gl';
|
|
5
|
+
import { NavigationControlOptions } from 'maplibre-gl';
|
|
6
|
+
import * as OlaMapsGl from 'maplibre-gl';
|
|
7
|
+
import { PopupOptions } from 'maplibre-gl';
|
|
8
|
+
|
|
9
|
+
declare interface olaMapProps {
|
|
10
|
+
apiKey: string;
|
|
11
|
+
mode?: string;
|
|
12
|
+
threedTileset?: string;
|
|
13
|
+
accessToken?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export declare class OlaMaps {
|
|
17
|
+
private olaMaps;
|
|
18
|
+
private apiKey;
|
|
19
|
+
private accessToken;
|
|
20
|
+
mode: string;
|
|
21
|
+
private threedTileset;
|
|
22
|
+
constructor({ apiKey, accessToken, mode, threedTileset }: olaMapProps);
|
|
23
|
+
private addOlaLogo;
|
|
24
|
+
private addAttribution;
|
|
25
|
+
private fetchStaticMap;
|
|
26
|
+
private add3dLayer;
|
|
27
|
+
init(options?: MapOptions): Map_2 & typeof OlaMapsGl;
|
|
28
|
+
addNavigationControls(options?: NavigationControlOptions): OlaMapsGl.NavigationControl;
|
|
29
|
+
addGeolocateControls(options: GeolocateControlOptions): OlaMapsGl.GeolocateControl;
|
|
30
|
+
getMercatorCoordinate(): typeof OlaMapsGl.MercatorCoordinate;
|
|
31
|
+
addMarker(options?: MarkerOptions): OlaMapsGl.Marker;
|
|
32
|
+
addPopup(options?: PopupOptions): OlaMapsGl.Popup;
|
|
33
|
+
getStaticMap(url: string, elementID: string): void;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { }
|