Setting extents on Feature

Hi,

I found this https://github.com/holoviz/geoviews/issues/141 talking about extents.
It seems in this issue that this code should work :

import geoviews.feature as gf
extents = (144.0, -45.0, 149.0, -40.0)
gf.coastline.clone(extents=extents)

When plotted this gives me ridiculous extents (really small like 2.500e-4). If I zoom out the plot is practically fine (it is upside down).

Versions :
geoviews 1.8.1
bokeh 2.0.1
holoviews 1.13.2

Thanks

Ok, sorry for the noise, I was using

opts.defaults(opts.Feature(apply_ranges=False))

So i had to remove it.
I hope the topic will still be useful for others

However it seems that setting extents on several features doesn’t work

panelMap = gf.coastline.clone(extents=extents) * gf.ocean.clone(extents=extents)

I would avoid using extents and use xlim/ylim options instead. Eventually I would like to deprecate extents.

1 Like

Thanks, setting xlim and ylim worked

xlim and ylim doesn’t work for me. Does anyone have a working example to share?

I also couldn’t apply either .opts(xlim=..., ylim=...) or .redim.range(Longitude=..., Latitude=...) to gf.coastline * gf.ocean. Do you mind opening an issue on geoviews’ Github tracker @RichardPinter ?

I would but I honestly don’t know how to open an issue. If you could do it and/or explain it to me that would be awesome!

I don’t know how to make it work with gf. objects but this might help. This works for me now with custom made WMTS objects.

This is what I did: ( I cannot share all the information as it is work data):

#load_dump_RD804 and load_dump_RD806 are pd.DataFrames

XMIN =?
XMAX =?
YMIN = ?
YMAX =?

map_to_use = WMTS(?)
points_change_tiles= (
map_to_use*
load_dump_RD804*
load_dump_RD806
)
points_change_tiles.opts(xlim=(XMIN,XMAX),ylim =(YMIN,YMAX), height=400, width=800)
gv.save(points_change_tiles,“Points_Change_Tiles.html”)

I hope this helps. Let me know if you have any questions!