Coder Social home page Coder Social logo

osm-to-sql's Introduction

osm-to-sql


AUR version GitHub Travis CI


Simple OSM XML data to SQL converter command. This command will create 7 SQL files with foreign key constraints. You can use these SQL files with MySQL/ SQLite or any other SQL server.

Installation

Currently only supporting to linux distros.

Arch Based Distros

Install it from arch user repository.

yaourt -S osm-to-sql

Debian Based Distros

Download the .deb file from here and install it using dpkg.

dpkg -i ./osm-to-sql_0.1.3_amd64.deb

Other Distros

Download the standalone binary file from here and run it.

Usage

This is the default help menu for the command line tool.


Usage:
    osm-to-sql [OPTIONS] -i <xml_file_path.xml> -d <output_directory>

OPTIONS:
    -i        Input open street map file in XML format.
    -d        Output directory to save output sql files.
    -r        Maximum rows per one SQL insert query. [400]
    -h        Prints help information
    -g        Do not use INSERT IGNORE queries

Table mappings

All tables have foreign key constraints and all tables will creating automatically with these SQL files. And please import with the following order when you importing to your database server.

    1.nodes
        id,lat,lng,version,changeset,user,uid,visible,date_time

    2.ways
        id,version,changeset,user,uid,visible,date_time

    3.way_nodes
        way_id,node_id
            -- way_id = ways(id)
            -- node_id = nodes(id)

    4.relations
        id,version,changeset,user,uid,visible,date_time

    5.relation_members
        rm_id,relation_id,node_id,way_id,role
            -- relation_id = relations(id)
            -- node_id = nodes(id)
            -- way_id = ways(id)
            -- sub_relation_id = relations(id)

    6.tags
        id,name

    7.ref_tags
        rt_id,tag_id,node_id,relation_id,way_id,value
            -- tag_id = tags(id)
            -- node_id = nodes(id)
            -- relation_id = relations(id)
            -- way_id = ways(id)
 

Sample output files in the sample/output folder.

Contirbutions

All contibutions and issues are welcome. Please help me to make this tool faster and powerfull.

osm-to-sql's People

Contributors

whizsid avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

osm-to-sql's Issues

Problem with foreign key

Hi, thank you very much for providing this great tool.
Everything was great and flawless, but when checking the foreign key is active, not all records may be insert in full.
But on the whole, everything was great.
Thankful

Not working for .osm file

I download https://download.geofabrik.de/europe/turkey-latest.osm.bz2 file (in xml format) file from https://download.geofabrik.de/europe/turkey.html

I used this command: osm-to-sql -i turkey-latest.xml -d myOutputFolder/

it gives this error:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 17, kind: AlreadyExists, message: "File exists" }', src/libcore/result.rs:1084:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

What is wrong?

Can it work faster?

Thank you for your life saving tool!

My be need some optimization for faster work.

It uses only 1 core of CPU. Can it use all CPU resource?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.