# OSM to GeoJSON Converter

Convert OpenStreetMap (OSM) XML data to GeoJSON format

> Canonical page: https://elysiatools.com/en/tools/osm-to-geojson

- **Category:** Format Conversion

- **Keywords:** osm, openstreetmap, geojson, converter, gis, geographic, maps, osm to geojson

## Overview

The OSM to GeoJSON Converter is a specialized utility designed to transform raw OpenStreetMap (OSM) XML data into the widely supported GeoJSON format, enabling seamless integration with web mapping libraries and GIS software.

## Inputs

- **OSM XML Input** (textarea): Enter OpenStreetMap XML data...
- **Include Nodes (Points)** (checkbox)
- **Include Ways (Lines/Polygons)** (checkbox)
- **Include Relations** (checkbox)
- **Pretty Print Output** (checkbox)

## When to use

- When you need to visualize OpenStreetMap data in web-based mapping tools like Leaflet or Mapbox.
- When preparing geographic datasets for analysis in modern GIS applications that prefer JSON-based structures.
- When you need to extract specific geographic features like nodes, ways, or relations from a raw OSM export.

## How it works

- Paste your raw OpenStreetMap XML data into the input field.
- Select the specific feature types you wish to include, such as nodes, ways, or relations.
- Toggle the 'Pretty Print' option if you require human-readable, formatted output.
- Click the convert button to generate and download your GeoJSON file.

## Use cases

- Web Developers building custom map interfaces using Leaflet or OpenLayers.
- Data Analysts importing OSM features into web-based visualization dashboards.
- GIS Specialists converting legacy OSM exports for use in modern cloud-native mapping platforms.

## Frequently asked questions

### What is the difference between OSM XML and GeoJSON?

OSM XML is a verbose format specific to OpenStreetMap, while GeoJSON is a lightweight, standard format used by most modern web mapping frameworks.

### Can I convert large OSM files?

This tool is optimized for standard data snippets. For extremely large datasets, consider using specialized command-line tools like osmium.

### Does this tool support relations?

Yes, you can enable the 'Include Relations' checkbox to process complex geographic relations in your output.

### Is the output valid GeoJSON?

Yes, the tool generates standard GeoJSON objects that comply with RFC 7946 specifications.

### Do I need to install any software?

No, this is a web-based utility that runs entirely in your browser.

## Related tools

- [GeoJSON to OSM Converter](https://elysiatools.com/en/tools/geojson-to-osm): Convert GeoJSON format to OpenStreetMap (OSM) XML format
- [JSON to XML Converter](https://elysiatools.com/en/tools/json-to-xml): Convert JSON data to XML format with customizable formatting options
- [Excel to JSON Converter](https://elysiatools.com/en/tools/excel-to-json): Convert Excel file to JSON format, extracting data from the first worksheet
- [XML to JSON Converter](https://elysiatools.com/en/tools/xml-to-json): Convert XML data to JSON format with customizable parsing options
- [BOM Character Remover](https://elysiatools.com/en/tools/data-bom-remover): Remove BOM (Byte Order Mark) characters from text and file content. Perfect for cleaning up text files that have encoding issues, fixing CSV imports, and preparing data for processing. Features: - Detect and remove UTF-8 BOM (EF BB BF) - Detect and remove UTF-16 BOM (FE FF or FF FE) - Detect and remove UTF-32 BOM (00 00 FE FF or FF FE 00 00) - Support multiple input formats - Visual BOM character display - Detailed detection report - Support for batch text processing Common Use Cases: - Fix CSV file import errors - Clean up text file encoding issues - Prepare data for JSON parsing - Fix XML parsing problems - Resolve API data encoding conflicts - Standardize text data format
- [XLSX Conditional Formatting Rule](https://elysiatools.com/en/tools/xlsx-conditional-formatting-rule): Batch-apply conditional formatting rules such as threshold highlights, data bars, and color scales to Excel worksheets
- [BSON Converter](https://elysiatools.com/en/tools/bson-converter): Encode and decode data to/from BSON (Binary JSON) format
- [CSON to JSON Converter](https://elysiatools.com/en/tools/cson-to-json): Convert CSON (CoffeeScript Object Notation) data to JSON format

## Samples

- [Android Serialization Java Samples](https://elysiatools.com/en/samples/android-serialization-java): Android Java serialization examples including JSON serialization, deserialization, and XML parsing
- [Android Serialization Kotlin Samples](https://elysiatools.com/en/samples/android-serialization-kotlin): Android Kotlin serialization examples including JSON serialization, deserialization, and XML parsing
- [macOS Serialization Objective-C Samples](https://elysiatools.com/en/samples/macos-serialization-objectivec): macOS Objective-C serialization examples including JSON serialization, JSON deserialization, and XML parsing
- [macOS Data Serialization Swift Samples](https://elysiatools.com/en/samples/macos-serialization-swift): macOS Swift data serialization examples including JSON serialization, deserialization, and XML parsing

## Related content

- [Geospatial Coordinate Conversion and Map Data Workflow](https://elysiatools.com/en/hubs/geospatial-coordinate-workflows): Normalize coordinate formats, verify locations, calculate distance and bearing, then convert GeoJSON, KML, OSM, and GPX data for downstream mapping work.
