http://hawaii.wr.usgs.gov/hawaii/data.html
So I am using a shapefile of the island of Hawaii and I have a few points that I want to set on the map. There are a few things about this that are really confusing to me. First, the website states that the map uses the "NAD83, UTM, zone 5" coordinate system. However when I import it into ArcGIS software it says that theres no boundary information or set coordinate system or something. Also, importing any other shapefile they are REALLY small compared to the Hawaii map.
So right now I have the MapProjectionType on my xamMap set to Equirectangular, which is centering the map within my frame.
My question is that I have some points in Hawaii that I would like to map. The problem is that when I use ProjectToMap with what I'm pretty sure are the correct coordinates of some point in Hawaii, the values that it returns are nowhere near as huge as the WorldRect of the Hawaii map is. The WorldRect is upwards of 11 digits long (which is why I think the map looks huge compared to other maps) and the returned coordinates from the ProjectToMap is 7 digits long. I'm wondering what would be the best approach to alliviate this problem. I could just multiply everything by 10,000 but I feel like there is a better way to deal with this. The thing I worry about is that its not really gonna be projected into the correct area if I just multiply it.
Is there a more elegant solution to a problem of this type?
Thanks
Matt
Hi Matt,
The shapefiles use the Transverse Mercator projection and the NAD 83 map datum. Try the following XAML code:
<Maps:XamMap x:Name="xamMap" > <Maps:MapNavigationPane igControls:XamDock.Edge="InsideRight" /> <Maps:XamMap.Layers> <Maps:MapLayer> <Maps:MapLayer.Reader> <Maps:ShapeFileReader Uri="Shapefiles/Hawaii/district"> <Maps:ShapeFileReader.CoordinateSystem> <Maps:CoordinateSystem FalseEasting="500000.0" FalseNorthing="0.0" > <Maps:CoordinateSystem.Projection> <Maps:TransverseMercator EllipsoidType="NAD83" CentralMeridian="-153.0" ScaleFactor="0.9996" LatitudeOrigin="0.0" /> </Maps:CoordinateSystem.Projection> </Maps:CoordinateSystem> </Maps:ShapeFileReader.CoordinateSystem> </Maps:ShapeFileReader> </Maps:MapLayer.Reader> </Maps:MapLayer> </Maps:XamMap.Layers></Maps:XamMap>
With the above settings you should be able to project correctly the points.
Information about shapefile's coordinate system and map projection is stored in the *.prj file. You can open it with notepad. Here is the output of Hawaii's district's one:
PROJCS["NAD_1983_UTM_Zone_5N",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-153.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]
You can read more about map's coordinate system and projection from this article: http://help.infragistics.com/Doc/WPFDV/2010.3/CLR4.0/?page=xamWebMap_Change_Map_Coordinate_System.html
Regards,
Ivan Kotev
I was wondering if you could answer one more question for me.
I looked at the .prj file for the shapefile and I think I set it up correctly. The thing that confuses me is that the coordinates that I have for a point in Hawaii still does not show up. The coordinates I have are Lat = 19.7229 and Long = -156.004. When I put these into Google Maps it gives me a point that is on the West coast of Hawai'i island. Looking at the Wikipedia page it looks like Google Maps uses a variation on the Mercator projection type where I am using Transverse Mercator now.
My code so far is...
<igMaps:XamMap x:Name="hawaiiMap" IsClickable="False" WindowAnimationMode="None" IsHitTestVisible="False" ViewportBackground="Black" Height="500" Width="500" > <igMaps:XamMap.Layers> <!-- Shapefile (Map) Layer --> <igMaps:MapLayer x:Name="hawaiiLayer" IsSelectable="False" Fill="White" FillMode="None" ShadowFill="Transparent" Imported="hawaiiLayer_Imported"> <igMaps:MapLayer.Reader> <igMaps:ShapeFileReader Uri="/../ClientBin/Shapefiles/state_county" > <igMaps:ShapeFileReader.CoordinateSystem> <igMaps:CoordinateSystem FalseEasting="500000.0" FalseNorthing="0.0" > <igMaps:CoordinateSystem.Projection> <igMaps:TransverseMercator EllipsoidType="NAD83" CentralMeridian="-153.0" ScaleFactor="0.9996" LatitudeOrigin="0.0" Zone="utm5Q" /> </igMaps:CoordinateSystem.Projection> </igMaps:CoordinateSystem> </igMaps:ShapeFileReader.CoordinateSystem> </igMaps:ShapeFileReader> </igMaps:MapLayer.Reader> </igMaps:MapLayer> <!-- Symbols Layer --> <igMaps:MapLayer x:Name="symbols" IsClickable="False" IsVisible="True" Loaded="symbols_Loaded"> <igMaps:MapLayer.ValueTemplate> <DataTemplate> <Ellipse x:Name="mapElement" Fill="Red" Height="10" Width="10" /> </DataTemplate> </igMaps:MapLayer.ValueTemplate> </igMaps:MapLayer> </igMaps:XamMap.Layers></igMaps:XamMap>
private void symbols_Loaded(object sender, RoutedEventArgs e){ Point p = hawaiiMap.MapProjection.ProjectToMap(new Point(19.7229, -156.004)); this.hawaiiMap.Layers[2].Elements.Add(new SymbolElement() { SymbolOrigin = p, SymbolType = MapSymbolType.None }); this.hawaiiMap.Layers[2].DataBind();}private void hawaiiLayer_Imported(object sender, MapLayerImportEventArgs e){ if (e.Action == MapLayerImportAction.End) { hawaiiMap.Layers[2].WorldRect = hawaiiMap.Layers[0].WorldRect; this.hawaiiMap.Layers[2].DataBind(); }}
Awesome thanks!