New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@inlog/inlog-maps

Package Overview
Dependencies
Maintainers
1
Versions
133
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@inlog/inlog-maps

A library for using generic layer maps

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
17
increased by41.67%
Maintainers
1
Weekly downloads
 
Created
Source

InlogMaps

A library to use generic layer maps.


Getting Started

Markers

drawMarker
drawCircleMarker
showMarkers
alterMarkerOptions

Polygons

drawPolygon
showPolygons
alterPolygonOptions

Polylines

drawPolyline
drawPolylineWithNavigation
addPolylinePath
removePolylineHighlight
showPolyline
alterPolylineOptions

Circles

drawCircle
showCircles
alterCircleOptions

PopUps

drawPopup

GEOJson

loadGEOJson

Map

addClickMap removeClickMap


Creating a new instance of InlogMaps:

Google Maps:

const map = new inlogMaps.Map('Google');

Leaflet:

const map = new inlogMaps.Map('Leaflet');

Markers:

drawMarker

let type = 'sample';
let item = { something: 'hello world' };
let icon = new inlogMaps.MarkerIcon('images/cursor_locate.png');
let options = new inlogMaps.MarkerOptions([-26, -50], true, false, icon, true, item);

function eventClick(marker, event, object) {
    // TODO: Do something here

    // Will appear 'hello world' on console
    console.log(object.something);
}

map.drawMarker(type, options, eventClick);
Parameters:
ParametersTypeDescription
typeStringType of the marker to help you find it later.
optionsinlogMaps.MarkerOptionsParameters of the marker.
eventClickFunctionCallback function when click on marker.
eventClick params.
MarkerOptions:
ParametersTypeRequiredDescription
latlngArraytruePosition of the marker.
Expects array with latitude and longitude: [Number, Number].
addToMapBooleanfalseDefine if marker shows on the map.
Default: false.
draggableBooleanfalseDefine if marker is draggable on the map.
Default: false.
iconinlogMaps.MarkerIconfalseUsed if the pin of the marker is custom.
fitBoundsBooleanfalseDefine if the map will fit on the marker.
Default: false.
objectObjectfalseIs a object that will be returned in the eventClick function.
MarkerIcon
ParametersTypeRequiredDescription
urlStringtruePath of the image.
sizeArrayfalseExpects array with size of the positions x and y: [Number, Number].
Marker Event Click Params
ParametersTypeDescription
markergoogle.maps.Marker
or
L.Marker
Return the object of the clicked marker.
eventinlogMaps.EventReturnReturn a object with events params.
objectObjectReturn the object that was passed on marker options.

drawCircleMarker

let type = 'sample';
let style = new inlogMaps.CircleMarkerStyle(5, 1, '#000000', '#FF0000', 0.8);
let options = new inlogMaps.CircleMarkerOptions([-24, -48], true, style, true);

function eventClick(marker, event, object) {
    // TODO: Do something here
}

map.drawCircleMarker(type, options, eventClick);
Parameters:
ParametersTypeDescription
typeStringType of the circle marker to help you find it later.
optionsinlogMaps.CircleMarkerOptionsParameters of the circle marker.
eventClickFunctionCallback function when click on marker.
eventClick params.
CircleMarkerOptions:
ParametersTypeRequiredDescription
latlngArraytruePosition of the circle marker.
Expects array with latitude and longitude: [Number, Number].
addToMapBooleanfalseDefine if circle marker shows on the map.
Default: false.
styleinlogMaps.CircleMarkerStyletrueStyle options of the circle marker.
fitBoundsBooleanfalseDefine if the map will fit on the marker.
Default: false.
objectObjectfalseIs a object that will be returned in the eventClick function.
CircleMarkerStyle:
ParametersTypeRequiredDescription
radiusNumbertrueRadius of the circle marker, in pixels.
weightNumberfalseStroke width in pixels.
colorStringfalseStroke color.
fillColorStringfalseFill color.
fillOpacityStringfalseFill opacity.

showMarkers

let type = 'sample';
let show = false;

map.showMarkers(show, type);
Parameters:
ParametersTypeDescription
showBooleanShow/hide marker
typeStringType of the marker

