I have been fighting with shapefiles for a little over a week now and I am guessing that I am missing a very crucial feature. When I add a shapefile, I can draw it by manually adjusting the fillcolor, pointsize, filltransparency, etc… but what about retrieving that information from the shapefile itself? If i Make a shapefile in ArcGIS or qGIS, and I set those attributes before I save it, shouldn’t MapWinGIS be able to retrieve that data without having to set it?
I just need somebody to point me in the right direction here. I am coding in VB.net.
I also want to add that I have seen many posts on this forum that dont quite ask this quesiton. this post "
Where can I get shapefile data " got me to the two examples listed within, but the point options are set within the code, not retrieved from the shapefile.
So two questions. Can we retrieve point/polygon drawing options FROM the shapefile? or must we set them AFTER the shapefile is loaded?
The “symbology” information (how a shapefile is drawn) is not stored in the shapefile.
In the case of ArcGIS (ArcMap) it is stored in the map document (.mxd).
A shapefile only contains the data for the layer like: Geometry and Attributes att a minimum.
And a shapefile is not a single file but a collection of files where only the file extension differ.
Here you can read all about how and what is stored in ha shapefile
Thank you so much for your reply. So it sounds like the best thing I can do is allow the user to import the Shapefile, and then manually adjust the layer settings. That’s cumbersome but workable. I already have a basic UI that lets the user adjust basic layer characteristics while the application is running, it just seems slow and repetitive unless I come up with a way to save a layer settings memory file of some sort.
The ESRI document you pointed me to was extremely interesting. Thanks for that as well.
I have some C# simple code:
Shpfile = open.FileName;
bool openResult = sf.Open(Shpfile, null);
float temp = sf.DefaultDrawingOptions.LineWidth;
uint lincolor = sf.DefaultDrawingOptions.LineColor;
other attributes are similar.
I hope it is useful.