11# NGI KOF Parser
22
33[ ![ security: bandit] ( https://img.shields.io/badge/security-bandit-yellow.svg )] ( https://github.com/PyCQA/bandit )
4+ [ ![ security: safety] ( https://img.shields.io/badge/security-safety-yellow.svg )] ( https://github.com/pyupio/safety )
5+ [ ![ code style] ( https://img.shields.io/badge/code%20style-black-000000.svg )] ( https://github.com/ambv/black )
6+ [ ![ Checked with mypy] ( http://www.mypy-lang.org/static/mypy_badge.svg )] ( http://mypy-lang.org/ )
7+ [ ![ python] ( https://img.shields.io/badge/Python-3.9-3776AB.svg?style=flat&logo=python&logoColor=white )] ( https://www.python.org )
48
5- This is the NGI Python package for parsing kof files.
9+
10+
11+ Python package for parsing KOF files.
612
713References:
814
@@ -11,21 +17,22 @@ NORWEGIAN GEOTECHNICAL SOCIETY
1117SYMBOLER OG DEFINISJONER I GEOTEKNIKK] ( http://ngf.no/wp-content/uploads/2015/03/2_NGF-ny-melding-2-endelig-utgave-2011-12-04-med-topp-og-bunntekst-Alt-3.pdf )
1218- [ Norkart KOF specification] ( http://www.anleggsdata.no/wp-content/uploads/2018/04/KOF-BESKRIVELSE-Oppdatert2005.pdf )
1319
14- Latest releases see [ CHANGES.md] ( CHANGES.md )
20+ Latest releases see [ CHANGES.md] ( https://github.com/norwegian-geotechnical-institute/kof-parser/blob/main/ CHANGES.md)
1521
1622# Installation (end user)
1723
1824``` bash
1925
20- pip install ngi- kof-parser
26+ pip install kof-parser
2127
2228```
2329
2430## Basic usage
2531
2632### Read a kof file
33+
2734``` python
28- from ngi_kof_parser import KOFParser
35+ from kof_parser import KOFParser
2936
3037parser = KOFParser()
3138
@@ -35,7 +42,7 @@ srid = 5110
3542locations = parser.parse(' tests/data/test.kof' , result_srid = srid, file_srid = srid)
3643
3744for location in locations:
38- print (location)
45+ print (location)
3946
4047# Output:
4148# name='SMPLOC1' methods=[] point_easting=112892.81 point_northing=1217083.64 point_z=1.0 srid=5110
@@ -51,23 +58,23 @@ for location in locations:
5158### Write a kof file
5259
5360``` python
54- from ngi_kof_parser import KOFWriter
55- from ngi_kof_parser import Location
61+ from kof_parser import KOFWriter
62+ from kof_parser import Location
5663
5764kof_writer = KOFWriter()
5865
5966srid = 5110
6067locations = [Location(name = ' SMPLOC1' , point_easting = 112892.81 , point_northing = 1217083.64 , point_z = 1.0 ),
6168 Location(name = ' SMPLOC2' , point_easting = 112893.15 , point_northing = 1217079.46 , point_z = 2.0 , methods = [' TOT' ]),
62- Location(name = ' SMPLOC3' ,point_easting = 112891.88 , point_northing = 1217073.01 , point_z = 0.0 , methods = [' CPT' ])]
63-
69+ Location(name = ' SMPLOC3' , point_easting = 112891.88 , point_northing = 1217073.01 , point_z = 0.0 , methods = [' CPT' ])]
70+
6471kof_string = kof_writer.writeKOF(
6572 project_id = ' project_id' , project_name = ' cool-name' , locations = locations, srid = srid
6673)
6774
6875print (kof_string)
6976# Output:
70- # 00 KOF Export from NGI Field Manager
77+ # 00 KOF Export from NGI's KOF parser
7178# 00 Project: project_id. Name: cool-name
7279# 00 Spatial Reference ID (SRID): 5110
7380# 00 Export date (UTC): 2022-08-22 13:49:44.394607
@@ -104,53 +111,22 @@ There are several combinations of how to set up a local development environment.
104111
105112We use Poetry for dependency management. See [ Install poetry] ( https://python-poetry.org/docs/ ) if needed.
106113
107- To set up a local development environment on you local machine, make sure you have set up your NGI credentials.
108- You need to generate Personal Access Token (PAT). Follow
109- [ this guide] ( https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate )
110- for how to get a PAT via the Azure DevOps GUI. ` Packaging (Read) ` access is sufficient.
111-
112- After generating the PAT, run this command:
113-
114- poetry config http-basic.ngi-fm build <PAT>
115-
116114Then, from the project root folder run:
117115
118116 poetry install
119117
120118
121-
122119# Build and Test
123120
124121Run in the project root folder:
125122
126123 poetry install
127- pytest
124+ poetry run pytest
128125
129126Build the package wheel:
130127
131128 poetry build
132129
130+ # Contribute
133131
134- # Publish
135-
136- To publish the package to NGI's private Azure Artifacts repository set the following configuration:
137-
138- poetry config repositories.ngi https://pkgs.dev.azure.com/ngi001/277b2f77-691a-4d92-bd89-8e7cac121676/_packaging/fieldmanager/pypi/upload
139-
140- To publish the package to Azure Artifacts, make sure you have set up your NGI credentials.
141-
142- You need to generate Personal Access Token (PAT). Follow
143- [ this guide] ( https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate )
144- for how to get a PAT via the Azure DevOps GUI. ` Packaging (Read, write, & manage) ` access is sufficient.
145-
146- If you want to publish your newly built package you need to set your NGI credentials:
147-
148- poetry config pypi-token.ngi <PAT>
149-
150- poetry publish -r ngi
151-
152- # TODOs
153-
154- - Add tests
155- - Extend with position transformation from file data srid (input) to project srid (output)
156- - Extend with position transformation from file srid (input) to new output fields in wgs84
132+ Please start by adding an issue before submitting any pull requests.
0 commit comments