alterMarkerOptions

let type = 'sample';
let options = new inlogMaps.MarkerAlterOptions([-20, -40]);

map.alterMarkerOptions(type, options);
Parameters:
ParametersTypeDescription
typeStringType of the marker
optionsinlogMaps.MarkerAlterOptionsParameters of the marker.
MarkerAlterOptions
ParametersTypeRequiredDescription
latlngArrayfalsePosition of the circle marker.
Expects array with latitude and longitude: [Number, Number].
iconinlogMaps.MarkerIconfalsePath of the image.
styleinlogMaps.CircleMarkerStylefalseStyle options of the marker.

Polygons:

drawPolygon

function eventClick(polygon, event, object) {
    // TODO: Do something here
}

let type = 'polygon';
let path = [
    [25.774, -80.190],
    [18.466, -66.118],
    [32.321, -64.757],
    [25.774, -80.190]
];
let options = new inlogMaps.PolygonOptions(path, 1, true, '#000000', 1, '#FFFFFF', 0.8);

options.fitBounds = true;
map.drawPolygon(type, options, eventClick);
Parameters
ParametersTypeDescription
typeStringType of the polygon to help you find it later.
optionsinlogMaps.PolygonOptionsParameters of the polygon.
eventClickFunctionCallback function when click on polygon.
eventClick params.
PolygonOptions
ParametersTypeRequiredDescription
pathArraytrueExpected an array of positions.
[[Number, Number], [Number, Number]].
weightNumbertrueStroke width in pixels.
addToMapBooleanfalseDefine if polygon shows on the map.
Default: false.
colorStringfalseStroke color.
opacityNumberfalseStroke opacity.
fillColorStringfalseFill color.
fillOpacityNumberfalseFill opacity.
draggableBooleanfalseDefine if marker is draggable on the map.
Default: false.
editableBooleanfalseDefine if marker is editable.
Default: false.
fitBoundsBooleanfalseDefine if the map will fit on the polygon.
Default: false.
objectObjectfalseIs a object that will be returned in the eventClick function.
Polygon Event Click Params
ParametersTypeDescription
markergoogle.maps.Polygon
or
L.Polygon
Return the object of the clicked polygon.
eventinlogMaps.EventReturnReturn a object with events params.
objectObjectReturn the object that was passed on polygon options.

showPolygons

let type = 'polygon';

map.showPolygons(true, type);
Parameters
ParametersTypeDescription
showBooleanShow/hide polygon
typeStringType of the polygon

alterPolygonOptions

let type = 'polygon';
let options = new inlogMaps.PolygonAlterOptions();

options.fillColor = '#FFFF00';
map.alterPolygonOptions(type, options);
Parameters
ParametersTypeDescription
typeStringType of the polygon.
optionsinlogMaps.PolygonAlterOptionsParameters of the polygon.
PolygonAlterOptions
ParametersTypeRequiredDescription
weightNumbertrueStroke width in pixels.
colorStringfalseStroke color.
opacityNumberfalseStroke opacity.
fillColorStringfalseFill color.
fillOpacityNumberfalseFill opacity.

Polylines:

drawPolyline

function eventClick(polyline, event, object) {
    // TODO: Do something here
}

let type = 'polyline';
let options = new inlogMaps.PolylineOptions();

options.path = [
    [-23.02487, -43.48283],
    [-23.02475, -43.48391],
    [-23.02486, -43.48233],
    [-23.02443, -43.48212],
    [-23.02429, -43.48243],
    [-23.02477, -43.48245]
];
options.addToMap = true;
options.fitBounds = true;
map.drawPolyline(type, options, eventClick);
Parameters
ParametersTypeDescription
typeStringType of the polyline to help you find it later.
optionsinlogMaps.PolylineOptionsParameters of the polyline.
eventClickFunctionCallback function when click on polyline.
eventClick params.
PolylineOptions
ParametersTypeRequiredDescription
pathArraytrueExpected an array of positions.
[[Number, Number], [Number, Number]].
addToMapBooleanfalseDefine if polyline shows on the map.
Default: false.
fitBoundsBooleanfalseDefine if the map will fit on the polyline.
Default: false.
editableBooleanfalseDefine if polyline is editable.
Default: false.
draggableBooleanfalseDefine if polyline is draggable on the map.
Default: false.
colorStringfalseStroke color.
weightNumbertrueStroke width in pixels.
objectObjectfalseIs a object that will be returned in the eventClick function.
Polyline Event Click Params
ParametersTypeDescription
markergoogle.maps.Polyline
or
L.Polyline
Return the object of the clicked polyline.
eventinlogMaps.EventReturnReturn a object with events params.
objectObjectReturn the object that was passed on polyline options.

