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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Load shapefile from local storage

Thread ID:

Created:

Updated:

Platform:

Replies:

142388 Jan 31,2019 07:41 AM UTC Feb 1,2019 09:51 AM UTC Xamarin.Forms 1
loading
Tags: SfMaps
Christian Rendl
Asked On January 31, 2019 07:41 AM UTC

Hello,

Is it possible to load shapefiles from local storage in Xamarin Forms sfMaps? I tried both a local path "/data/..." as well as a file Uri "file:///data/..." on Android, however both was not working and gave me a "Java IO Path not found" exception. Any thoughts?

Many thanks,

Christian

Bharathiraja K [Syncfusion]
Replied On February 1, 2019 09:51 AM UTC

Hi Christian, 
 
Greetings from Syncfusion! 
 
We have the support to load the shape file as stream. Hence, you can achieve your requirement by converting the accessed shape file (from your device location) to stream and load to maps using ReadAsStream() method. 
 
Please refer the below code snippet for loading shape files as stream. 
  
// Load Shape file only 
ShapeLayer.ReadAsStream(stream);  
 
 
// Load Shape file and dbf file 
ShapeLayer.ReadAsStream(shstream, dbstream); 
  
 
We have prepared the sample to load the shape file from the application. Please find the sample from the following location. 
 
 
Note: We need to convert the loaded shape file into stream and then load stream into maps. 
 
Thanks, 
Bharathiraja. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;