As an absolute beginner with GIS in general, I am already stuck just trying to display a satellite photo. We would like to be able to import a GeoTiff or something similar and then draw the boundaries of the farm fields on top.
I have attached the header information from the GeoTiff I am using, and am hoping someone can give me a code snippet to display it as a layer in a winforms/vb map control in the latest version of desktop.
Lee, Thanks for your post and welcome you to ThinkGeo Desktop Discussion forum.
Try the following code snippet from our HowDoI sample showing a standard tiff file, hope it helps.
Private Sub LoadAGeoTiffImage_Load(ByVal sender As Object, ByVal e As EventArgs) winformsMap1.MapUnit = GeographyUnit.DecimalDegree winformsMap1.BackgroundOverlay.BackgroundBrush = New GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean)
Dim worldImageLayer As New GeoTiffRasterLayer("..\..\SampleData\Data\world.tif") worldImageLayer.UpperThreshold = Double.MaxValue worldImageLayer.LowerThreshold = 0
Dim staticOverlay As New LayerOverlay() staticOverlay.Layers.Add("WorldImageLayer", worldImageLayer) winformsMap1.Overlays.Add(staticOverlay)
winformsMap1.CurrentExtent = New RectangleShape(-118.098, 84.3, 118.098, -84.3) winformsMap1.Refresh() End Sub
I’ve tried all the examples I could find but I can’t get them to work with my geoTiff. The usual free GIS viewers open it no problem, but I’m not sure how to deal with the meters, etc. I extracted the header to the attached file in the first post.
Try to change the MapUnit and boundingBox for the map control shown as following:
Private Sub DisplayMap_Load(ByVal sender As Object, ByVal e As EventArgs) winformsMap1.MapUnit = GeographyUnit.Meter winformsMap1.BackgroundOverlay.BackgroundBrush = New GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean)
Dim worldImageLayer As New GeoTiffRasterLayer("..\..\SampleData\Data\world.tif") worldImageLayer.UpperThreshold = Double.MaxValue worldImageLayer.LowerThreshold = 0
Dim staticOverlay As New LayerOverlay() staticOverlay.Layers.Add("WorldImageLayer", worldImageLayer) winformsMap1.Overlays.Add(staticOverlay)
If you still have problem, it would be nice if you could send us your data, you can wrap it and send it to forumsupport@thinkgeo.com and asked for forword to Yale with this post mentioned.
Any more questions please feel free to let me know.