Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
13f3907
Create __main__.py
Beakerboy Apr 4, 2024
ca74035
Create python-package.yml (#1)
Beakerboy Apr 6, 2024
39f7a74
Update README.md
Beakerboy Apr 16, 2024
52a3a98
Merge pull request #2 from Beakerboy/patch-4
kshitijrajsharma Apr 16, 2024
ee4a6df
Update geojson2osm.py
Beakerboy Apr 17, 2024
0b48796
Update input.geojson
Beakerboy Apr 17, 2024
69a4dc9
Update input.geojson
Beakerboy Apr 17, 2024
a9cf3da
Update output.xml
Beakerboy Apr 17, 2024
a3167b9
remove trailing CRLF
Beakerboy Apr 17, 2024
61fc2df
Update geojson2osm.py
Beakerboy Apr 17, 2024
7ab4e6f
Update geojson2osm.py
Beakerboy Apr 17, 2024
449ef92
Create Bug_multi.geojson
Beakerboy Apr 18, 2024
46be666
Create Multipolygon.geojson
Beakerboy Apr 18, 2024
4b4a3c7
Update test_main.py
Beakerboy Apr 18, 2024
2ea02ff
Update geojson2osm.py
Beakerboy Apr 18, 2024
e1c9d62
Update test_main.py
Beakerboy Apr 18, 2024
b883d46
Update test_main.py
Beakerboy Apr 18, 2024
e6c443a
Update geojson2osm.py
Beakerboy Apr 18, 2024
4ff20ae
Update geojson2osm.py
Beakerboy Apr 18, 2024
6fa07bb
Create repeated_point.geojson
Beakerboy Apr 18, 2024
9e4d4d8
Update repeated_point.geojson
Beakerboy Apr 18, 2024
7a3c050
Update test_main.py
Beakerboy Apr 18, 2024
35f15a5
Update test_main.py
Beakerboy Apr 18, 2024
a11617c
Update test_main.py
Beakerboy Apr 18, 2024
f9e0cce
Update test_main.py
Beakerboy Apr 18, 2024
be704a8
Update test_main.py
Beakerboy Apr 18, 2024
a7be139
Update test_main.py
Beakerboy Apr 18, 2024
5a239aa
Rename input.geojson to polygon.geojson
Beakerboy Apr 18, 2024
dc90532
Rename output.xml to polygon.xml
Beakerboy Apr 18, 2024
0078773
Create repeated_point.xml
Beakerboy Apr 18, 2024
4261e3a
Update test_main.py
Beakerboy Apr 18, 2024
808f8c9
Update repeated_point.xml
Beakerboy Apr 18, 2024
a4637b9
Delete tests/files/Bug_multi.geojson
Beakerboy Apr 18, 2024
b633c2c
Delete tests/files/Multipolygon.geojson
Beakerboy Apr 18, 2024
a4d1b40
Update geojson2osm.py
Beakerboy Apr 18, 2024
7589a92
Update geojson2osm.py
Beakerboy Apr 18, 2024
34a95e6
remove trailing line ending
Beakerboy Apr 18, 2024
aede9e3
removed trailing line break
Beakerboy Apr 18, 2024
12dd4a0
Update test_main.py
Beakerboy Apr 18, 2024
9bb001c
Merge branch 'patch-3' into patch-2
Beakerboy Apr 18, 2024
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
63 changes: 63 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python package

on:
push:
branches: [ "master" ]
pull_request:

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[tests]
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude antlr
- name: Test with pytest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pytest --cov=src
coveralls --service=github

flake8:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[tests]
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --show-source --statistics --exclude antlr
- name: Static Test with Mypy
run: |
mypy src/
29 changes: 0 additions & 29 deletions .github/workflows/test.yml

This file was deleted.

6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ pip install geojson2osm
```

## Usage
### Command Line
```python
python -m geojson2osm your_geojson_file.geojson output.osm
```

### Library
```python
import json
from geojson2osm import geojson2osm
Expand All @@ -25,4 +30,3 @@ osm_xml = geojson2osm(geojson_data)
# Save the OSM XML data to a file
with open('output.osm', 'w') as output_file:
output_file.write(osm_xml)

1 change: 0 additions & 1 deletion geojson2osm/__init__.py

This file was deleted.

38 changes: 38 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[project]
name = "geojson2osm"
version = "0.0.2"
authors = [
{ name="Kshitijraj Sharma", email="skshitizraj@gmail.com" },
]
description = "A Python package to convert GeoJSON data to OSM XML format."
readme = "README.md"
requires-python = ">=3.8"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]

[project.optional-dependencies]
tests = [
'mypy',
'pytest',
'pytest-cov',
'pytest-mock',
'coveralls',
'pep8-naming',
'flake8-annotations'
]
[project.urls]
"Homepage" = "https://github.com/kshitijrajsharma/geojson2osm"
"Bug Tracker" = "https://github.com/kshitijrajsharma/geojson2osm/issues"

[tool.pytest.ini_options]
pythonpath = "src:tests"
testpaths = [
"tests",
]
28 changes: 0 additions & 28 deletions setup.py

This file was deleted.

1 change: 1 addition & 0 deletions src/geojson2osm/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .geojson2osm import geojson2osm # noqa
21 changes: 21 additions & 0 deletions src/geojson2osm/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import json
import sys
from geojson2osm import geojson2osm as g2o


def main() -> None:
# Load your GeoJSON data
input = sys.argv[1]
geojson_data = json.load(open(input))

# Convert the GeoJSON data to OSM XML format
osm_xml = g2o(geojson_data)

# Save the OSM XML data to a file
output = sys.argv[2]
with open(output, 'w') as output_file:
output_file.write(osm_xml)


if __name__ == '__main__':
main()
Loading