This project has moved and is read-only. For the latest updates, please go here.

for raster file, sharpmap seems to be useless

Topics: General Topics, SharpMap Project
May 10, 2009 at 7:35 PM

We started a project about analyzing the vector and raster files. For vector ones, sharpmap support is good enough. But when it comes to raster file, nobody wants to talk, not in chat room, not in forums, nowhere. We just want to get elevation data somehow. It doesnt matter how we get it. Does not anybody know about it? ECW and Tiff files can be rendered in sharpmap but without analyzing them sharpmap seems useless. I didnt want to criticize sharpmap in that way but i dont think sharpmap is designed just for showing raster files. If sharpmap have that capability (elevation analysis), tell us how, if not then it is in a big trouble.

May 11, 2009 at 10:48 AM
Edited May 11, 2009 at 11:16 AM

Hi padrino, while it is possible that somebody using sharpmap may be able to help you, you may have more luck over at hth jd

May 11, 2009 at 9:34 PM

thanks for reply johndiss. I hope you can give some answers about SharpMap, you are one of the developers here ;) gdal supports a broad file group. I need just support for dted or dem ones because I want to analyze a path in means of elevation and distance. Can sharpmap give it to me? I tried the code in sharpmap svn and for vector ones I could query the borders, rivers or anything included in the file. But I want to do similar things with raster ones. I want to get the elevation of the point clicked by mouse. Dted and dem has these data in it but I dont know how to get them. I mean which methods or properties should I use to. I ll be very happy if i get any answer.

I read some about gdal and i know it is amazing. I just need the methods of sharpmap for gdal capabilities.

May 12, 2009 at 10:36 AM

Hi padrino, unfortunately I do not use any of the gdal functionality with sharpmap, but I imagine that only the minumum required to render raster data has been implemented. I suspect you will need to create an interop to the functionality in gdal you require. If you come up with something that works for you feel frre to contribute it back to sharpmap and I will get it into the source tree. cheers jd

May 13, 2009 at 5:25 PM


A patch I submitted a while ago has some support for elevation data.  This patch is a stand alone complete version of sharpmap.  It can be found here.

The demo project has an example of the elevation display.  More work has been done with elevation rasters since that patch, so if there is something else you need, let me know I will send you a newer version.


May 14, 2009 at 6:01 AM

thank you much dan, I looked at the code and developed it a bit further. You use dem file, and i tried to use tiff files. I get some height from points, double types, but i dont know it is correct. I mean for a file I used I get 187.0 but in fact at that point the elevation must be about 4500 meters. How can i get the scale of the map? Is that supplied in metadata of the file or in the image file? Also in metadata.xml file I saw some abbreviations about the image data like southbl, westbl etc. I couldnt find any reference to look at. Do you know what are them or any reference for that?

I created a bounding box for keeping elevation data of the interior points' in an array. But when zoomed in/out and panned the map, I'm in a very big trouble. You used imagetoground function and then again for bitmap issues you used worldtoimage. Also i couldnt find any info for imagetoground method. I know I asked too much but Im interested in developing some raster functionalities in sharpmap.

As a summary I dont want to lose coordinate concurrency along the way when I'm panning the map or zooming in/out, because I work on elevation analysis of selected points over the raster layer.

If you are interested in that issue i can send you the code. It is not satisfying yet but I believe it will ;)

thanks again...

May 14, 2009 at 4:11 PM


If the tiff you are using is a GeoTiff, the spatial information should be in the tags.  If it's not a GeoTiff you need a world file (.tfw) for it to be spatially accurate.  Do a Google search on 'world file' to find more information.  I don't know anything about metadata.xml.

ImageToGround takes the currently displayed map pixel location and converts it to ground location (so if you pan around the ground location for pixel 0, 0 will change).

GroundToImage takes a ground location and coverts it to current map display pixel location.



Jun 12, 2009 at 3:32 PM

thanks dan i get it now. the project working as we wish. I think in a short time we will attribute some functionalities to sharpmap world.