{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import numpy as np\n", "from pyproj import Proj, transform\n", "from convertbng.cutil import convert_bng" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [], "source": [ "wgs84 = Proj(init='epsg:4326')\n", "\n", "# only works if you can put the ntv2 file somewhere\n", "osgb36_ostn02 = Proj('+init=EPSG:27700 +nadgrids=OSTN02_NTv2.gsb')\n", "\n", "# Specifying the Helmert params manually, and specifying the shift file\n", "osgb36_b = Proj('+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +units=m +no_defs +nadgrids=OSTN02_NTv2.gsb')\n", "\n", "osgb36 = Proj(init='epsg:27700')" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": true }, "outputs": [], "source": [ "lon = np.array([1.716073973])\n", "lat = np.array([52.65800783])" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "(array([ 651409.792]), array([ 313177.448]))" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "convert_bng(lon, lat)" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "(array([ 651409.79027509]), array([ 313177.44942814]))" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "transform(wgs84, osgb36_ostn02, lon, lat)" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "(array([ 651411.22531573]), array([ 313180.59545674]))" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "transform(wgs84, osgb36, lon, lat)" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "(array([ 651409.79027509]), array([ 313177.44942814]))" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "transform(wgs84, osgb36_b, lon, lat)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.10" } }, "nbformat": 4, "nbformat_minor": 0 }