{"_id":"@mapsindoors/built-in-map-edits","_rev":"31-2b250015f768c057aa79b2121ecc1ba4","name":"@mapsindoors/built-in-map-edits","dist-tags":{"latest":"1.1.0"},"versions":{"0.1.0-alpha":{"name":"@mapsindoors/built-in-map-edits","version":"0.1.0-alpha","author":{"name":"MapsPeople A/S"},"license":"MIT","_id":"@mapsindoors/built-in-map-edits@0.1.0-alpha","maintainers":[{"name":"timi_mapspeople","email":"timi@mapspeople.com"},{"name":"enepper","email":"en@mapspeople.com"},{"name":"andreeaceachir","email":"ance@mapspeople.com"},{"name":"ammapspeople","email":"am@mapspeople.com"},{"name":"matb5303","email":"matb@mapspeople.com"},{"name":"f_hansen","email":"frha@mapspeople.com"},{"name":"madh_mapspeople","email":"madh@mapspeople.com"}],"dist":{"shasum":"dbdba8b9e70995b13d3cd2b3c57445ea622e81df","tarball":"https://registry.npmjs.org/@mapsindoors/built-in-map-edits/-/built-in-map-edits-0.1.0-alpha.tgz","fileCount":13,"integrity":"sha512-n3sKIs3Djfc8IdkKwvJe2o9lldRUsP3s81Wb+s8KzSUOxIPs09ytBF7iaT9DuzNvi5g0aYZinHXC55tsbLDUuQ==","signatures":[{"sig":"MEUCIQCaH9ki7Ph0DZnyEJcHvm3buTFWFohVt8IthBpDrcJT5AIgd7/rd5vrrZ2xnobPtJTasbVyL0HyFXsD20luWy8UFzQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":68248},"types":"index.d.ts","module":"index.esm.js","gitHead":"2b4bcb2af8dd7938f6510c4df0d57bdb51f4d133","_npmUser":{"name":"enepper","email":"en@mapspeople.com"},"_npmVersion":"10.8.2","description":"The Built-In Map Edits package provides a robust API for developers to build custom map management tools. Directly access and modify MapsIndoors data within your applications. Streamline workflows and enhance user experiences.","directories":{},"_nodeVersion":"20.17.0","dependencies":{},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/built-in-map-edits_0.1.0-alpha_1742994504906_0.7653551950162689","host":"s3://npm-registry-packages-npm-production"}},"1.0.0":{"name":"@mapsindoors/built-in-map-edits","version":"1.0.0","author":{"name":"MapsPeople A/S"},"license":"MIT","_id":"@mapsindoors/built-in-map-edits@1.0.0","maintainers":[{"name":"timi_mapspeople","email":"timi@mapspeople.com"},{"name":"enepper","email":"en@mapspeople.com"},{"name":"andreeaceachir","email":"ance@mapspeople.com"},{"name":"ammapspeople","email":"am@mapspeople.com"},{"name":"matb5303","email":"matb@mapspeople.com"},{"name":"f_hansen","email":"frha@mapspeople.com"},{"name":"madh_mapspeople","email":"madh@mapspeople.com"}],"dist":{"shasum":"a4fdb5a92bbf63a2de99adcc2163cc95b96cfe68","tarball":"https://registry.npmjs.org/@mapsindoors/built-in-map-edits/-/built-in-map-edits-1.0.0.tgz","fileCount":15,"integrity":"sha512-VZZlru4i79j6mAIKoTPnV2iAyOBsvpOyBeVg8sfXWXflQdY+dbcQoI7/GnpCA+3Oj/FX3SqlHcmhkPO99zbOJA==","signatures":[{"sig":"MEUCIQC1rxqmFX5JCe69962/sqgZsNiA7RchvQZfQUtov5RPpgIgOaQaeBAmh4aqsvrKUpty41pKgZguMRAySmCC1Ybzs4s=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":74881},"types":"index.d.ts","module":"index.esm.js","gitHead":"1a2af57e9938468339ae92300b8b0f5a5f1f3e00","_npmUser":{"name":"enepper","email":"en@mapspeople.com"},"_npmVersion":"10.8.2","description":"The Built-In Map Edits package provides a robust API for developers to build custom map management tools. Directly access and modify MapsIndoors data within your applications. Streamline workflows and enhance user experiences.","directories":{},"_nodeVersion":"20.17.0","dependencies":{},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/built-in-map-edits_1.0.0_1743505247721_0.06159252019392958","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@mapsindoors/built-in-map-edits","version":"1.0.1","author":{"name":"MapsPeople A/S"},"license":"MIT","_id":"@mapsindoors/built-in-map-edits@1.0.1","maintainers":[{"name":"timi_mapspeople","email":"timi@mapspeople.com"},{"name":"enepper","email":"en@mapspeople.com"},{"name":"andreeaceachir","email":"ance@mapspeople.com"},{"name":"ammapspeople","email":"am@mapspeople.com"},{"name":"matb5303","email":"matb@mapspeople.com"},{"name":"f_hansen","email":"frha@mapspeople.com"},{"name":"madh_mapspeople","email":"madh@mapspeople.com"}],"dist":{"shasum":"316e92897cf230b682216d1125e054b05300bbca","tarball":"https://registry.npmjs.org/@mapsindoors/built-in-map-edits/-/built-in-map-edits-1.0.1.tgz","fileCount":16,"integrity":"sha512-vKbzL2xjohxxFhaObmTitrgb5/SMll2NvSZvysj/qvF4p/yHtBB583Ex+YUb8JO1RQ+RQAugPy+CYCAWcatX0A==","signatures":[{"sig":"MEYCIQCYdfcJU8WMaLJaXhyFnpHTdNXbSF6ZM3ooxlmN5RWhqQIhAP+mOJ9RUkd5V4jRavs/Xl+OIcUSHeiYwgi9ne4tQrSd","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":75895},"types":"types/index.d.ts","module":"index.esm.js","gitHead":"15fbb401916f77b855b018c572f25eae1d6390dc","_npmUser":{"name":"enepper","email":"en@mapspeople.com"},"_npmVersion":"10.8.2","description":"The Built-In Map Edits package provides a robust API for developers to build custom map management tools. Directly access and modify MapsIndoors data within your applications. Streamline workflows and enhance user experiences.","directories":{},"_nodeVersion":"20.17.0","dependencies":{},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/built-in-map-edits_1.0.1_1744712210817_0.8182195935600731","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@mapsindoors/built-in-map-edits","version":"1.1.0","author":{"name":"MapsPeople A/S"},"license":"MIT","_id":"@mapsindoors/built-in-map-edits@1.1.0","maintainers":[{"name":"timi_mapspeople","email":"timi@mapspeople.com"},{"name":"enepper","email":"en@mapspeople.com"},{"name":"andreeaceachir","email":"ance@mapspeople.com"},{"name":"ammapspeople","email":"am@mapspeople.com"},{"name":"matb5303","email":"matb@mapspeople.com"},{"name":"f_hansen","email":"frha@mapspeople.com"},{"name":"madh_mapspeople","email":"madh@mapspeople.com"}],"dist":{"shasum":"246df9f78713d11f45c2cecd317798b6057dae64","tarball":"https://registry.npmjs.org/@mapsindoors/built-in-map-edits/-/built-in-map-edits-1.1.0.tgz","fileCount":27,"integrity":"sha512-xCDJfkPJHF3P4M4dwnNyCvZfuLypPj+dWP4+LF5nDIdrZMzFkvmwwRVvqc9UB9pAzMGsJ4+gt+Jj5mon5pnmZQ==","signatures":[{"sig":"MEUCIH3HumYCqYwF4nXpa6iMWD+YUpqJRkma00gaSnN9BilGAiEA0V1Xci+AB68n9ctG78G3ylqyS82rgvINyzth/bJP+LQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":95002},"types":"types/index.d.ts","module":"index.esm.js","gitHead":"63c51c6ab9a724e72ef6f42a38059f655c2de6ab","_npmUser":{"name":"enepper","email":"en@mapspeople.com"},"_npmVersion":"10.8.2","description":"The Built-In Map Edits package provides a robust API for developers to build custom map management tools. Directly access and modify MapsIndoors data within your applications. Streamline workflows and enhance user experiences.","directories":{},"_nodeVersion":"20.17.0","dependencies":{},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/built-in-map-edits_1.1.0_1755157697322_0.2613231723740681","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2025-03-26T13:08:24.793Z","modified":"2026-08-19T12:21:49.292Z","0.1.0-alpha":"2025-03-26T13:08:25.134Z","1.0.0-rc.0":"2025-04-01T09:09:07.789Z","1.0.0-rc.1":"2025-04-01T09:19:14.919Z","1.0.0-rc.2":"2025-04-01T09:31:20.739Z","1.0.0-rc.3":"2025-04-01T10:06:53.336Z","1.0.0-rc.4":"2025-04-01T10:18:14.808Z","1.0.0-rc.5":"2025-04-01T10:30:41.921Z","1.0.0-rc.6":"2025-04-01T10:36:48.383Z","1.0.0-rc.7":"2025-04-01T10:46:30.485Z","1.0.0-rc.8":"2025-04-01T10:54:13.313Z","1.0.0":"2025-04-01T11:00:47.908Z","1.0.1-alpha.0":"2025-04-01T12:16:57.006Z","1.0.1-alpha.1":"2025-04-01T12:34:01.764Z","1.0.1":"2025-04-15T10:16:51.032Z","1.1.0":"2025-08-14T07:48:17.498Z"},"author":{"name":"MapsPeople A/S"},"license":"MIT","description":"The Built-In Map Edits package provides a robust API for developers to build custom map management tools. Directly access and modify MapsIndoors data within your applications. Streamline workflows and enhance user experiences.","maintainers":[{"email":"matb@mapspeople.com","name":"matb5303"},{"email":"madh@mapspeople.com","name":"madh_mapspeople"},{"email":"anlu@mapspeople.com","name":"anluc"},{"email":"chwo@mapspeople.com","name":"cwolfoj"}],"readme":"# @mapsindoors/built-in-map-edits\n\nThe `@mapsindoors/built-in-map-edits` package provides a robust API for developers to build custom map management tools. Directly access and modify MapsIndoors data within your applications. Streamline workflows and enhance user experiences.\n\nReference documentation can be found here: [https://app.mapsindoors.com/mapsindoors/js/bime/latest/](https://app.mapsindoors.com/mapsindoors/js/bime/latest/)\n\n## Install\n\nYou can add the [@mapsindoors/built-in-map-edits](https://www.npmjs.com/package/@mapsindoors/built-in-map-edits) package to your project using npm or yarn:\n\n**NPM** [https://npmjs.org/](https://npmjs.org/):\n\n```shell\nnpm install @mapsindoors/built-in-map-edits\n```\n\n**Yarn** [https://yarnpkg.com/](https://yarnpkg.com/):\n\n```shell\nyarn add @mapsindoors/built-in-map-edits\n```\n\n## Usage\n\n### Obtaining an Access Token\n\nTo interact with the MapsIndoors API, you need an access token. This example demonstrates how to obtain an access token using the OAuth Resource Owner Password Credentials Grant flow. **This should only be used for development or testing purposes.**\n\n**Warning: Do not use this method in production!** Never hardcode your MapsIndoors username and password directly into your client-side code. This example is for development/testing purposes only.  Use a secure backend service to handle authentication.\n\n```js\nconst response = await fetch('https://auth.mapsindoors.com/connect/token', {\n    method: 'POST',\n    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n    body: new URLSearchParams({\n        'grant_type': 'password',\n        'client_id': 'client',\n        'username': '<YOUR_USERNAME>', // Replace <YOUR_USERNAME> with your MapsIndoors username.\n        'password': '<YOUR_PASSWORD>' // Replace <YOUR_PASSWORD> with your MapsIndoors password.\n    })\n});\n\nif (!response.ok) {\n    throw new Error(`HTTP error! status: ${response.status}`);\n}\n\nconst data = await response.json();\nconst accessToken = data.access_token;\n```\n\n### List Available Solutions\n\nIn MapsIndoors, a **[Solution](https://docs.mapsindoors.com/other/glossary#solution)** is the starting point for working with your organization's MapsIndoors data. Before opening a specific solution by its ID, you might need to find out which solutions are available.\n\nYou can retrieve a list of available MapsIndoors solutions that the access token grants access to using the `getAvailableSolutions()` method:\n\n```js\nimport { MapsIndoorsEditor } from '@mapsindoors/built-in-map-edits';\n\nMapsIndoorsEditor.accessToken = accessToken;\n\nconst availableSolutions = await MapsIndoorsEditor.getAvailableSolutions();\n\nfor (const { name, id } of availableSolutions) {\n    console.log(`Solution: ${name} - (${id})`);\n}\n```\n\n**Note:** The `MapsIndoorsEditor.accessToken` must be set before any authenticated API calls are made with MapsIndoorsEditor.\n\n### Obtaining a SolutionManager\n\nTo interact with the data (like Locations and Types) within a specific MapsIndoors Solution, you first need a [`SolutionManager`](https://app.mapsindoors.com/mapsindoors/js/bime/latest/SolutionManager.html) instance. This object provides the methods for accessing and modifying data.\n\nThere are two primary ways to obtain a [`SolutionManager`](https://app.mapsindoors.com/mapsindoors/js/bime/latest/SolutionManager.html):\n\n1. **Open by Solution ID:** Use this method if you know the ID of the MapsIndoors Solution you want to edit.\n\n2. **Connect to an SDK Instance:** Use this method if you are integrating the editor with an existing MapsIndoors Web SDK map display.\n\nChoose one of the following methods based on your use case:\n\n**Note:** Both examples are a continuation of the example found in [Obtaining an Access Token](#obtaining-an-access-token)\n\n#### Method 1: Opening a Solution by ID (`open`)\n\nIf you have the ID of the specific MapsIndoors solution you want to manage (perhaps obtained using `getAvailableSolutions()` above), you can use the `MapsIndoorsEditor.open()` method.\n\n```js\nimport { MapsIndoorsEditor } from '@mapsindoors/built-in-map-edits';\n\nMapsIndoorsEditor.accessToken = accessToken;\n\nconst solutionIdToOpen = 'YOUR_SOLUTION_ID';\n\ntry {\n    const solutionManager = await MapsIndoorsEditor.open(solutionIdToOpen);\n    console.log(`Successfully opened solution: ${solutionManager.solutionId}`);\n    // Now you can use solutionManager to interact with the solution's data.\n} catch (error) {\n    // Handle errors (e.g., invalid token, invalid ID, network issues)\n    console.error(`Failed to open solution ${solutionIdToOpen}:`, error);\n}\n```\n\n*Replace `'YOUR_SOLUTION_ID'` with your desired solution ID.*\n\nThis method returns a [`SolutionManager`](https://app.mapsindoors.com/mapsindoors/js/bime/latest/SolutionManager.html) promise, which resolves once the necessary solution configuration is loaded.\n\n#### Method 2: Connecting to an Existing SDK Instance (`connect`)\n\nIf you are integrating these editing capabilities into an application that already uses the MapsIndoors Web SDK (v4.39.1 or later), you can use the `MapsIndoorsEditor.connect()` method. This approach leverages the existing SDK instance, automatically determining the correct solutionId.\n\nThis is particularly useful for building interactive editing tools where changes can be visualized directly on the map provided by the SDK.\n\n**Note:** In this example it is assumed that `mapsIndoorsInstance` is a reference to an existing MapsIndoors SDK instance.\n\n```js\nimport { MapsIndoorsEditor } from '@mapsindoors/built-in-map-edits';\n\nMapsIndoorsEditor.accessToken = accessToken;\n\ntry {\n    // Pass your existing MapsIndoors SDK instance to connect\n    const solutionManager = await MapsIndoorsEditor.connect(mapsIndoorsInstance);\n    console.log(`Successfully connected to SDK solution: ${solutionManager.solutionId}`);\n    // Now you can use solutionManager to interact with the solution's data.\n} catch (error) {\n    // Handle errors (e.g., invalid token, invalid ID, network issues)\n    console.error('Failed to connect to MapsIndoors SDK instance:', error);\n}\n```\n\n*The minimum supported MapsIndoors SDK version is v4.39.1. For more information about the MapsIndoors SDK, see the [MapsIndoors SDK documentation](https://docs.mapsindoors.com/sdks-and-frameworks/web/tutorial).*\n\nLike `open()`, this method also returns a [`SolutionManager`](https://app.mapsindoors.com/mapsindoors/js/bime/latest/SolutionManager.html) promise.\n\n**Important:** You only need to use either open() or connect() to get your [`SolutionManager`](https://app.mapsindoors.com/mapsindoors/js/bime/latest/SolutionManager.html). The subsequent examples in this README assume you have obtained a solutionManager variable using one of these two methods.\n\n### List Available Location Types\n\nThe `SolutionManager.locationTypes` property provides a list of **[Location Types](https://docs.mapsindoors.com/other/glossary#type)** configured within the current solution. This list can be used for populating a select list or dropdown menu in your application's user interface. This allows users to easily select valid location types when creating or modifying locations, improving the user experience. The names are displayed in the solution's default language.\n\n```js\nconst locationTypes = solutionManager.locationTypes;\n\nfor(const [key, type] of locationTypes) {\n    // Find the translation object that matches the solution's default language\n    const translation = type.translations.find(translation => translation.language === solutionManager.defaultLanguage);\n\n    console.log(`Location Type: ${key} - ${translation?.name}`);\n}\n```\n\n### Update a Location's Type\n\nChange the type of an existing **[Location](https://docs.mapsindoors.com/other/glossary#location--place--poi)** using a location type key obtained from the `SolutionManager.locationTypes` list.\n\n```js\nconst locationEditor = await solutionManager.getLocation('LOCATION_ID');\n\nawait locationEditor\n    .setType('LOCATION_TYPE_KEY')\n    .save();\n```\n\n*Remember to replace `'LOCATION_ID'` and `'LOCATION_TYPE_KEY'` with your actual values.*\n\n### Update a Location's Name and Description\n\nSet localized names and descriptions for a specific location across all available languages.\n\n```js\nconst availableLanguages = solutionManager.availableLanguages;\nconst locationEditor = await solutionManager.getLocation('LOCATION_ID');\n\nfor(const language of availableLanguages) {\n    locationEditor\n        .setName(language, 'LANGUAGE_SPECIFIC_NAME')\n        .setDescription(language, 'LANGUAGE_SPECIFIC_DESCRIPTION');\n}\n\nawait locationEditor.save();\n```\n\n*Remember to replace `'LOCATION_ID'`, `'LANGUAGE_SPECIFIC_NAME'`, and `'LANGUAGE_SPECIFIC_DESCRIPTION'` with your actual values.*\n\n### Update a Location's ExternalID\n\nSet or update the external ID for a specific location, typically used to link MapsIndoors locations with external systems or identifiers.\n\n```js\nconst locationEditor = await solutionManager.getLocation('LOCATION_ID');\n\nlet externalId = locationEditor.getExternalId();\n\nlocationEditor.setExternalId('NEW_EXTERNAL_ID')\n\nawait locationEditor.save();\n```\n\n*Remember to replace `'LOCATION_ID'`, and `'NEW_EXTERNAL_ID'` with your actual values.*\n\n**Note:**\n\n- `locationEditor.getExternalId()` returns `null` if no external ID is set.\n- `locationEditor.setExternalId()` with no argument or with `null` will reset the external ID to `null`.\n- Only string values are accepted for `setExternalId`. Passing a non-string value will throw an error.\n\n### Creating a new Location\n\nYou can create a new Location by calling solutionManager.createLocation() with the required data. This method returns a [`LocationEditor`](https://app.mapsindoors.com/mapsindoors/js/bime/latest/LocationEditor.html) instance, which you can further modify and then save.\n\n```js\n// Example: Creating a new Location\nconst newLocationData = {\n    geometry: {\n        type: 'Point',\n        coordinates: [longitude, latitude] // Replace longitude, latitude with actual coordinates\n    },\n    floor: mapsIndoorsInstance.getFloor(), // Get the current floor index from MapsIndoors, if available, else set it to the desired floor index.\n    type: 'LOCATION_TYPE_KEY', // Replace LOCATION_TYPE_KEY with a valid type key from solutionManager.locationTypes\n};\n\nconst locationEditor = await solutionManager.createLocation(newLocationData);\n\n// Set the name and description\nlocationEditor\n    .setName('en', 'Parking')\n    .setDescription('en', 'Parking area for visitors');\n\n// Save the new Location to persist it\nawait locationEditor.save();\n\nconsole.log('Location created with ID:', locationEditor.id);\n```\n\n- You can use solutionManager.locationTypes to get valid type keys.\n- The translations array should include at least one language with a name.\n\n### Deleting a Location\n\nTo delete a location, simply call the delete() method on the [`LocationEditor`](https://app.mapsindoors.com/mapsindoors/js/bime/latest/LocationEditor.html).\n\n```js\nconst locationEditor = await solutionManager.getLocation('LOCATION_ID');\nif(confirm('Are you sure you want to delete this Location? This action is permanent.')) {\n    try {\n        await locationEditor.delete();\n        console.log('Location deleted successfully.');\n    } catch (error) {\n        console.error('Error deleting location:', error);\n        alert('Failed to delete location. Please try again.');\n    }\n}\n```\n\n**Note:**\nDeleting a Location is a permanent operation and cannot be undone.  \nIt is the responsibility of the implementing developer to put appropriate safeguards in place—such as confirmation dialogs, permission checks, or undo mechanisms—to prevent accidental or unauthorized deletion of Locations.  \nAlways ensure that users are clearly informed and have explicitly confirmed their intent before performing a delete operation.\n\n### Retrieving a LocationEditor on Click\n\nHere is an example demonstrating how to set up an event listener for `click` events on the map. It leverages the native Mapbox `click` event to provide the click's geographic coordinates, enabling the creation of new Locations at that position. It also allows you to query Mapbox to determine if an existing MapsIndoors Location was clicked, which can then be used to retrieve a [`LocationEditor`](https://app.mapsindoors.com/mapsindoors/js/bime/latest/LocationEditor.html) for that selected Location.\n\nThis example assumes you have a working MapsIndoors Web SDK integration. If you're new to the SDK, please refer to the [MapsIndoors Web SDK Tutorial](https://docs.mapsindoors.com/sdks-and-frameworks/web/tutorial) for setup and basic usage instructions.\n\nSet up a click event listener to retrieve a [`LocationEditor`](https://app.mapsindoors.com/mapsindoors/js/bime/latest/LocationEditor.html) instance for the clicked location. This allows you to interact with the location programmatically.\n\n**Note:** This example is a continuation of the example found in [Method 2: Connecting to an Existing SDK Instance (`connect`)](#method-2-connecting-to-an-existing-sdk-instance-connect)\n\n```js\nconst map = mapsIndoorsInstance.getMap(); // Get the Mapbox map instance from MapsIndoors SDK\nlet locationEditor = null; // Declare the locationEditor variable here to be accessible within the scope\nconst locationTypes = solutionManager.locationTypes; // Assuming this is where valid types come from\n\nmap.on('click', async (e) => {\n    // Check for features at the clicked point.\n    // The filter ensures that only clickable MapsIndoors features are considered,\n    // excluding background elements like building outlines and floorplans.\n    const features = e.target.queryRenderedFeatures(\n        e.point,\n        { filter: ['any',\n            ['!=', ['get', 'clickable'], false],\n            ['!', ['in', ['get', 'type'], ['literal', ['MI_BUILDING_OUTLINE', 'floorplan']]]]\n        ] }\n    ) ?? [];\n\n    if (features.length === 0) {\n        // If no features are found, create a new location at the clicked coordinates.\n        const floor = mapsIndoorsInstance.getFloor();\n        const type = locationTypes.get('Parking');\n        locationEditor = await createLocation({lngLat: e.lngLat, type, floor });\n        console.log('Created new location:', locationEditor);\n    } else {\n        // If features are found, get the first one (the clicked Location)\n        // and load it into the editor using its originalId.\n        const feature = features[0];\n        locationEditor = await solutionManager.getLocation(feature.properties.originalId);\n        console.log('Loaded existing location:', locationEditor);\n    }\n});\n\nasync function createLocation({lngLat, type, floor}) {\n    return await solutionManager.createLocation({\n        geometry: {\n            type: 'Point',\n            coordinates: [lngLat.lng, lngLat.lat]\n        },\n        floor,\n        type\n    });\n}\n```\n\n### Move a Location to Specific Coordinates\n\nMove a location to a new latitude and longitude.\n\n```js\nconst locationEditor = await solutionManager.getLocation('LOCATION_ID');\n\nlocationEditor.moveTo({ lat: 55.6761, lng: 12.5683 });\n\nawait locationEditor.save();\n```\n\n*Remember to replace `'LOCATION_ID'` with your actual value.*\n\n### Example: Interacting with a Single Location through the SDK\n\nThis example assumes you have a working MapsIndoors Web SDK integration. If you're new to the SDK, please refer to the [MapsIndoors Web SDK Tutorial](https://docs.mapsindoors.com/sdks-and-frameworks/web/tutorial) for setup and basic usage instructions.\n\nThis example demonstrates how to interact with a single location using the [`SolutionManager`](https://app.mapsindoors.com/mapsindoors/js/bime/latest/SolutionManager.html) obtained from an existing SDK connection. It enables you to make a location draggable on the map, allowing for interactive movement.\n\n**Note:** This example is a continuation of the example found in [Retrieving a LocationEditor on Click](#retrieving-a-locationeditor-on-click)\n\n```js\n\nwindow.addEventListener('keydown', handleKeyDown);\nwindow.addEventListener('keyup', handleKeyUp);\n\nfunction handleKeyDown(e) {\n    if(e.key !== 'd') {\n        return;\n    }\n    \n    if(!locationEditor) {\n        return;\n    }\n\n    locationEditor.draggable = true;\n}\n\nfunction handleKeyUp(e) {\n    if(e.key !== 'd') {\n        return;\n    }\n    \n    if(!locationEditor) {\n        return;\n    }\n    \n    locationEditor.draggable = false;\n}\n```\n\n*Remember to call `await locationEditor.save();` to persist the changes.*\n\n### Move a Location by Distance and Direction\n\nMove a location a given distance (meters) in a specific direction (degrees), where the direction is measured clockwise from true north.\n\n```js\nconst locationEditor = await solutionManager.getLocation('LOCATION_ID');\n\n// Move 10 meters in 45 degrees\nlocationEditor.move(10, 45); \n\nawait locationEditor.save();\n```\n\n*Remember to replace `'LOCATION_ID'` with your actual value.*\n\n### Rotate a Location\n\nRotate a location by a specified angle in degrees, measured clockwise from true north.\n\n```js\nconst locationEditor = await solutionManager.getLocation('LOCATION_ID');\n\nlocationEditor.rotate(90); // Rotate 90 degrees\n\nawait locationEditor.save();\n```\n\n*Remember to replace `'LOCATION_ID'` with your actual value.*\n\n### Resetting Location Changes\n\nThe `reset` method in the [`LocationEditor`](https://app.mapsindoors.com/mapsindoors/js/bime/latest/LocationEditor.html) class allows you to revert any changes made to a location back to its original state or the last saved state. This is useful when you want to discard any modifications and restore the location to its previous state, including its position and rotation.\n\nTo reset the changes made to a location, simply call the `reset` method on the [`LocationEditor`](https://app.mapsindoors.com/mapsindoors/js/bime/latest/LocationEditor.html) instance. This will revert the location data to its original state and dispatch a `change` event to notify any listeners about the reset.\n\n```js\nconst locationEditor = await solutionManager.getLocation('LOCATION_ID');\n\n// Set the name, description, position, and rotation for the location\nlocationEditor\n    .setName('en', 'New Name')\n    .setDescription('en', 'New Description')\n    .moveTo({ lat: 55.6761, lng: 12.5683 })\n    .rotate(90);\n\n// Save the changes\nawait locationEditor.save();\n\n// Make further changes\nlocationEditor\n    .setName('en', 'Another Name')\n    .setDescription('en', 'Another Description')\n    .moveTo({ lat: 55.6762, lng: 12.5684 })\n    .rotate(180);\n\n// Reset the changes to the last saved state\nlocationEditor.reset();\n```\n\n*Remember to replace `'LOCATION_ID'` with your actual value.*\n\n## License\n\nMIT\n","readmeFilename":"README.md"}