Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
138 commits
Select commit Hold shift + click to select a range
04c710c
Add a first pass at a langley translation file
pnorman Mar 25, 2012
f53229d
Finish up the Langley roads translation
pnorman Mar 25, 2012
7463e47
Split MultiLineStrings up into individual LineStrings
pnorman Mar 25, 2012
54c47b0
Make the XML output more readable by inserting some newlines
pnorman Mar 27, 2012
18fe007
uvmtrans: Update to newer input file structure
Mar 14, 2012
4e93aab
uvmtrans: Ignore soccer stands
Mar 28, 2012
959cd13
Merge remote-tracking branch 'andrew/master'
pnorman Mar 30, 2012
da0cfe2
Add a .gitignore file for .pyc and .osm files
pnorman Mar 30, 2012
bdd72ed
Escape keys and values in XML
pnorman Apr 13, 2012
b750431
Add a default upload=false attribute to the XML output and an option …
pnorman Apr 13, 2012
d4c83b9
Change the translations to a submodule
pnorman Apr 26, 2012
d5cb0bf
Accept shapefile directories
pnorman Apr 28, 2012
9630378
Change a try/except to an if/else which profiles slightly quicker
pnorman Apr 28, 2012
a086c32
Change map() calls to list comprehensions for speed
pnorman Apr 28, 2012
88feabe
Merge branch 'master' into shapefile_directory
pnorman Apr 28, 2012
6e18a7a
Keep track of points in linestrings to avoid creating duplicates
pnorman Apr 30, 2012
2442c6d
Add a readme file
pnorman Apr 30, 2012
b7d0f34
Tab out the example to get it to format correctly
pnorman Apr 30, 2012
dc7ee22
Create an ogr memory data store copy of the shapefile to allow local …
pnorman May 4, 2012
08360cf
Output relations as multipolygons. Previously relations had no type=*…
pnorman May 4, 2012
69462c6
Update Readme.md to include the --no-memory-copy option
pnorman May 4, 2012
d870eb3
use --recursive to pull ogr2osm and the translations in one line
pnorman May 4, 2012
aaa3def
Use integer values for position and an option to set the precision.
pnorman May 8, 2012
452c7f6
Add the ability to round when checking for duplicate points.
pnorman May 8, 2012
a8c3fdb
Merge branch 'master' of github.com:pnorman/ogr2osm
pnorman May 8, 2012
a1ff0ea
Corrected install instructions.
DarkTyger Jul 7, 2012
71095e4
Merge pull request #4 from thangalin/patch-1
pnorman Jul 7, 2012
f0af1c8
Update to latest translations
pnorman Jul 7, 2012
8632569
Update master
pnorman Jul 7, 2012
7b47bf4
Merge remote-tracking branch 'origin/master'
pnorman Jul 7, 2012
b53f6e6
Add copyright info to .py file
pnorman Jul 7, 2012
7067364
Treat ogr MultiPolygon/MultiPolygon25D object with only one geometry …
pnorman Aug 18, 2012
28d27a9
Update to new translations
pnorman Aug 18, 2012
f8d6e60
This change enable to output OSM file by utf-8.
fuga Aug 23, 2012
2039841
Merge remote-tracking branch 'fuga/master' into one_member_collections
pnorman Aug 26, 2012
470bd11
Update readme with new options
pnorman Sep 17, 2012
64cf780
Update the .gitignore to ignore shapefiles
pnorman Sep 17, 2012
ab606dc
Update translations with new layer translation
pnorman Sep 29, 2012
3b491b1
Add .DS_Store to .gitignore file
pnorman Oct 6, 2012
23d9fde
Add extracted surrey roads for basic test
pnorman Oct 27, 2012
900af49
Add a cram test verifying the XML output of a testfile
pnorman Oct 27, 2012
c242132
Rewrite the output() function to use lxml instead of SimpleXMLWriter …
pnorman Oct 28, 2012
42624eb
Switch the strategy for writing the XML from building a large lxml tr…
pnorman Oct 28, 2012
aa2df52
Add lxml info to readme
pnorman Oct 28, 2012
fce3cc1
Remove calls to sax.escape. With the change to lxml these are a bug, …
pnorman Nov 1, 2012
eab5783
Clean up some syntax
pnorman Nov 2, 2012
90df9a8
Add a hidden positive ID option and some more tests
pnorman Nov 2, 2012
ff651ae
Add a hidden option to add a version attribute to the output
pnorman Nov 2, 2012
26c2f91
Add a testcase for --add-version
pnorman Nov 2, 2012
620796e
Fix a nasty bug - output was duplicating relations
pnorman Nov 2, 2012
953777e
Change how the XML element attributes are built up to one easier to a…
pnorman Nov 3, 2012
9640ca9
Add an option to add timestamps
pnorman Nov 3, 2012
1a1c10e
import datetime if needed
pnorman Nov 3, 2012
3afea92
Add a testcase for --timestamp. Unfortunately it doesn't check the XM…
pnorman Nov 3, 2012
0672185
Use the patch from simon04 in issue #8 to use the appropriate path fo…
pnorman Nov 13, 2012
0aa1fd8
Add non-ascii shapefiles as a testcase
pnorman Nov 13, 2012
8eb57cf
Handle UTF-8 shapefiles properly. This might not work properly on sha…
pnorman Nov 13, 2012
a33f077
Add a testcase for utf8 output based on issue #11
pnorman Nov 13, 2012
fc601b8
Add a check of the output for the testcase based on issue #11
pnorman Nov 13, 2012
423fcb6
Add an option to set the encoding of the source file
pnorman Nov 15, 2012
cc0ab13
Revert "Handle UTF-8 shapefiles properly. This might not work properl…
pnorman Nov 15, 2012
7b94a62
Decode strings before passing them to the translation function.
pnorman Nov 15, 2012
9a8a414
Add a testcase for a shift_jis encoding
pnorman Nov 15, 2012
ea811b1
Fix a relation ID bug
pnorman Nov 17, 2012
1245ad5
Add an option to set the ID to start counting from
pnorman Nov 18, 2012
91a1571
Fix the testcase with the relation ID bug fix
pnorman Nov 18, 2012
8b7fd34
Add shapefile suffixes in CAPS to .gitignore
pnorman Nov 19, 2012
bb43468
Convert readme endlines to unix format
pnorman Nov 19, 2012
c27b22a
Update -h output in readme
pnorman Nov 19, 2012
72cb092
Add newlines to prettify the XML output somewhat
pnorman Nov 23, 2012
dee99a2
Use a non-empty fromlist with __import__
pnorman Nov 26, 2012
950df6d
Pass the field values through .strip() before translating them.
pnorman Jan 15, 2013
106bc04
Update the copyright line, which I forgot to do in the last commit
pnorman Jan 24, 2013
36594d6
Add a file about committing
pnorman Apr 1, 2013
d4dd50a
propagate translator function exceptions
Mar 29, 2013
0c1716d
make Relation.replacejwithi operate on geometry like everyone else
Apr 4, 2013
e5af0ee
Add mergeWayPoints() to remove duplicate nodes from ways. Typo fix.
sebastic Apr 20, 2013
3767eaf
typo in error message
pnorman Apr 20, 2013
afc1804
Add copyright
sebastic Apr 20, 2013
c1bdfe0
Add testcase for mergeWayPoints()
sebastic Apr 26, 2013
d5fd491
Update testcases with duplicate points text
pnorman Jun 29, 2013
385d564
Merge branch 'duplicates'
pnorman Jun 29, 2013
f6b9575
Merge remote-tracking branch 'ual/for_pnorman'
pnorman Jun 29, 2013
2104f05
Support OGRs network and compressed file access methods.
tpikonen Aug 19, 2013
dce4907
Handle .gz .tar.gz and .zip files transparently.
tpikonen Aug 28, 2013
c4ba6d8
Add options --idfile and --saveid to read and write starting and endi…
tpikonen Aug 28, 2013
cbaaea5
Update tests for --idfile and --saveid options.
tpikonen Sep 22, 2013
6b38ca6
Make elementIdCounter a class variable in Geometry.
tpikonen Sep 8, 2013
0fd8aa2
Make globals features and geometries class variables.
tpikonen Sep 8, 2013
246fadf
Move class definitions to a separate file, geom.py.
tpikonen Sep 8, 2013
1e037c2
Better support for OGR virtual file systems.
tpikonen Sep 23, 2013
d8e202f
Merge pull request #23 from tpikonen/master
pnorman Oct 4, 2013
9c4b6ea
Clean up copyright
pnorman Oct 4, 2013
0ed310c
add a LICENSE file containing the MIT license text, as is necessary
AdamWill Jan 21, 2014
d89c79c
Support PostgreSQL connections for source data
reidab Nov 21, 2014
5f2b0b1
Update testfiles for PG connection string support
reidab Nov 24, 2014
8e33abe
Add tests for additional DB-related error messages
reidab Nov 25, 2014
8f4d85f
Merge pull request #29 from reidab/pg-connection-string
pnorman Jan 6, 2015
ea73ac4
making python3 syntax compatible
mvexel Sep 12, 2016
6b739b9
python 3
mvexel Sep 13, 2016
f2b0897
cleaning up tabs and spaces
mvexel Sep 13, 2016
23fb74d
Merge pull request #32 from mvexel/python3
pnorman Sep 13, 2016
b368b3a
Implemented splitting long ways
Mar 22, 2017
495b719
Added option for splitting
Mar 22, 2017
b218fad
Removed merging for parts of a linestring
Mar 27, 2017
3e748ff
Merge pull request #34 from flire/master
pnorman Mar 29, 2017
4f5318b
fixed comparison error
May 22, 2017
fdd29c3
Move everything to main function in order to find entry point
jerry73204 Oct 1, 2018
1b8aae0
Remove unnecessary x permissions. Rename README file.
jerry73204 Oct 1, 2018
ac9cb33
Create setuputils script for distribution.
jerry73204 Oct 1, 2018
30501cd
Merge pull request #41 from jerry73204/master
pnorman Dec 1, 2018
756299e
Use upload=never/download=never flags unless otherwise specified
Dec 21, 2018
88f9450
Add options for upload=never, download=never, and locked
Dec 27, 2018
042a77c
Document new arguments in readme
Dec 27, 2018
6236f35
Rename no-download to never-download for consistency
Jan 3, 2019
7a01d67
Make whitespace consistent in README.md and undo superfluous line tri…
Jan 3, 2019
26f1cec
Add missed double quote and remove commented lines
Jan 3, 2019
183e226
Merge pull request #43 from KaartGroup/neverUpload
pnorman Jan 4, 2019
44fd070
Fix axis swapping with GDAL 3.0
impiaaa Sep 28, 2019
1b9cc00
Merge pull request #48 from impiaaa/gdal3fix
pnorman Oct 23, 2019
849755f
missing import of datetime
jendrusk Jan 29, 2020
37b4cb4
changed write mode to text for --save-id option
jendrusk Jan 29, 2020
f82e052
Merge pull request #50 from jendrusk/master
pnorman Jan 30, 2020
9ab9cbe
Improve performance by eliminating mergePoints
roelderickx Oct 17, 2020
1ccc58b
Seeking a new maintainer banner in README.md
Firefishy Mar 24, 2021
5d316fd
Merge pull request #59 from Firefishy/patch-1
pnorman Mar 24, 2021
e95a758
Merge pull request #25 from AdamWill/license
pnorman Mar 29, 2021
300d30c
Add continuous integration tests
roelderickx Apr 18, 2021
5e72bd4
Configure logging before starting to log
roelderickx Apr 18, 2021
3abfb6e
Add test status badge to readme
roelderickx Apr 18, 2021
e74a41f
Configure logging before starting to log
roelderickx Apr 18, 2021
ad3c1c7
Adding LINESTRING_POINTS to accomodate merging
roelderickx Apr 18, 2021
6bf19c5
CI tests (#1)
roelderickx Apr 18, 2021
6200ba6
Removing LINESTRING_POINTS after merging
roelderickx Apr 18, 2021
2c28804
Modify test files to reflect output changes of performance improvement
roelderickx Apr 18, 2021
9a5716b
Merge branch 'master' into perfmergepoints
roelderickx Apr 18, 2021
c345146
Merge pull request #54 from roelderickx/perfmergepoints
roelderickx Apr 18, 2021
a20f331
Link to the new version
roelderickx May 8, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/test_py2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: test-py2

on: [push]

jobs:
testpy2:
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v2
# Use the python version installed by Ubuntu 18.04 (version 2.7.15),
# so we can use precompiled gdal and protobuf
- name: Install xmllint and GDAL
run: sudo apt-get install -y libxml2-utils gdal-bin libgdal-dev python-gdal
- name: "Install python dependencies: cram and lxml"
run: |
python -m pip install --upgrade pip
pip install cram lxml
- name: Testing the code with cram
run: |
cram testfiles/basic_py2.t

22 changes: 22 additions & 0 deletions .github/workflows/test_py3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: test-py3

on: [push]

jobs:
testpy3:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
# Use the python version installed by Ubuntu 20.04 (version 3.8.5),
# so we can use precompiled gdal and protobuf
- name: Install xmllint and GDAL
run: sudo apt-get install -y libxml2-utils gdal-bin libgdal-dev python3-gdal
- name: "Install python dependencies: cram and lxml"
run: |
python -m pip install --upgrade pip
pip install cram lxml
- name: Testing the code with cram
run: |
cram testfiles/basic.t

11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*.pyc
*.osm
*.shp
*.shx
*.prj
*.dbf
*.SHP
*.SHX
*.PRJ
*.DBF
.DS_Store
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "translations"]
path = translations
url = git://github.com/pnorman/ogr2osm-translations.git
13 changes: 13 additions & 0 deletions Contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Tests
Test your code and make sure it passes. cram is used for tests.

