assessment_spider.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:assessor-scraper 作者: codefornola 项目源码 文件源码
def get_address_location(parcel_map_link):
        """
        Parses the parcel map link and calculates coordinates from the extent.
        An example link looks like this:
        http://qpublic9.qpublic.net/qpmap4/map.php?county=la_orleans&parcel=41050873&extent=3667340+524208+3667804+524540&layers=parcels+aerials+roads+lakes
        """
        o = urlparse(parcel_map_link)
        query = parse_qs(o.query)
        bbox = query['extent'][0].split(' ')
        x1, y1, x2, y2 = [float(pt) for pt in bbox]
        # get the midpoint of the extent
        midpoint = [(x1 + x2) / 2, (y1 + y2) / 2]
        # transform projected coordinates to latitude and longitude
        in_proj = Proj(init='epsg:3452', preserve_units=True)
        out_proj = Proj(init='epsg:4326')
        return transform(in_proj, out_proj, midpoint[0], midpoint[1])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号