wfletcher / EasyGIS.NET

EasyGIS.NET source
GNU Lesser General Public License v3.0
68 stars 24 forks source link

geotiff suport #128

Open wadantasjr opened 3 months ago

wadantasjr commented 3 months ago

how can i draw geotif images in a map? Any plan to this feature in future?

dusko23 commented 2 months ago

EasyGisDotNet library enables to draw a bitmap on SFmap object before vector data is rendered. There is an example how to draw OpenStreetMap tiles and overly them with SHP objects. In order to draw geo-tiff images you need to create your own tiling logic which creates a bitmap and draw it on SFmap object. To start with, I suggest to take one geotiff map and extract TFW data. Every time SFmap object extends change you need to check if it covers any part of your raster map. If it does, calculate the extent to be covered, crop your raster map to that extend, calculate magnify factor by comparing comparing SFmap pixel size (1/SFmap.zoom) and your raster map pixels size (taken from TFW data), resize your cropped bitmap to that factor and draw your cropped/resized bitmap to SFmap area to hold your raster data. This works fine if you have limited number of raster maps. If you have loads of them to cover a big area then you should consider building you own structure to serve pre-zoomed tiles. It can be in the form of files of tiles like OpenStreetMap or as database to pull raster tiles from, SQLite fits the purpose perfectly. Please note that your raster maps must have the same EPSG as SFmap.