Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Land Information New Zealand XYZ maps #153

Open
billgeo opened this issue Nov 26, 2023 · 2 comments
Open

Land Information New Zealand XYZ maps #153

billgeo opened this issue Nov 26, 2023 · 2 comments

Comments

@billgeo
Copy link

billgeo commented Nov 26, 2023

Land Information New Zealand has a free and openly licensed XYZ service (requires a developer key) that could be added here. If you are interested in country specific services.

https://basemaps.linz.govt.nz

Github: https://github.com/linz/basemaps

@martinfleis
Copy link
Member

Hi @billgeo, we are always open to country-specific datasets. We already have some, so feel free to go ahead and add NZ. The instructions are here.

@mwtoews
Copy link

mwtoews commented Oct 30, 2024

At the moment, only the Aerial basemaps are supported. The Topographic maps are currently vector tiles in protobuf (.pbf) format, which are not supported here. I'll eventually get to a PR for this issue, but for the time being, do this:

import contextily as cx
import geopandas
from xyzservices import TileProvider

# demo data in Hawke's Bay
gdf = geopandas.GeoDataFrame(geometry=geopandas.points_from_xy([1900000, 1930000], [5580000, 5620000]), crs=2193)
gdf_wm = gdf.to_crs(epsg=3857)

key = "abcde..."  # obtain this from LINZ

BaseMapsNZ_imagery = TileProvider({
    "name": "BaseMapsNZ_imagery",
    "url": "https://basemaps.linz.govt.nz/v1/tiles/{variant}/{crs}/{z}/{x}/{y}.{ext}?api={key}",
    "variant": "aerial",
    "crs": 3857,
    "ext": "webp",
    "attribution": "Map data: (C) LINZ CC BY 4.0 | (C) Imagery Basemap contributors",
})

BaseMapsNZ_pipeline = TileProvider({
    "name": "BaseMapsNZ_pipeline",
    "url": "https://basemaps.linz.govt.nz/v1/tiles/{variant}/{crs}/{z}/{x}/{y}.{ext}?api={key}&pipeline={pipeline}",
    "variant": "elevation",
    "crs": 3857,
    "ext": "png",
    "pipeline": "color-ramp",
    "attribution": "Map data: (C) LINZ CC BY 4.0 | (C) Imagery Basemap contributors",
})

# with Aerial base
ax = gdf_wm.plot()
cx.add_basemap(ax, source=BaseMapsNZ_imagery(key=key))

# change the imagery source
ax = gdf_wm.plot()
cx.add_basemap(ax, source=BaseMapsNZ_imagery(variant="hawkes-bay-sn9585-1996-0.8m", key=key))

# elevation
ax = gdf_wm.plot()
cx.add_basemap(ax, source=BaseMapsNZ_pipeline(key=key))

there are hundreds of different variants listed in the website UI to choose from. Some sources need a pipeline to be specified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants