-
Notifications
You must be signed in to change notification settings - Fork 32
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
Support for loading cloud optimized geotiff (COG) onto google maps without leaflet #92
Comments
Hi, @abdul-imran . I would review the code on the refactor-2023-winter branch https://github.com/GeoTIFF/georaster-layer-for-leaflet/pull/138/files. Yes, it's definitely possible, but will require porting georaster-layer-for-leaflet to georaster-layer-for-google-maps (ie writing a bunch of code). Unfortunately, I don't have the time or resources to do this. Fun fact, because you converted your data to WGS 84 you won't have to reproject/warp/rotate your data. All you have to do is pull the values for the tile area and display the as an img tag. This library may also be of interest as it helps pull data from georasters: https://github.com/geotiff/georaster-stack |
If you want to optimize things even further, I would look at converting your geotiffs to web mercator and converting to Cloud optimize geotiffs where each internal tile aligns with a map web tile. |
Hi @DanielJDufour |
Hey @DanielJDufour - I looked the georaster-stack & found something very useful for me, the toCanvas method. But the issue I've got is, I still can't render the layer onto Google Maps. Please note, I've already successfully implemented this using Leaflet, Google Mutant & COG's. I've attached the working leaflet code & the google-maps code. In the leaflet example, I've commented out different COG URL's with compressions like Deflate, LZW, Jpeg & WebP. |
This will get you part of the way there:
|
Hey @ashley-mort - Thanks a lot for this. This is a lot of improvement to what I had. |
Hi @ashley-mort - I tried using the parseGeoraster method which takes in the cog as an input. but there are other issues now. Error loading GeoTIFF: TypeError: Failed to execute 'putImageData' on 'CanvasRenderingContext2D': parameter 1 is not of type 'ImageData'.
|
It's probably because your georaster.values is null. I would build georaster yourself so you can debug through it without dealing with the minified code from unpkg. For example, see https://github.com/GeoTIFF/georaster-to-canvas/blob/master/index.js Personally, I would try to use something like OpenLayers to do what you're trying to do. That integrates Google Maps and has COG support (via geotiff.js). I think you're going to find fully implementing what you want with georaster may not be as simple as you'd hope. I don't have any direct experience with georaster, only geotiff.js & OpenLayers. |
Thank you @ashley-mort . |
Hey @ashley-mort I saw you mentioned about geotiff.js. I've been trying to do the same using this library. Anything you can do to help here?
|
I would take a look at the cog-explorer project as it's doing basically what you are trying to do. See if you can run it and debug through this file (mapview.jsx) specifically. That will show you all the things you need to consider and handle. https://github.com/geotiffjs/cog-explorer/blob/master/src/components/mapview.jsx |
I am trying to load a COG using Google Maps JavaScript API. I have tried this using georaster-layer-for-leaflet but due to google terms & conditions, I'd like to achieve this using Google Maps JavaScript API.
I have generated COG using GDal & can see CRS=WGS 84, Layout=COG & Compression=LZW.
Is it possible to achieve this functionality? Can you please help?
The text was updated successfully, but these errors were encountered: