{ "info": { "author": "Marjan Moderc", "author_email": "marjan.moderc@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "PySiTra\n=======\n\nA Python package for a two-way 2D transformation between old and new\nslovenian coordinates system.\n\nAbout\n-----\n\nPySitra is a python written library two-way (currently **2D** only!) transformation between\nold and new slovenian coordinates system. The project and it's name\n(**Py**\\ thon **S**\\ loven\\ **i**\\ an **Tra**\\ nsformation) is inspired\nby the popular Slovenian web portal for online point transformation\nbetween old (D48GK) and new (D96TM) coordinate\nsystems, called `SitraNet.si `__, and it's C-written\ncommand-line-friendly successor `Geo Coordinate\nConverter `__. Library\ncomes with a handy command-line utility tool that enables an easy batch\nconversion of shapefiles and coma-separated ascii files.\n\nCurrent version supports two most commonly used transformating methods for 2D\npoint transformations:\n\n- **triangle:** affine 6-parametric 2D triangle transformation, based on 899 `Slovenian reference points `__ (best accuracy)\n\n- **24regions:** a simplified 4-parametric 2D transformation, where parameteres are precalculated for 24 Slovenian regions (`more info `__)\n\nProgram contains spatailly precalculated regional transformation\nparameters, but also allows a manual specification of transformation\nparameters for both available methods.\n\n**IMPORTANT NOTICE:** Library is primarily intended and therefore mostly\nsuitable for slovenian coordinate systems D48GK (espg: 3912) and D96TM\n(epsg: 3794)!\n\nFor more theoretical background, see the official GURS\n`webpage `__.\n\nInstallation:\n-------------\n\n**Installing on Linux:**\n\nLibrary is available on PyPi repository, so it can easily be installed with pip:\n\n::\n\n pip install pysitra\n\nMind that prerequisites for such a simplicity of course include having Python (2 or 3) and pip installed on your system.\nLibrary depends on some powerful, but sometimes hard-to-install Python libraries (numpy,scipy,pandas,geopandas),\nthat themselves need some (standard) geospatial system dependencies (`GEOS `__,\n`GDAL `__), all installable by ``sudo apt-get ...``. For more on installing those on Linux, see\n`this page `__.\n\n**Installing on Windows:**\n\nInstalling pysitra on Windows is straightforward, but it takes a bit more steps:\n\n- First, if you don't even have a Python installed,\n the easiest way to setup the proper Python environment and its dependencies is by installing `Anaconda `__.\n This is a Python distibution that ships with most of the popular libraries out of the box.\n- Despite Anaconda's awesomeness, libraries that require non-python GEOS and GDAL are best\n separetely installed by downloading the .whl file that matches your Python and Windows (32 or 64 bit) version from `this repo `__.\n Download appropriate wheels for `GDAL `__,\n `Fiona `__ and\n `Shapely `__ and install them with ``pip install *.whl``.\n- Compliling non-pure Python dependencies on Windows also requires C++ compilers, so in case of installation errors,\n make sure you have `Visual C++ Build Tools package `__ installed.\n If you are using Python2.7, double check also for `Visual C++ 2008 Service Pack 1 `__ and\n `Visual C++ Compiler for Python 2.7 `__.\n\n- Then you can install pysitra with pip as in the above, Linux example.\n\n\n\nUsage:\n------\n\n1. Python API\n~~~~~~~~~~~~~\n\n**1.1. Transforming python lists of points:**\n\n.. code:: python\n\n from pysitra import SloTransformation\n\n # List of point that you want converted into d96 via several methods\n D48_POINTS = [(500000,100000),(0,0),(650000,200000)]\n\n\n # Initialize a Triangle Transformation object\n ts_triangle = SloTransformation(from_crs=\"d48\",method=\"triangle\")\n\n # Initialize a 24regions transformation object\n ts_24region = SloTransformation(from_crs=\"d48\",method=\"24regions\")\n\n # Initialize a affine transformation object with your own parameters\n ts_triangle_manual = SloTransformation(from_crs=\"d48\",method=\"triangle\",params=\"1.00001;0.000040647;-374.668;-0.00002241;1.000006;494.8428\".split(\";\"))\n\n # Note, that seemingly redundant recreation of different transformations as a separate object comes very handy, when you want to\n # transform many files/lists at once, so you don't have to perform the expensive transformation object initialization\n # for every file/list separately.\n\n\n # Once you have transformation object initialized, you can use it's .transform() method to transform old points into\n # new points quite cheaply:\n print(\"Triangle transformation (affine 6parametric):\")\n print(ts_triangle.transform(D48_POINTS))\n print(\"24regions transformation (4parametric):\")\n print( ts_24region.transform(D48_POINTS))\n print(\"Triangle transformation with custom parameters:\")\n print(ts_triangle_manual.transform(D48_POINTS))\n\n**1.2. Transforming files with python**\n\n.. code:: python\n\n from pysitra import shp_transformation,csv_transformation\n from pysitra.utils import recognize_csv_separator,check_for_csv_header\n import geopandas as gpd\n import pandas as pd\n\n\n # SHAPEFILES:\n\n #read shapefile into GeoDataFrame and transform it and save it as into new shapefile\n df_in = gpd.read_file(\"shapefile_in_d48.shp\")\n df_out = shp_transformation(df_in,from_crs=\"d48\",method=\"24regions\")\n df_out.to_file(\"shapefile_in_d96.shp\")\n\n\n # ASCII CSVS:\n csv_file = \"terrain_measurements_in_d48.csv\"\n\n sep = recognize_csv_separator(csv_file) #guess the separator type\n header = check_for_csv_header(csv_file) #check if file has header\n\n #read csv file into DataFrame, transform them by triangle method with custom parameters and save it to csv.\n csv_in = pd.read_csv(csv_file, sep=sep, header=header)\n csv_out = csv_transformation(df_in=csv_in, from_crs=\"d48\", method=\"triangle\", params=\"1.00001;0.000040647;-374.668;-0.00002241;1.000006;494.8428\".split(\";\"))\n csv_out.to_file(\"terrain_measurements_in_d96.csv\")\n\n**1.3. Using low level functions to transform point-by-point**\n\n.. code:: python\n\n from pysitra import trans_2R_4params,trans_2R_6params\n\n D48_POINTS = [(500000,100000), (0,0), (650000,200000)]\n\n for point in D48_POINTS:\n # 4parametric transformation with params: scale,rotation,trans_x,trans_y\n x, y = trans_2R_4params(point[0], point[1], params=[0.9999873226,0.0009846750,378.755,-493.382])\n print(x, y)\n # 6parametric transformation with params a,b,c,d,e,f\n x, y = trans_2R_6params(point[0], point[1], params=[1.00001,0.000040647,-374.668,-0.00002241,1.000006,494.8428])\n print(x, y)\n\n2. Command Line Utility\n~~~~~~~~~~~~~~~~~~~~~~~\n\nTransformations on a file (directory) level are best carried out by\nusing the command line utility, that automatically ships and installs\nwith the library. Utility can be invoked with the command ``sitra`` in\nyour shell. Calling ``sitra --help`` brings up commands overview with\navailable options:\n\n::\n\n $ sitra --help\n Usage: sitra [OPTIONS] FILE_IN [FILE_OUT]\n\n Options:\n --to_crs [d48|d96] Coordinate system to transform your data into\n [required]\n --method [triangle|24regions] Transformation method to be used\n --params TEXT Optional argument: semicolon separated manual\n parameters, required for each transformation\n method (24regions:4params,\n triangle:6params,...\n --help Show this message and exit.\n\n**2.1. RULES AND DEFAULT CMD BEHAVIOUR**\n\n- ``FILE_IN`` is a mandatory input. Valid input file type are ESRI\n Shapefiles (\\*.shp) or plain ASCII csv files (\\*.csv, \\*.txt)\n- If no outfile name is given as input ``FILE_OUT``, the same filename\n with extension \\_{crs} will be used automaticaly! (e.g.:\n shapefile.shp --> shapefile\\_d96.shp)\n- If input file is ASCII type, program will try to autodetect field for\n easting and northing by checking the column values range and column\n names\n- If input file is type \\*.shp, program check its EPSG code and will\n complain if input's crs is not reverse of the desired crs! No such\n test can be performed with ascii input types\n- parameter ``--to_crs`` is mandatory and can only be\n ``d96``\\ (=EPSG:3794) or ``d48`` (=EPSG:3912).\n- default value for ``--method`` is ``triangle`` (best accuracy)\n- default value for ``--params`` is ``None`` (they get calculated\n automatically - best accuracy)\n- in case you want to perform transformation with your own\n transformation parameters, you have to specify them manually with an\n option ``--params`` in a following style:\n\n - for affine triangle transformation (=2R-6parameters\n transformation):\n ::\n\n ... -method=triangular --params=\"scale_x;rotation_y;translation_x;rotation_x;scale_y;translation_y\" ...\n\n - for simplified 2R-4parameters transformation (which is used in\n 24regions transformation)\n\n ::\n\n ... --method=24regions --params=\"scale;CCW_rotation[dec \u00b0];translation_x[m];translation_y[m]\" ...\n\n - note the apostrophe ``\"`` or ``'`` around the semicolon-separated\n values in both cases! See the actual examples below!\n\n**2.2. CMD EXAMPLES**:\n\n1. A minimal example usage for transforming\n shapefile with default settings (--method=triangle) will save result into 'old\\_shapefile\\_d96.shp'\n\n ::\n\n sitra --to_crs=d96 old_shapefile.shp\n\n2. Another example, this time with --method=24regions and specified\n output:\n\n ::\n\n sitra --to_crs=d96 --method=24regions old_shapefile.shp new_shapefile.shp\n\n3. Example with csv file (note that no csv format specification is\n needed --> separator and x,y,z columns are automatically guessed!):\n\n ::\n\n sitra --to_crs=d48 --method=24regions Cool_points.csv Back_to_MariaTheresa_times.csv\n\n4. In all the above examples the transformation parameters were\n automatically calculated based on a chosen method and point location.\n But you can also specify your own parameters, but you have to make\n sure you pass correct number of parameters in right order for the\n corresponding transformation method. Here is an example for custom\n affine 6-parametric 2R transformation (~triangle) d48-->d96\n tranformation. (*Parameters are given in order a,b,c,d,e,f, based on\n this `standard naming\n convention `__*):\n\n ::\n\n sitra --to_crs=d96 --method=triangle --params='1.00001;0.000040647;-374.668;-0.00002241;1.000006;494.8428' old_points.csv new_points.csv\n\n5. For a 4-parameteric 2R transformation (~24regions) from d96 to back\n to d48 using your own transformation parameters, do the following:\n (*example parameters based on a region No.1 of the `d96-->d48\n 24region\n transformation `__)*\n :\n\n ::\n\n sitra --to_crs=d96 --method=24regions --params=\"0.9999873226;0.0009846750;378.755;-493.382\" old_points.csv new_points.csv\n\nTODO:\n-----\n\n- Implementation for 3D points conversion (7-parametric transformation) -->\n 1region,3regions,7regions transformation\n- Implementation for projcs-->geocs transformation (GEOID model!)\n\nAuthors\n-------\n\n- **Marjan Moderc**, ARSO, Slovenia - *the coding wizardy* -\n `GitHub `__\n- **Regina Kolenc**, ARSO, Slovenia - *mathematical-geodetic\n background*\n\nLicense\n-------\n\nThis project is licensed under the MIT License - see the\n`LICENSE.txt `__\nfile for details\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/marjanmo/pysitra", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pysitra", "package_url": "https://pypi.org/project/pysitra/", "platform": "", "project_url": "https://pypi.org/project/pysitra/", "project_urls": { "Homepage": "https://github.com/marjanmo/pysitra" }, "release_url": "https://pypi.org/project/pysitra/0.3.4/", "requires_dist": null, "requires_python": "", "summary": "Python implementation of the most popular slovenian transformation methods (SiTra!)", "version": "0.3.4" }, "last_serial": 3111655, "releases": { "0.3.1": [ { "comment_text": "", "digests": { "md5": "c2af85c4c3fbc41e9044d04b8b297203", "sha256": "e0b7d68d23fe4db2d7a4d375d49d842652b16ca624ca4765beed7ff6a794b2ad" }, "downloads": -1, "filename": "pysitra-0.3.1.tar.gz", "has_sig": false, "md5_digest": "c2af85c4c3fbc41e9044d04b8b297203", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1281221, "upload_time": "2017-06-06T06:55:33", "url": "https://files.pythonhosted.org/packages/ee/cb/c6670d61863c61806e7395113f8ad08cc713d9b9ff42d42e8db2750631ba/pysitra-0.3.1.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "d0f2bce4f7c6e7932c3c3b66c7dbce0f", "sha256": "eab2f022813af46bbd36f093240f4aa4af2168c23d85c5aa85de9f6a1fe0bb2a" }, "downloads": -1, "filename": "pysitra-0.3.2.tar.gz", "has_sig": false, "md5_digest": "d0f2bce4f7c6e7932c3c3b66c7dbce0f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1282625, "upload_time": "2017-06-06T08:12:58", "url": "https://files.pythonhosted.org/packages/be/23/1e8cccbb10e13e1798f248e0328edff4f1e79e1573423b5d7dc3f69ff73d/pysitra-0.3.2.tar.gz" } ], "0.3.3": [ { "comment_text": "", "digests": { "md5": "dceb72fecd63452b5d3cf9027945fcaf", "sha256": "6e71d9ac115d4e5a521395e516a9a5d455848197ccc268a7e4bdc129f4608426" }, "downloads": -1, "filename": "pysitra-0.3.3.tar.gz", "has_sig": false, "md5_digest": "dceb72fecd63452b5d3cf9027945fcaf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1282830, "upload_time": "2017-06-07T11:00:04", "url": "https://files.pythonhosted.org/packages/ab/b2/3eb6e28ece07e807cec835c3358d2645476ed5ecbfa2ed3ab1c318a98a9e/pysitra-0.3.3.tar.gz" } ], "0.3.4": [ { "comment_text": "", "digests": { "md5": "353c99931866e3f50cc3d864fa8930a1", "sha256": "2c9458d343f19875e068cd85b0cb2077546211c831960e130ffea62341e17f77" }, "downloads": -1, "filename": "pysitra-0.3.4.tar.gz", "has_sig": false, "md5_digest": "353c99931866e3f50cc3d864fa8930a1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1283064, "upload_time": "2017-08-21T12:02:27", "url": "https://files.pythonhosted.org/packages/21/3b/eb4925598f6b17d66245710a4c7065d379cbf9b23d5db16fe4c696536045/pysitra-0.3.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "353c99931866e3f50cc3d864fa8930a1", "sha256": "2c9458d343f19875e068cd85b0cb2077546211c831960e130ffea62341e17f77" }, "downloads": -1, "filename": "pysitra-0.3.4.tar.gz", "has_sig": false, "md5_digest": "353c99931866e3f50cc3d864fa8930a1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1283064, "upload_time": "2017-08-21T12:02:27", "url": "https://files.pythonhosted.org/packages/21/3b/eb4925598f6b17d66245710a4c7065d379cbf9b23d5db16fe4c696536045/pysitra-0.3.4.tar.gz" } ] }