Convert cubic mesh code to WKT in Python

At the memorandum level, I created a function to convert 3rd order mesh code to WKT with python. It's sober, but it's easy to lose track of when you need it ...


def toWKTfromMeshCode3(mcode3: 'mesh code(str)'):-> 'wkt(str)'
  south = (int(mcode3[0:2]) * 80 + int(mcode3[4:5]) * 10 + (int(mcode3[6:7]))) * 30 / 3600
  west = (int(mcode3[2:4]) * 80 + int(mcode3[5:6]) * 10 + (int(mcode3[7:8]))) * 45 / 3600 + 100
  north = south + 30 / 3600
  east = west + 45 / 3600
  wkt = 'POLYGON(({e} {n},{w} {n},{w} {s},{e} {s},{e} {n}))'.format(s=south, w=west, n=north, e=east)
  return wkt

Recommended Posts

Convert cubic mesh code to WKT in Python
Python code to convert region mesh code to latitude / longitude
Python script to convert latitude / longitude to mesh code
Convert python 3.x code to python 2.x
Convert markdown to PDF in Python
Convert psd file to png in Python
Convert from Markdown to HTML in Python
Convert absolute URLs to relative URLs in Python
I wrote a code to convert quaternions to z-y-x Euler angles in Python
Convert FBX files to ASCII <-> BINARY in Python
Convert PDFs to images in bulk with Python
Rewrite Python2 code to Python3 (2to3)
Personal notes to doc Python code in Sphinx
Convert exponential notation float to str in Python
Convert timezoned date and time to Unixtime in Python2.7
I want to write in Python! (1) Code format check
How to convert / restore a string with [] in python
Convert NumPy array "ndarray" to lilt in Python [tolist ()]
Convert CIDR notation netmask to dotted decimal notation in Python
How to convert floating point numbers to binary numbers in Python
Convert the image in .zip to PDF with Python
Convert callback-style asynchronous API to async / await in Python
Convert / return class object to JSON format in Python
[Python] Created a method to convert radix in 1 second
Convert Webpay Entity type to Dict type (recursively in Python)
[python] Convert date to string
To flush stdout in Python
Convert numpy int64 to python int
[Python] Convert list to Pandas [Pandas]
Convert Scratch project to Python
Convert CIDR notation in Python
Speech to speech in python [text to speech]
Generate QR code in Python
How to develop in Python
Character code learned in Python
Post to Slack in Python
Convert images passed to Jason Statham-like in Python to ASCII art
I want to be able to run Python in VS Code
Convert Excel file to text in Python for diff purposes
[Python] How to do PCA in Python
[Python] Generate QR code in memory
How to collect images in Python
Automatically format Python code in Vim
Workflow to convert formula (image) to python
In the python command python points to python3.8
Convert list to DataFrame with python
Try to calculate Trace in Python
Python> list> Convert double list to single list
How to use Mysql in python
How to wrap C in Python
How to use ChemSpider in Python
To maintain code quality in PyCharm
How to use PubChem in Python
[Python] Convert natural numbers to ordinal numbers
Convert decimal numbers to n-ary numbers [python]
How to run TensorFlow 1.0 code in 2.0
Code tests around time in Python
How to handle Japanese in Python
Python> tuple> Convert double tuple to single tuple
An alternative to `pause` in Python
[Subprocess] When you want to execute another Python program in Python code