I have exported a file from OSM. Which is in the form of .osm extension. How can i open that file?

asked 28 May '18, 07:46

Guriya's gravatar image

Guriya
21223
accept rate: 0%

2

Hi @Guriya. What are you trying to do and which software do you use? Are you trying to get a data for some GIS project or do you want to extract something or do you want to edit the .osm file? Both in JOSM and in QGIS you can open it depending on what you want to do next.

(28 May '18, 08:08) Privatemajory

I have opened .osm file through JOSM but it is in the form of map. But i have to perform some analysis on data. For that purpose i have to understand the format of data.

(28 May '18, 08:15) Guriya

You have to provide more information in order to get helpful answers. What kind of analysis? What is your goal?

(28 May '18, 09:19) scai ♦

I want to save this data in my own db. For that purpose i am doing all this.

(28 May '18, 09:38) Guriya
1

You are still holding back essential information. What database are you using? Anyway, maybe you find your answer at https://wiki.openstreetmap.org/wiki/Planet.osm#Processing_the_file or https://wiki.openstreetmap.org/wiki/Converting_map_data_between_formats or https://wiki.openstreetmap.org/wiki/OSM_XML

(28 May '18, 09:59) scai ♦

If you want to import the OSM data to some DB, you can use one of the tools for that. Like osm2pgsql or Osmosis

permanent link

answered 29 May '18, 12:27

altopalo's gravatar image

altopalo
565811
accept rate: 0%

If you open it in a text editor you'll find that a .osm file is a pretty simple XML file.

Many modern computer languages, both scripting and compiled, have fairly easy ways to read and parse XML files if you want to do something non-standard. Just create a small .osm file with JOSM or download a small area in .osm format from one of the OSM analysis sites and open it up to see what the structure is. I don't think it took me more than 5 minutes to work out the schema. A lot longer than 5 minutes to write the custom tool I needed for one project.

permanent link

answered 20 May, 04:23

stf's gravatar image

stf
7.5k962119
accept rate: 19%

Actually, the osm overpass query language has both the older xml, and the newer json format: https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL.

I'd recommend json over xml but only because it's easier to read and json has a lot of support. Both are fine, however, because you'll have to translate it to geojson to make it useful. For example, converting the data to vector tiles via tippecanoe would require json.

(20 May, 04:34) backspaces

As a recent noob in gis land, I found a fairly simple approach.

First of all, I am focusing on geojson and tiles, both vector and raster, and am willing to be bleeding edge. I am web centric.

To get OSM data, I use the osm query approach via curl. This returns the data as a .json format, but not geojson. The url syntax for osm data is described here: https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL. It is a bit weird, but googling will likely find what you need.

To convert the OSM to geojson, I use the github repo "osmtogeojson" recommended by the osm wiki. Very nice & easy.

Then to view the geojson, I use MapBox Studio. You have to get a MB account. MBStudio lets you upload a "dataset" i.e. geojson, not a tile set, which you can then search, edit, view, export and convert to non-editable MapBox vector tile sets.

Because json is so wide spread, I use simple node scripts to filter the osm .. selecting only certain features based on geometry, whitelisting properties, minifying, and so on. This lets me start with an initial osm of 13MB and convert it into a 2.3MB geojson. In my particular case, I want the street data only.

There are several tools available for managing json like the simple node scripts I use.

And once I'm done with the geojson, I can easily convert it to vector tile sets using either tippecanoe, the tiler from Mapbox, or mapbox studio (it will create the tile set and let you "style" the set easily).

I realize some of this is exotic, but I can help you get started.

permanent link

answered 20 May, 00:30

backspaces's gravatar image

backspaces
111
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×64

question asked: 28 May '18, 07:46

question was seen: 1,699 times

last updated: 20 May, 04:34

powered by OSQA