drawPolylineWithNavigation

let type = 'polylineNavigation';
let options = new inlogMaps.PolylineNavigationOptions();

options.path = [
    [-23.024657518124023, -43.48285071469786],
    [-23.02484265813435, -43.48359100438597],
    [-23.025441015571875, -43.48343945957663],
    [-23.02518922621311, -43.48251677967551],
    [-23.02535214879308, -43.482527508511566]
];
options.infowindows = [
    '<h1>1</h1>',
    '<h1>2</h1>',
    '<h1>3</h1>',
    '<h1>4</h1>',
    '<h1>5</h1>'
];
options.addToMap = true;
options.weight = 8;
options.fitBounds = true;
options.navigateOptions = new inlogMaps.NavigationOptions('#0000FF');
map.drawPolylineWithNavigation(type, options);
Parameters
ParametersTypeDescription
typeStringType of the polyline to help you find it later.
optionsinlogMaps.PolylineNavigationOptionsParameters of the polyline.
PolylineNavigationOptions
ParametersTypeRequiredDescription
pathArraytrueExpected an array of positions.
[[Number, Number], [Number, Number]].
infowindowsArrayfalseExpected an array of strings.
[String, String].
addToMapBooleanfalseDefine if polyline shows on the map.
Default: false.
fitBoundsBooleanfalseDefine if the map will fit on the polyline.
Default: false.
editableBooleanfalseDefine if polyline is editable.
Default: false.
draggableBooleanfalseDefine if polyline is draggable on the map.
Default: false.
colorStringfalseStroke color.
weightNumberfalseStroke width in pixels.
objectObjectfalseIs a object that will be returned in the eventClick function.
navigateOptionsinlogMaps.NavigationOptionsfalseIs a object that will be returned in the eventClick function.
NavigationOptions
ParametersTypeRequiredDescription
colorStringfalseStroke color.
Default: '#FF0000'
weightNumberfalseStroke width in pixels.
Default: 10

addPolylinePath

let type = 'polyline';
let position = [-23.024657518124023, -43.48285071469786]];

map.addPolylinePath(type, position);
Parameters
ParametersTypeDescription
typeStringType of the polyline.
positionArrayPosition of the new path.
Expects array with latitude and longitude: [Number, Number].

removePolylineHighlight

map.removePolylineHighlight();

showPolyline

let type = 'polyline';

map.showPolyline(true, type);
Parameters
ParametersTypeDescription
showBooleanShow/hide polyline
typeStringType of the polyline

alterPolylineOptions

let type = 'polyline';
let options = new inlogMaps.PolylineAlterOptions(true, true, '#00FF00', 12, {
    item: 'Edited'
});

map.alterPolylineOptions(type, options);
Parameters
ParametersTypeDescription
typeStringType of the polyline.
optionsinlogMaps.PolylineAlterOptionsParameters of the polyline.
PolylineAlterOptions
ParametersTypeRequiredDescription
editableBooleanfalseDefine if polyline is editable.
Default: false.
draggableBooleanfalseDefine if polyline is draggable on the map.
Default: false.
colorStringfalseStroke color.
weightNumberfalseStroke width in pixels.
objectObjectfalseIs a object that will be returned in the eventClick function.

Circles:

drawCircle

function eventClick(circle, event, object) {
    // TODO: Do something here
}

let type = 'circle';
let options = new inlogMaps.CircleOptions();

