Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nextgis/webmap

Package Overview
Dependencies
Maintainers
2
Versions
217
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nextgis/webmap - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

.rpt2_cache/3912afc1dbbb52cc55ccaa2606c7836274683e24/code/cache/0ad1a8ea0b5373d9db0926502b21ab6594ab2d71

2

package.json
{
"name": "@nextgis/webmap",
"version": "0.0.2",
"version": "0.0.3",
"description": "",

@@ -5,0 +5,0 @@ "main": "index",

@@ -1,36 +0,3 @@

# NgwMap.js
# WebMap
Universal map constructor
## Installation
Install the NGW application by instruction: http://docs.nextgis.com/docs_ngweb/source/install-ubuntu.html
Switch to development fork and branch
cd ~/ngw/nextgisweb
git remote add ado https://github.com/rendrom/nextgisweb.git
git checkout front
git pull ado front
Install dependencies and build app:
cd ./nextgisweb/newtgisweb/webmap/frontend/WebMap
npm i
npm run prod
To build development app with sourcemap run:
npm run dev
To start watching changes in development mode run:
npm run watch
Start NGW server and open the browser on the page
[NGW_SERVER]/resource/[webmap_id]/display/dev

@@ -45,3 +45,3 @@ import { AppOptions, MapOptions } from '../interfaces/WebMapApp';

this.options = deepmerge(this.options, options);
this.options = deepmerge(this.options || {}, options);

@@ -77,3 +77,3 @@ if (!this.settings && this._starterKits.length) {

for (const kit of this._starterKits) {
for (const kit of this._starterKits.filter((x) => x.getSettings)) {
const setting = await kit.getSettings.call(kit);

@@ -97,7 +97,12 @@ if (setting) {

addBaseLayer(layerName: string, provider: keyof LayerAdapters | Type<LayerAdapter>, options?: any): any {
this.map.addLayer(provider, Object.assign({}, options, {id: layerName})).then((layer) => {
addBaseLayer(
layerName: string,
provider: keyof LayerAdapters | Type<LayerAdapter>,
options?: any): Promise<LayerAdapter> {
return this.map.addLayer(provider, {...options, ...{ id: layerName }}, true).then((layer) => {
if (layer) {
this._baseLayers.push(layer.name);
}
return layer;
});

@@ -111,16 +116,16 @@ }

// region MAP
private _setupMap() {
const { extent_bottom, extent_left, extent_top, extent_right } = this.settings;
if (extent_bottom && extent_left && extent_top && extent_right) {
this._extent = [extent_bottom, extent_left, extent_top, extent_right];
private async _setupMap() {
if (this.settings) {
const { extent_bottom, extent_left, extent_top, extent_right } = this.settings;
if (extent_bottom && extent_left && extent_top && extent_right) {
this._extent = [extent_bottom, extent_left, extent_top, extent_right];
const extent = this._extent;
if (extent[3] > 82) {
extent[3] = 82;
}
if (extent[1] < -82) {
extent[1] = -82;
}
}
}
const extent = this._extent;
if (extent[3] > 82) {
extent[3] = 82;
}
if (extent[1] < -82) {
extent[1] = -82;
}
this.map.displayProjection = this.displayProjection;

@@ -131,2 +136,3 @@ this.map.lonlatProjection = this.lonlatProjection;

this._addTreeLayers();
this._addLayerProviders();

@@ -136,2 +142,3 @@ this._zoomToInitialExtent();

this.emitter.emit('build-map', this.map);
}

@@ -170,6 +177,28 @@

// }
this.map.fit(this._extent);
if (this._extent) {
this.map.fit(this._extent);
}
}
private async _addLayerProviders() {
try {
for (const kit of this._starterKits.filter((x) => x.getLayerAdapters)) {
const adapters = await kit.getLayerAdapters.call(kit);
if (adapters) {
adapters.forEach((adapter) => {
adapter.createAdapter(this.map).then((newAdapter) => {
if (newAdapter) {
this.map.layerAdapters[adapter.name] = newAdapter;
}
});
});
}
}
} catch (er) {
throw new Error(er);
}
}
// endregion
}

@@ -1,3 +0,1 @@

import { AppOptions } from './WebMapApp';
export interface TreeItem {

@@ -43,3 +41,4 @@ item_type: 'root' | 'group' | 'layer';

export interface StarterKit {
getSettings(): Promise<AppSettings | false>;
getSettings?(): Promise<AppSettings | false>;
getLayerAdapters?(): Promise<any>;
}

@@ -22,2 +22,3 @@ interface AdapterOptions {

'TILE': AdapterOptions;
[name: string]: AdapterOptions;
}

@@ -24,0 +25,0 @@

@@ -5,4 +5,10 @@ import { LayerAdapter, LayerAdapters } from './LayerAdapter';

interface LatLng {
lat: number; lng: number;
}
interface MapClickEvent {
coordinates;
latLng: LatLng;
pixel: {top: number, left: number, right?: number, bottom?: number};
source?: any;
}

@@ -16,5 +22,6 @@

emitter: EventEmitter;
layerAdapters: {[name: string]: Type<LayerAdapter>};
create(options?): void;
getLayerAdapter(adapterName: string): Type<LayerAdapter>;
onMapLoad(cb?: () => void): Promise<any>;

@@ -24,3 +31,3 @@

layerAdapter: K | Type<LayerAdapter>,
options: LayerAdapters[K]): Promise<LayerAdapter>;
options?: LayerAdapters[K], baselayer?: boolean): Promise<LayerAdapter>;

@@ -27,0 +34,0 @@ removeLayer(layerName: string): any;

@@ -0,0 +0,0 @@ import { WebLayerEntry } from '../entities/WebLayerEntry';

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc