I'm currently using the xamMap to display a floor plan of a building. Each desk will need to be given a unique reference in the AutoCAD drawing, which should be exported to a ShapeFile via Cad2Shape. Essentially the desk references will be mapped against users in a SharePoint directory, and their details displayed when their desk is clicked on, etc.
However - I don't know how to create the polygons in AutoCAD with a desk reference that will be exported out to the ShapeFile? Currently when I export the drawing to shapefiles, it seems each polygon is given an ID, which I can use - but my client wants to use specific desk references. Any ideas how I can create these in AutoCAD to be exported to the shapefiles?
...or am I going about this the wrong way??
Hi Davros85,
I am not sure how this can be achieved in AutoCAD, I believe you can create custom properties for your shapes. Another option will be to edit the shapefiles and add the desk reference for each object. Please taka e look at this page about creating and editing custom shapefiles: http://help.infragistics.com/NetAdvantage/DV/2011.1/CLR4.0/?page=xamWebMap_Creating_and_Editing_Custom_Shapefiles.html
HTH,
Ivan Kotev
Ok, that's cool thanks - i've got a copy of MapWindow GIS now, so I can test my shapefiles and hopefully add my custom attribute there.
One other thing - I've mocked up a test in AutoCAD, and used Cad2Shape to export the polygons from a specific layer to a shapefile. It all seems to work ok, and exports 27 objects - and I can open the file in MapWindow GIS and it looks great (27 desks).
However - as soon as I use it with XamMap it renders the screen blank. At the point of MapLayerImportAction.End it tells me that there are 27 elements in the layer - but I can't see anything on the screen??
Here is the sample code i'm using:
XamMap xamMap = new XamMap();
this
.LayoutRoot.Children.Add(xamMap);
MapLayer
layer_pol =
new MapLayer();
layer_pol.Name = "layer_pol";
xamMap.Layers.Add(layer_pol);
ShapeFileReader reader_pol = new ShapeFileReader();
reader_pol.Uri =
"ShapeFiles/BLUESOURCE_pol";
layer_pol.Reader = reader_pol;
Could you try with my shapefile / give me an idea? It works successfully with others I have used in the past...
Cheers.
Sorry - code got all screwed up, it's:
this.LayoutRoot.Children.Add(xamMap);
MapLayer layer_pol = new MapLayer();
reader_pol.Uri = "ShapeFiles/BLUESOURCE_pol";
Ivan you're my hero!
Thanks!
The file is optional, but can help in setting ShapeFileReader's coordinate system and projection information.
Try with the following settings:
<ig:XamMap x:Name="xamMap" > <ig:MapNavigationPane ig:XamDock.Edge="InsideRight" /> <ig:XamMap.Layers> <ig:MapLayer AutoCalculateResolution="False" Resolution="0"> <ig:MapLayer.Reader> <ig:ShapeFileReader Uri="Shapefiles/BLUESOURCE_pol" > <ig:ShapeFileReader.CoordinateSystem> <ig:CoordinateSystem> <ig:CoordinateSystem.Projection> <ig:SphericalMercator EllipsoidType="WGS84" /> </ig:CoordinateSystem.Projection> </ig:CoordinateSystem> </ig:ShapeFileReader.CoordinateSystem> </ig:ShapeFileReader> </ig:MapLayer.Reader> </ig:MapLayer> </ig:XamMap.Layers></ig:XamMap>
With the above setting the results are:
Regards,
Ivan -
Thank you for looking into this. Please find attached another set of shapefiles from the same diagram - as these are loaded into the MapLayer, the WorldRect height / width looks ok - but there's just nothing being displayed on screen still.
Any suggestions appreciated -
Thanks,
David.
No, only the ones I sent you - that's what Cad2Shape outputted. Should it have one?
Hi Davros85
I am looking into it now and I will post back here my findings. I have found that there is some issue with the shapefiles. It seems its WorldRect's Height is 0.0
Does the shapefile has a .prj file ?