Shapes rendered in center of map

Dec 13, 2009 at 3:09 AM

Below is a link to a shape file that displays all the lakes in Nevada US.

No matter what I do (I'm new to this, but... I feel like I've hacked everything except the one I need) the lakes show up over the top of Africa (center of map)

http://cid-c0f357e4555270e7.skydrive.live.com/self.aspx/Public/Fishing-Lakes.dbf

Can anyone give any tips on how to get this rendered???

Here's my C# code to load up the file & below that some Xaml for display.

Any thoughts?

 

ShapeFile shapeFile = new ShapeFile();
shapeFile.ReadShapes(Resource_Nevada.Fishing_Lakes1.ToStream());

GraphicsLayer graphicsLayer = MyMap.Layers["shapefileGraphicsLayer"] as GraphicsLayer;
foreach (ShapeFileRecord shapeFileRecord in shapeFile.Records)
{
	Graphic graphic = shapeFileRecord.ToGraphic();
	if (graphic != null)
	{
		graphicsLayer.Graphics.Add(graphic);
	}
}

 

 

		<esri:Map x:Name="MyMap" 
                  Extent="" CacheMode="BitmapCache">
			<esri:Map.Layers>
				<esri:ArcGISDynamicMapServiceLayer ID="topo" Url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer"/>
				<esri:GraphicsLayer ID="shapefileGraphicsLayer" >
				</esri:GraphicsLayer>
			</esri:Map.Layers>
        </esri:Map>

 

 

 

Dec 15, 2009 at 9:32 PM

Is the map Projection defined for the shapefile?  If it includes a .prj file then it is.  If it does not and the API is interpreting the coordinates as being the same as the background layer which I assume is from ArcGIS Online.  You need to know what the projection/coordinate system is and then define it with ESRI ArcView software, or hack that too.

HTH

Jan 9, 2010 at 11:32 PM

I have a file that is {file_name}.prj. When I open it, it is plain text file with 6 lines of comma seperated information (GEOCS, projections, units, primem?) stuff like that...

How do I tell the shapefile reader library (or esri) about this metadata?

Dec 17, 2010 at 2:56 PM
Edited Dec 17, 2010 at 3:44 PM
staxmanade wrote:

I have a file that is {file_name}.prj. When I open it, it is plain text file with 6 lines of comma seperated information (GEOCS, projections, units, primem?) stuff like that...

How do I tell the shapefile reader library (or esri) about this metadata?

I am having the same issue...what are we supposed to use in the api that will help read/parse this data in?

 

I've found nowhere in the API that will allow me to move, or adjust the graphic after it's added to the graphic layer. Nor have I found anyway to ensure that it is reading from the prj file that accompanies the shapefile. If all this library can do is just add shapes to the center of the map, well then this library is completely useless.

Apr 25, 2014 at 8:01 AM
staxmanade wrote:
Below is a link to a shape file that displays all the lakes in Nevada US. No matter what I do (I'm new to this, but... I feel like I've hacked everything except the one I need) the lakes show up over the top of Africa (center of map) http://cid-c0f357e4555270e7.skydrive.live.com/self.aspx/Public/Fishing-Lakes.dbf Can anyone give any tips on how to get this rendered??? Here's my C# code to load up the file & below that some Xaml for display. Any thoughts?   ShapeFile shapeFile = new ShapeFile(); shapeFile.ReadShapes(Resource_Nevada.Fishing_Lakes1.ToStream()); GraphicsLayer graphicsLayer = MyMap.Layers["shapefileGraphicsLayer"] as GraphicsLayer; foreach (ShapeFileRecord shapeFileRecord in shapeFile.Records) { Graphic graphic = shapeFileRecord.ToGraphic(); if (graphic != null) { graphicsLayer.Graphics.Add(graphic); } }     <esri:Map x:Name="MyMap" Extent="" CacheMode="BitmapCache"> <esri:Map.Layers> <esri:ArcGISDynamicMapServiceLayer ID="topo" Url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer"/> <esri:GraphicsLayer ID="shapefileGraphicsLayer" > </esri:GraphicsLayer> </esri:Map.Layers> </esri:Map>      
I would strongly suggest you to check the coordinate system that your web application is using. If you are using ArcGIS Online (Webbuilder or Standalone app) most likely it's running on the WebMercator 4326 system (depends on the services that you application consume), you will have to write your own coordinate converter from let's say Decimal Degrees (if this is the format that is defined in the shape file that you are trying to load) to WebMercator .