options.addToMap = true;
options.center = [-25.4327193, -49.2784139];
options.radius = 100;
options.weight = 1;
options.fitBounds = true;
map.drawCircle(type, options, eventClick);
Parameters
ParametersTypeDescription
typeStringType of the circle to help you find it later.
optionsinlogMaps.CircleOptionsParameters of the circle.
eventClickFunctionCallback function when click on circle.
eventClick params.
CircleOptions
ParametersTypeRequiredDescription
centerArraytrueCenter of the circle.
Expects array with latitude and longitude: [Number, Number].
radiusNumbertrueRadius of the circle, in meters.
weightNumbertrueStroke width in pixels.
addToMapBooleanfalseDefine if circle shows on the map.
Default: false.
fillOpacityNumberfalseFill opacity.
fillColorStringfalseFill color.
colorStringfalseStroke color.
opacityNumberfalseStoker opacity.
draggableBooleanfalseDefine if circle is draggable on the map.
Default: false.
editableBooleanfalseDefine if circle is editable.
Default: false.
fitBoundsBooleanfalseDefine if the map will fit on the circle.
Default: false.
objectObjectfalseIs a object that will be returned in the eventClick function.
Circle Event Click Params
ParametersTypeDescription
markergoogle.maps.Circle
or
L.Circle
Return the object of the clicked circle.
eventinlogMaps.EventReturnReturn a object with events params.
objectObjectReturn the object that was passed on circle options.

showCircles

let type = 'circle';

map.showCircles(true, type);
Parameters
ParametersTypeDescription
showBooleanShow/hide circle
typeStringType of the circle

alterCircleOptions

let type = 'circle';
let options = new inlogMaps.CircleAlterOptions();

options.fillColor = '#FFFF00';
map.alterCircleOptions(type, options);
Parameters
ParametersTypeDescription
typeStringType of the circle.
optionsinlogMaps.CircleAlterOptionsParameters of the circle.
CircleAlterOptions
ParametersTypeRequiredDescription
weightNumbertrueStroke width in pixels.
fillOpacityNumberfalseFill opacity.
fillColorStringfalseFill color.
colorStringfalseStroke color.
opacityNumberfalseStoker opacity.

Popups:

drawPopup

let options = new inlogMaps.PopupOptions(event.latlng, 
    '<p>Hello world!<br />This is a nice popup.</p>', marker);

map.drawPopup('marker', options);
Parameters:
ParametersTypeDescription
typeStringType of the popup.
optionsinlogMaps.PopupOptionsOptions of the popup.
PopupOptions
ParametersTypeRequiredDescription
latlngArraytruePosition of the circle marker.
Expects array with latitude and longitude: `
markergoogle.maps.Marker
or
L.Marker
falseMarker object received on events
contentStringtrueContent of the popup.

GEOJson

loadGEOJson

let data = {
    'type': 'Feature',
    'properties': {
        'name': 'Sample',
        'amenity': 'Sample Test',
        'popupContent': 'You are at Inlog!'
    },
    'geometry': {
        'type': 'Point',
        'coordinates': [-49.2806026, -25.4327193]
    }
};

let options = {
    draggable: true,
    editable: true
};

function eventClick(event) {
    // TODO: Do something here
}

map.loadGEOJson(data, options, eventClick);
Parameters:
ParametersTypeDescription
dataStringGeoJSON a ser plotado no mapa.
optionsGEOJson OptionsGeoJSON options
eventClickFunctionCallback function when click on the map.
Returns a inlogMaps.EventReturn as param.
GEOJson Options
ParametersTypeDescription
editableBooleanDefine if layer is editable on the map.
Default: false.
draggableBooleanDefine if layer is draggable on the map.
Default: false.

Map

addClickMap

function eventClick(event) {
    // TODO: Do something here
}

map.addClickMap(eventClick);
Parameters:
ParametersTypeDescription
eventClickFunctionCallback function when click on the map.
Returns a inlogMaps.EventReturn as param.

removeClickMap

map.removeClickMap();

Events

EventReturn
ParametersTypeDescription
latlngArrayClicked position.
Contains latitude and longitude: [Number, Number].

Development

npm run dev

Keywords

FAQs

Package last updated on 05 Jul 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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