@@ -25,35 +25,66 @@ See the License for the specific language governing permissions and
2525limitations under the License.
2626
2727Original C library created by Pieter Geelen. Work on Java version
28- of the mapcode library by Rijn Buve and Matthew Lowden.
28+ of the mapcode library by Rijn Buve and Matthew Lowden. Python
29+ interface by Erik Bos.
2930
30- # Using Git and ` .gitignore `
31+ # Status
3132
32- It's good practice to set up a personal global ` .gitignore ` file on your machine which filters a number of files
33- on your file systems that you do not wish to submit to the Git repository. You can set up your own global
34- ` ~/.gitignore ` file by executing:
35- ` git config --global core.excludesfile ~/.gitignore `
33+ At the moment this module is still in development!
3634
37- In general, add the following file types to ` ~/.gitignore ` (each entry should be on a separate line):
38- ` *.com *.class *.dll *.exe *.o *.so *.log *.sql *.sqlite *.tlog *.epoch *.swp *.hprof *.hprof.index *.releaseBackup *~ `
35+ # Bug Reports and New Feature Requests
3936
40- If you're using a Mac, filter:
41- ` .DS_Store* Thumbs.db `
37+ If you encounter any problems with this library, don't hesitate to use the ` Issues ` session to file your issues.
38+ Normally, one of our developers should be able to comment on them and fix.
4239
43- If you're using IntelliJ IDEA, filter:
44- ` *.iml *.iws .idea/ `
40+ # Prequisites
4541
46- If you're using Eclips, filter:
47- ` .classpath .project .settings .cache `
42+ As the Python modules relies upon the Mapcode C library you will
43+ need to have a compiler installed to be able to build and install
44+ this module.
4845
49- If you're using NetBeans, filter:
50- ` nb-configuration.xml *.orig `
46+ # Installation
5147
52- The local ` .gitignore ` file in the Git repository itself to reflect those file only that are produced by executing
53- regular compile, build or release commands, such as:
54- ` target/ out/ `
48+ Get both the Python and C repositories using:
5549
56- # Bug Reports and New Feature Requests
50+ ``` git clone https://github.com/mapcode-foundation/mapcode-python
51+ git clone https://github.com/mapcode-foundation/mapcode-cpp
52+ cd mapcode-python
53+ ```
5754
58- If you encounter any problems with this library, don't hesitate to use the ` Issues ` session to file your issues.
59- Normally, one of our developers should be able to comment on them and fix.
55+ Compile the current directory using:
56+
57+ ``` python setup.py --inplace
58+ ```
59+
60+ Install in your Python environment using:
61+
62+ ``` cd mapcode-python
63+ python setup.py install
64+ ```
65+
66+ # Usage
67+
68+
69+ ``` import mapcode
70+
71+ dir (mapcode)
72+ print mapcode.__doc__
73+ print mapcode.version()
74+ print mapcode.decode('NLD 49.4V','')
75+ print mapcode.decode('IN VY.HV','USA')
76+ print mapcode.decode('IN VY.HV','RUS')
77+ print mapcode.decode('D6.58','RU-IN DK.CN0')
78+ print mapcode.decode('IN VY.HV','')
79+ print mapcode.decode('RU-IN VY.HV','')
80+ print mapcode.decode('IN VY.HV','RUS')
81+
82+ print mapcode.isvalid('NLD 49.4V', 1)
83+ print mapcode.isvalid('VHXG9.FQ9Z',0)
84+
85+ print mapcode.encode_single(52.376514, 4.908542, 'NLD', 2)
86+ print mapcode.encode_single(41.938434,12.433114, None, 2)
87+
88+ print mapcode.encode(52.376514, 4.908542, 'NLD', 2)
89+ print mapcode.encode(39.609999,45.949999, 'AZE', 0)
90+ ```
0 commit comments