We are currently using the sample shapefile provided as part of the Silverlight DataVisualization samples package (usa_st.shp and usa_st.dbf) and it is pretty close to our needs. We would however like to have Alaska, Hawaii, Puerto Rico at their correct coordinates and size (Alaska on the sample shapefile is very small). I have looked at the other shapefile sources you listed in your documentation, but any shapefiles provided by these sources are much bigger (filesize) than your sample shapefile. Can you provide a copy of the shapefile with these states in their original location (not in the Gulf of Mexico) or how would I edit the shapefile and get these states back to their original position?
Hi MintyPip,
I cannot give a precise formula, because those shapefiles were created with shapefiles editor, but an approximate one can be found by computing the offset of a known point in Alaska in the World shapefiles and its position in the USA shapefiles. A have taken from the World shapefiles what seems to me the Alaska's center: Latitude = 65.738960560638, Longitude = -153.557349914081 and in the USA shapefiles its position is: Latitude: 26,2286951558063, Longitude=-112,622362091846
To export those coordinates I have used the following code:
1. Register for XamMap's MapMouseLeftButtonDown
2. Code behind:
private void xamMap_MapMouseLeftButtonDown(object sender, MapMouseButtonEventArgs e){ Point mapPosition = xamMap.Viewport.RootCanvas.RenderTransform.Inverse.Transform(e.Position); Point geoPosition = xamMap.MapProjection.UnprojectFromMap(mapPosition);
Debug.WriteLine(geoPosition);}
Another solution would be to export World's and USA's relevant data into a XML file and later load the XML, i.e. export only Alaska, Hawaii and Puerto Rico from the World shapefiles and export all states, except those 3, from the USA shapefiles. Please take a look at this post about how to export and import xml files: https://es.infragistics.com/community/forums/f/retired-products-and-controls/56049/how-to-create-a-xml-map/287473#287473
Regards,
Ivan Kotev
Thanks for your response Ivan. Can you at least tell me what formula you used to move those states to their position in the sample shape file as I would like to apply that formula to points I will map within those states. Currently I have no way of knowing how to correctly modify the lat/long so that they are positioned correctly.
Thanks,MintyPip
Hi mintypip,
Unfortunately we cannot provide such shapefiles. Please take a look at this page about creating and editing custom shapefiles: http://help.infragistics.com/Doc/DV/2010.3/CLR4.0/?page=xamWebMap_Creating_and_Editing_Custom_Shapefiles.html