Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><a href="http://spatialreference.org/ref/epsg/27700/" rel="nofollow noreferrer">EPSG:27700 on spatialreference.org</a> gives various strings for defining this, including one for proj4.</p> <p>Here is example code <strong>in ruby</strong> using the proj4 bindings :</p> <pre><code>#!/usr/bin/ruby require 'rubygems' require 'proj4' #Some example WGS84 lat lon coordinates to convert: lon = -0.10322 lat = 51.52237 srcPoint = Proj4::Point.new(Math::PI * lon.to_f / 180, Math::PI * lat.to_f / 180) srcPrj = Proj4::Projection.new("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs") destPrj = Proj4::Projection.new("+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.999601 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894 +units=m +no_defs &lt;&gt;") point = srcPrj.transform(destPrj, srcPoint) puts "http://www.openstreetmap.org/?mlat=" + lat.to_s + "&amp;mlon=" + lon.to_s + "&amp;zoom=16" puts "Converts to:"; puts "http://streetmap.co.uk/grid/" + point.x.round.to_s + "_" + point.y.round.to_s + "_106" </code></pre> <p>The output:</p> <p><a href="http://www.openstreetmap.org/?mlat=51.52237&amp;mlon=-0.10322&amp;zoom=16" rel="nofollow noreferrer">http://www.openstreetmap.org/?mlat=51.52237&amp;mlon=-0.10322&amp;zoom=16</a><br> Converts to:<br> <a href="http://streetmap.co.uk/grid/531691_182089_106" rel="nofollow noreferrer">http://streetmap.co.uk/grid/531691_182089_106</a></p> <p>So this is working accurately now. Originally I was trying just the 'destPrj' string, and calling the 'forward' method, but this refused to do the datum conversion, resulting everything being 100m out. It seemed to be necessary to use the 'srcPrj' string and the 'transform' method, to get the datum conversion happening.</p> <p>See also my blog post: <a href="http://www.harrywood.co.uk/blog/2010/06/29/ruby-code-for-converting-to-uk-ordnance-survey-coordinate-systems-from-wgs84/" rel="nofollow noreferrer">Ruby code for converting to UK Ordnance Survey coordinate systems from WGS84?</a> which includes a pure ruby version (not proj4) for doing the same</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload