We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

OSM SfMaps Shape Layer Uri throws Java.Lang.FileNotFoundException for the .dbf file

Hey guys, we are having trouble making the shape layer work. We just want the maps to display a clean view with only roads and blocks rather than the default one with the detailed labels in it. We tried our best to understand the syncfusion documentation with no luck. Here are some of the things we've tried.
- .dbf is an embedded resource, Uri is "Images/roadtrl020.dbf"
- .dbf is an embedded resource, Uri is "App.NameSpace.Images.roadtrl020.dbf"
- .dbf is an embedded resource, Uri is "resource://App.NameSpace.Images.roadtrl020.dbf"
- transfer the embedded .dbf file to PersonalFolder and link to it with "/path/to/roadtrl020.dbf"
- transfer the embedded .dbf file to PersonalFolder and link to it with "file:///path/to/roadtrl020.dbf"

The documentation doesn't exactly tell us what the Uri expects so we wouldn't know what to give it. All we get is this.

1 Reply

MP Michael Prabhu M Syncfusion Team December 31, 2018 06:47 AM UTC

Hi Virgil, 
 
Greetings from Syncfusion. 
 
Query: How to use the shape file layer in maps. 
 
You can use the SfMaps control to display the required country boundaries, rail roads or etc. This can be achieved by adding the required shape files in the project and accessing it via Uri property in the shape file layer. 
 
You need to mention the shape file (.shp) name in the Uri property. Dbf file corresponding to that shape file is mainly used for additional features such as displaying bubbles, color mapping etc. Hence you must specify the shape file name in the Uri property as in the below code snippet. 
 
  <maps:SfMaps.Layers > 
                    <maps:ShapeFileLayer Uri="usa_state.shp" > 
 
                    </maps:ShapeFileLayer> 
                </maps:SfMaps.Layers> 
 
Please refer the below documentation link for how to specify the Uri property and how to add and access the shape files in the project. 
 
 
We have also prepared a simple sample to show the US map. You can refer this sample and add the shape file which is required for you instead of US map. 
 
You can download the sample from the below link. 
 
 
Output Image: 
 
 
 
 
Note: Please refer and follow the mentioned UG link for adding shape files in the project. 
 
Please contact us if you need further assistance on this. Also, if your scenario is different from the above please provide additional information on this. This would help us to guide you accordingly with the better solution at the earliest. 
 
Regards, 
Michael 


Loader.
Live Chat Icon For mobile
Up arrow icon