[OpenLayers-Users] COG and basemap
Marc Jansen
jansen at terrestris.de
Fri May 27 01:35:48 PDT 2022
Hi Jakob,
what happens if you change the extent of the view (leave it out,
configure it to sth. bigger that the extent of the source)?
Just a wild guess.
Best
Marc
Am 27.05.22 um 10:18 schrieb Jakob Miksch:
> Dear list,
>
> I am trying to display COGs in OpenLayers. This works well for single
> images. However, I would like to add more more layers like a basemap.
> But then the view is blocked to the extent of the COG. See my example
> below.
>
> Is there a way to overlay a COG on a basemap and still be able to zoom
> and pan wherever I want and not being restricted by the extent of the COG?
>
> best regards,
> Jakob
>
> importGeoTIFFfrom'ol/source/GeoTIFF.js';
> importMapfrom'ol/Map.js';
> importProjectionfrom'ol/proj/Projection.js';
> importWebGLTileLayerfrom'ol/layer/WebGLTile.js';
> importViewfrom'ol/View.js';
> import{getCenter} from'ol/extent.js';
> importTileLayerfrom'ol/layer/Tile';
> importOSMfrom'ol/source/OSM';
> constprojection= newProjection({
> code:'EPSG:32721',
> units:'m',
> });
> // metadata from
> https://s3.us-west-2.amazonaws.com/sentinel-cogs/sentinel-s2-l2a-cogs/21/H/UB/2021/9/S2B_21HUB_20210915_0_L2A/S2B_21HUB_20210915_0_L2A.json
> constsourceExtent= [300000, 6090260, 409760, 6200020];
> constcogSource= newGeoTIFF({
> sources:[
> {
> url:'https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/21/H/UB/2021/9/S2B_21HUB_20210915_0_L2A/TCI.tif',
> },
> ],
> });
> constcogLayer= newWebGLTileLayer({
> source:cogSource,
> });
> newMap({
> target:'map',
> layers:[
> newTileLayer({
> source:newOSM()
> }),
> cogLayer
> ],
> view:newView({
> projection:projection,
> center:getCenter(sourceExtent),
> extent:sourceExtent,
> zoom:1,
> }),
> });
> --
> Jakob Miksch
> Geoinformatiker
>
> meggsimum - Büro für Geoinformatik
> Christian Mayer
> Schillerstr. 2a | 67112 Mutterstadt
> info at meggsimum.de | www.meggsimum.de
> T 06231 - 6298988 |
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/openlayers-users
--
Marc Jansen
— Geschäftsführer —
terrestris GmbH & Co. KG
Kölnstraße 99
53111 Bonn
Tel: +49 (0)228 / 96 28 99 -53
Fax: +49 (0)228 / 96 28 99 -57
Email: jansen at terrestris.de
Web: https://www.terrestris.de
Amtsgericht Bonn, HRA 6835
Komplementärin: terrestris Verwaltungsgesellschaft mbH
vertreten durch: Torsten Brassat, Marc Jansen
Informationen über Ihre gespeicherten Daten finden Sie auf unserer Homepage unter folgendem Link: https://www.terrestris.de/datenschutzerklaerung/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20220527/9491800d/attachment-0001.htm>
More information about the Users
mailing list