Changes in speed-critical parts of the code may require profiling.

## Licensing

ogr2osm is under the MIT license. If you are committing to ogr2osm,
you are committing under this license. If you do not wish to do so,
do not submit pull requests.

If you wish to be added to the copyright holders list, submit a pull
request.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Copyright (c) 2012-2013 Paul Norman <penorman@mac.com>, Sebastiaan Couwenberg
<sebastic@xs4all.nl>, The University of Vermont <andrew.guertin@uvm.edu>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

94 changes: 94 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
ogr2osm.py
==========

[![test-py2](https://github.com/pnorman/ogr2osm/actions/workflows/test_py2.yml/badge.svg)](https://github.com/pnorman/ogr2osm/actions/workflows/test_py2.yml) [![test-py3](https://github.com/pnorman/ogr2osm/actions/workflows/test_py3.yml/badge.svg)](https://github.com/pnorman/ogr2osm/actions/workflows/test_py3.yml)

A tool for converting ogr-readable files like shapefiles into .osm data

!!! Notice !!!
--------------

This version is no longer maintained, do not file new issues or pull requests here. Development will continue [here](https://github.com/roelderickx/ogr2osm).

Installation
------------

ogr2osm requires gdal with python bindings. Depending on the file formats
you want to read you may have to compile it yourself but there should be no
issues with shapefiles. On Ubuntu you can run `sudo apt-get install -y python-gdal python-lxml` to get
the software you need.

It also makes use of lxml. Although it should fall back to builtin XML implementations seamlessly these are less likely to be tested and will most likely run much slower.

To install ogr2osm and download the default translations the following command
can be used:

git clone --recursive https://github.com/pnorman/ogr2osm

To update

cd ogr2osm
git pull
git submodule update

About
-----

This version of ogr2osm is based on
[Andrew Guertin's version for UVM](https://github.com/andrewguertin/ogr2osm)
which is in turn based on Ivan Ortega's version from the OSM SVN server.

ogr2osm will read any data source that ogr can read and handle reprojection for
you. It takes a python file to translate external data source tags into OSM
tags, allowing you to use complicated logic. If no translation is specified it
will use an identity translation, carrying all tags from the source to the .osm
output.

Import Cautions
---------------
Anyone planning an import into OpenStreetMap should read and review the import
guidelines located [on the wiki](http://wiki.openstreetmap.org/wiki/Import/Guidelines).
When writing your translation file you should look at other examples and
carefully consider each external data source tag to see if it should be
converted to an OSM tag.

Usage
-----

Usage: ogr2osm.py SRCFILE

Options:
-h, --help show this help message and exit
-t TRANSLATION, --translation=TRANSLATION
Select the attribute-tags translation method. See the
translations/ directory for valid values.
-o OUTPUT, --output=OUTPUT
Set destination .osm file name and location.
-e EPSG_CODE, --epsg=EPSG_CODE
EPSG code of source file. Do not include the 'EPSG:'
prefix. If specified, overrides projection from source
metadata if it exists.
-p PROJ4_STRING, --proj4=PROJ4_STRING
PROJ.4 string. If specified, overrides projection from
source metadata if it exists.
-v, --verbose
-d, --debug-tags Output the tags for every feature parsed.
-f, --force Force overwrite of output file.
--encoding=ENCODING Encoding of the source file. If specified, overrides
the default of utf-8
--significant-digits=SIGNIFICANTDIGITS
Number of decimal places for coordinates
--rounding-digits=ROUNDINGDIGITS
Number of decimal places for rounding
--no-memory-copy Do not make an in-memory working copy
--no-upload-false Omit upload=false from the completed file to surpress
JOSM warnings when uploading.
--never-download Prevent JOSM from downloading more data to this file.
--never-upload Completely disables all upload commands for this file
in JOSM, rather than merely showing a warning before
uploading.
--locked Prevent any changes to this file in JOSM, such as
editing or downloading, and also prevents uploads.
Implies upload="never" and download="never".
--id=ID ID to start counting from for the output file.
Defaults to 0.
Loading