
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
wpify-mapy-cz-legacy
Advanced tools
This library works with standard Mapy.cz API, but it's nicer and more easy-to-use. However, the only minor API capabilities are not implemented and it can be used to advanced mapy.cz scenarios.
The map is loaded asynchonously, so it won't break your page speed indexes. It's built with page speed in mind.
The library can be used on any website. You can find example WordPress plugin with implementation here: https://gitlab.com/wpify/test-mapy-cz
npm install wpify-mapy-cz --save
or
yarn add wpify-mapy-cz
import { load, MapyCz } from 'wpify-mapy-cz';
// Setup configuration object
const config = {
element: document.getElementById('some-map-div-id'), // this is only required parameter
center: { latitude: 50.11968806014661, longitude: 14.42896842864991 },
zoom: 13,
};
// 1: Load the map with callback function
load(config, (mapycz) => {
// some map manipulation after load on callback
});
// 2: or with Premise
const mapycz = new MapyCz(config);
mapycz.resolver.then(mapycz => {
// some map manipulation after load in Promise
});
// 3: or with async
const mapycz = new MapyCz(config);
await mapycz.resolver;
// some map manipulation
// 4: or in case you need to configure the map on the first render without further manipulations
load(config);
element
: domelement, required; Element where you want to render the maplang
: string; Language in the map. Accepts any of cs
, en
, de
, sk
, pl
mapType
: string; Type of the map; default DEF_BASE
api
: string; Loads full
or simple
map; default full
center
: object; Center of the map in the { longitude: 0, latitude: 0 }
format; default { longitude: 0, latitude: 0 }
zoom
: number; Zoom level; default 13default_controls
: boolean; If true, adds default map controlssync_control
: boolean; If true, synchronizes the map with element size changesmarkers
: array; Adds multiple markers (see the marker format bellow)marker
: object; Adds a marker (see the marker format bellow)auto_center_zoom
: bool; Set the center and zoom to fit the markersclusterers
: string|array|boolean; Sets the clusterer to the marker layer(s)poi
: boolean; Show points of interestmap_type_switch
: array|boolean; Shows the map type switcher. Accepts boolean or array of map typesimage_overlay
: array|object; Sets the image overlay. Accepts array of overlays or overlay definitiongpx
: array|object; Sets the GPX. Accepts array of GPXs or single GPX definitionconst config = {
element: document.getElementById('some-map-div-id'),
center: { latitude: 50.11968806014661, longitude: 14.42896842864991 },
zoom: 13,
...
};
update
Updates the map based on configuration objectmapycz.update({
// configuration object
});
getMap
Returns the original map object new SMap
const smap = mapycz.getMap();
setZoom
Sets the map zoom levelmapycz.setZoom(13);
addDefaultControls
Adds mapy.cz default controlsmapycz.addDefaultControls();
addControlSync
Sync map with viewport changemapycz.addControlSync();
addMarker
Adds marker to the mapconst options = {
latitude: 50.07520039245642,
longitude: 14.35905933288575,
id: 'marker-1',
layer: 'markers',
title: 'Marker 1 title',
pin: 'https://placekitten.com/20/30',
pointer: true,
card: { header: 'Marker 1', body: 'This is Marker 1', footer: 'This is Marker 1 footer' },
click: (event, options, marker) => console.log(event, options, marker),
}
mapycz.addMarker(options);
addMarkers
Adds multiple markers to the mapconst markers = [{
latitude: 50.07520039245642,
longitude: 14.35905933288575,
id: 'marker-1',
layer: 'markers', // Layer where place the marker, default 'markers'
title: 'Marker 1 title',
pin: 'https://placekitten.com/20/30',
pointer: true,
card: { header: 'Marker 1', body: 'This is Marker 1', footer: 'This is Marker 1 footer' },
click: (event, options, marker) => console.log(event, options, marker),
}, {
latitude: 50.084398631374334,
longitude: 14.497203825988777,
id: 'b1',
layer: 'b',
pin: 'https://placekitten.com/20/20'
}];
mapycz.addMarkers(markers);
removeMarkers
Removes all markers from the mapmapycz.removeMarkers();
autoCenterZoom
Sets center and zoom to fit all the markersmapycz.autoCenterZoom();
setCenter
Sets the center of the mapmapycz.setCenter({
latitude: 50.07520039245642,
longitude: 14.35905933288575
});
addClusterer
Sets the clusterer to the markers layermapycz.addClusterer();
// or
mapycz.addClusterer('some-marker-layer-name');
addClusterers
Sets the clusterers to the all marker layersmapycz.addClusterers();
addPoi
Displays points of interests on the mapmapycz.addPoi();
removePoi
Remove points of interests from the mapmapycz.removePoi();
addMapTypeSwitch
Shows the map type switchermapycz.addMapTypeSwitch(['DEF_BASE', 'DEF_TURIST', 'DEF_OPHOTO']);
// or
mapycz.addMapTypeSwitch(); // all available map types
removeMapTypeSwitch
Remove map types switchermapycz.removeMapTypeSwitch();
addImageOverlay
Adds an image overlay to the mapmapycz.addImageOverlay({
id: 'some-id',
image: 'https://placekitten.com/300/300',
topLeft: { latitude: 50.07520039245642, longitude: 14.35905933288575 },
bottomRight: { latitude: 50.07564106690275, longitude: 14.458279608764656 },
opacity: 0.5,
});
removeImageOverlay
Removes image overlays from the mapmapycz.removeImageOverlay();
addGpx
Adds a GPX into mapThe data OR source must be defined to render the GPX data
mapycz.addGpx({
id: 'some-gpx-id', // optional GPX layer id
data: '<?xml version="1.0" encoding="UTF-8"?><gpx ...>...</gpx>', // XML document with GPX
source: 'https://www.wpify-mapy-cz.test/test.gpx', // URL to the XML document with GPX
fit: true, // fit the map to the gpx route
colors: ['red'], // color of the gpx route
maxPoints: 500, // max points to render
});
removeGpx
Removes GPX layers from the mapmapycz.removeGpx();
hideLayer
Hides the layermapycz.hideLayer('markers');
hideAllLayers
Hides all layers of given typemapycz.hideAllLayers('markers');
showLayer
Shows the layermapycz.showLayer('markers');
showAllLayers
Hides all layers of given typemapycz.showAllLayers('markers');
isLayerVisible
Returns true if the layer with specific id is currently visiblemapycz.isLayerVisible('markers');
findByAddress
Finds the location by addressmapycz.findByAddress('Prague')
.then(console.log)
findByCoords
Finds the location address by coordsmapycz.findByCoords({ latitude: 50.11968806014661, longitude: 14.42896842864991 })
.then(console.log);
addSuggest
Registers a suggest box to find the addressmapycz.addSuggest({
input: document.getElementById('some-input-id'),
lang: 'cs',
}).then((place) => console.log('selected place', place));
DEF_BASE
DEF_TURIST
DEF_OPHOTO
DEF_HISTORIC
DEF_OPHOTO0203
DEF_OPHOTO0406
DEF_SMART_BASE
DEF_SMART_OPHOTO
DEF_SMART_TURIST
DEF_TURIST_WINTER
DEF_SMART_WINTER
DEF_GEOGRAPHY
DEF_OPHOTO1012
DEF_OPHOTO1415
DEF_OPHOTO1618
DEF_BASE_NEW
DEF_TURIST_NEW
FAQs
Simplified Mapy.cz API
We found that wpify-mapy-cz-legacy demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.