# MKM map component

This is a React based component for displaying maps in MKM applications.

For displaying a base map it uses the following services:

- https://geoportaal.maaamet.ee/est/Teenused/Avalik-WMS-teenus/TMS-WMS-C-ja-WMTS-teenused-p481.html `foto@GMC`
  and `hybriid@GMC` layers
- https://geoportaal.maaamet.ee/est/Teenused/Avalik-WMS-teenus-p65.html `EESTIFOTO`, `HYBRIID` and `TOPOYKSYS_6569` layers

## Using in a project

To use this component in a React project, run the following command in the project folder:

`npm i mkm-react-map`

Then import the component where necessary:

```
import React from 'react';
import Map from 'mkm-react-map';

const MyComponent = () => {
    return <Map />;
};
```

## Documentation

This project uses [React Styleguidist](https://react-styleguidist.js.org/) to generate documentation.

For viewing generated documentations run the following commands in the repository root:

1. `npm i`

2. `npm run docs`

and open browser at the running port (default is 6060).

## Development

Refer to /src/development for more information about developing this component.

## Versioning and publishing npm package

### Creating a new version

To create a new version of this component for publishing run:

`npm version [patch|minor|major]`

for more information about bumping version number see [semantic versioning](https://docs.npmjs.com/about-semantic-versioning)

### Publishing a new version

To successfully publish the package the following requirements need to be met:

- A new version has been created locally

- The user has logged in to npm via `npm login`

After completing these actions run:

`npm publish`

for more information about publishing see [https://docs.npmjs.com/cli/publish](https://docs.npmjs.com/cli/publish)

## Utils

to generate API client stubs execute the following (assuming src_swaggers_geoapi file is in the same folder):

`openapi-generator-cli generate -i ./api-docs.yaml -o . -g javascript`
