开发者

UK Postcode -> Easting, Northing [closed]

开发者_如何学JAVA As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 10 years ago.

Is anyone aware of a free web service which allows me to translate uk postcodes to easting and northings. I found a website where I can use screen scraping but perhaps there is a nice FREE web service out there. Thanks!

Christian


The ordnance survey have open sourced their list of postcodes including geographic coordinates (you may have to do some converting though). I haven't used the data myself yet, but I think this fits the bill.

Code-Point Open is a dataset that contains postcode units, each of which have a precise geographical location.

There are approximately 1.7 million postcode units in England, Scotland and Wales. Each postcode unit, such as KY12 8UP or PO14 2RS, contains an average of fifteen adjoining addresses.

Northern Ireland postcodes are not available with Code-Point Open.

Note that due to the nature of the british postcode system, updates happen quite frequently during a year. Make sure you download new versions as they are released.


Check out NPE Map


The Codepoint postcode database was released in 2010 as open data as a zipped series of CSV files.

If you are converting a mass of postcodes, you'll find it more efficient to locate the databases on your own system as calling to an on-line API results in your scraper waiting longer than you would have expected for a response.

You can order the postcode data from the official site here: https://www.ordnancesurvey.co.uk/oswebsite/products/code-point-open/index.html

Or simply download it from this copy: http://www.freepostcodes.org.uk/

The Northern Ireland data is not included, but there is a copy of the data here: http://jamiethompson.co.uk/web/2010/05/30/code-point-open-northern-ireland-addendum/

Save work.

The python code for parsing these two files is here: http://scraperwiki.com/scrapers/uk_postcodes_from_codepoint/edit/ http://scraperwiki.com/scrapers/ni_postcodes_from_codepoint/edit/

The python CGI script code for looking up into these two databases is here: http://scraperwikiviews.com/run/uk_postcode_lookup/?


If you are processing a lot of data then might be better to use your own local solution. Here is a Python script that can make the conversion: http://webscraping.com/blog/Converting-UK-Easting-Northing-coordinates/

from pyproj import Proj, transform

v84 = Proj(proj="latlong",towgs84="0,0,0",ellps="WGS84")
v36 = Proj(proj="latlong", k=0.9996012717, ellps="airy",
    towgs84="446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894")
vgrid = Proj(init="world:bng")


def ENtoLL84(easting, northing):
    """Returns (longitude, latitude) tuple
    """
    vlon36, vlat36 = vgrid(easting, northing, inverse=True)
    return transform(v36, v84, vlon36, vlat36)

def LL84toEN(longitude, latitude):
    """Returns (easting, northing) tuple
    """
    vlon36, vlat36 = transform(v84, v36, longitude, latitude)
    return vgrid(vlon36, vlat36)


if __name__ == '__main__':
    # outputs (-1.839032626389436, 57.558101915938444)
    print ENtoLL84(409731, 852012) 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