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

i cant open a shape file

Topics: Data Access
Aug 22, 2007 at 4:42 PM
when i try to open a shapefile, i can see nothing but the background color, anybody can explain why ?
note it's a small city map , while the sample map can be opened
Aug 22, 2007 at 7:01 PM
Make sure you are zooming to extents and refreshing the mapImage.
Aug 23, 2007 at 2:36 PM
i've done it , but still nothing happen, it just produce the color of background.
the map projection in Mercator , is it matter ? or should i do the transform ?
really thanks for ur concern
Aug 25, 2007 at 8:55 AM
thanks, i can fix it, its the matter of center point, thanks alot
Aug 25, 2007 at 4:38 PM
Hi Joane,

That is strange that you'd need to move the center point, since zooming to extents does just that. Since the extents are a box which encompass all of the geometries, the center of the box would be in the center of the view. Are your geometries very skewed to one side?
Aug 26, 2007 at 5:37 AM
I'm sorry i do not mention it clearly , i mean in my script i still try to set the center of the map into the point (0,0), there comes my problem. i should skip it , right ? - as u said that zooming to extents does just that .

Aug 26, 2007 at 5:49 AM
Right, you probably never want to set (0, 0) as your center. The reason is that most projections (what makes the curved earth flat) start at some very positive numbers, like (500,000, 4,000,000) in order to avoid negative numbers. These numbers are called the "false easting" and "false northing". Apparently cartographers detested negative numbers on their maps (probably for good reason), and since they were designing the coordinates of their maps, they just went ahead and made the origin some coordinate where it would be difficult to achieve negative numbers. It essentially translates the coordinate frame of reference down and to the left. It's a perfectly valid thing to do, mathematically, since all other points on your map will be relative, and give correct distances when measured. If you are using either feet or meters (the most likely units in mapping), you can see where (0, 0) would be very far indeed from anywhere on your map.
Aug 28, 2007 at 9:52 PM
Hi, would anyone point me to some resource for a newbee ?
I have downloaded Version=; compiled and ran the demo win form fine.
Currently trying to open and display a shapefile by following your example but got this error:

"Could not load file or assembly 'SharpMap.CoordinateSystems, Version=, Culture=neutral, PublicKeyToken=a1f5bdcd9c6f5740' or one of its dependencies. The system cannot find the file specified.":"SharpMap.CoordinateSystems, Version=, Culture=neutral, PublicKeyToken=a1f5bdcd9c6f5740"} System.Exception {System.IO.FileNotFoundException}

The call I am using is as follows:

layer = layerFactory.Create(Path.GetFileNameWithoutExtension(sFileName), sFileName);
Aug 28, 2007 at 10:54 PM
Hi CT -

You need to have the assembly SharpMap.CoordinateSystems.dll which is located in the ExternalReferences folder of the trunk of the source tree in the same directory as your WinForms app.
Aug 29, 2007 at 2:17 PM
Thank you. Works great