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

Json data is not displayed

Thread ID:

Created:

Updated:

Platform:

Replies:

142986 Feb 27,2019 04:05 PM UTC Aug 26,2019 12:11 PM UTC Xamarin.Forms 5
loading
Tags: SfMaps
Eugen Dolgi
Asked On February 27, 2019 04:05 PM UTC

            ShapeFileLayer layer = new ShapeFileLayer();
            layer.ShapeSettings = new ShapeSetting() { ShapeFill = Color.Coral, ShapeStroke = Color.Black, ShapeStrokeThickness = 1 };
            Assembly assembly = typeof(MapDeskPageViewModel).GetTypeInfo().Assembly;
            Stream shpStream = assembly.GetManifestResourceStream($"IT2media.XamarinForms.TestApp.MapsShapeFiles.world-map.shp");
            layer.ReadAsStream(shpStream);
            Layers.Add(layer);

=> Ok

            ShapeFileLayer layer = new ShapeFileLayer();
            layer.ShapeSettings = new ShapeSetting() { ShapeFill = Color.Coral, ShapeStroke = Color.Black, ShapeStrokeThickness = 1 };
            Assembly assembly = typeof(MapDeskPageViewModel).GetTypeInfo().Assembly;
            Stream jsonStream = assembly.GetManifestResourceStream($"IT2media.XamarinForms.TestApp.MapsShapeFiles.world-countries.json");
            layer.ReadAsJsonStream(jsonStream);
            Layers.Add(layer);

=> not displayed. no errors and jsonStream is not empty.

Attachment: worldcountries_750b5795.rar

Bharathiraja K [Syncfusion]
Replied On February 28, 2019 12:53 PM UTC

Hi Dolgi, 
 
Greetings from Syncfusion. We are able to reproduce the issue. Currently, we are validating the issue and we will update the status on 4th March,2019. 
 
You can try the other option by converting the json file in to shape file and load the shape files using the ReadAsStream method. 
 
Please refer the following link to convert json files to shape files. 
 
Regards, 
Bharathi 


Scott
Replied On August 22, 2019 05:58 PM UTC

Any update on this? I'm taking a string of GeoJson that I validated at GeoJsonLint.com and trying to add it to a SFMap with this:

string sGeoJson = BuildGeoJson(lPoints);
ShapeFileLayer shapeFileLayer = new ShapeFileLayer();
MemoryStream memoryStream = new MemoryStream();
StreamWriter streamWriter = new StreamWriter(memoryStream);
streamWriter.Write(sGeoJson);
streamWriter.Flush();
memoryStream.Position = 0;
shapeFileLayer.ReadAsJsonStream(memoryStream);
TheMap.Layers.Add(shapeFileLayer);

And I can see no effect. I'm building the GeoJson at runtime, so it's not like I can pre-convert GeoJson to a shapefile. 

A secondary question is if, the GeoJson can be loaded and displayed, is styling like either one of these supported?

      "style": {
        "stroke": "#ff0000",
        "stroke-width": "3",
        "stroke-opacity": 1,
        "marker-size": "medium",
        "marker-symbol": 0,
        "marker-color": "#ff0000"
      },
      "properties": {
        "prop0": "value0",
        "prop1": 0,
        "stroke": "#ff0000",
        "stroke-width": "3",
        "stroke-opacity": 1,
        "marker-size": "medium",
        "marker-symbol": 0,
        "marker-color": "#ff0000"
      }



Rachel A [Syncfusion]
Replied On August 23, 2019 12:11 PM UTC

Hi Scott, 
 
Query 1: Binding json data at run time 
 
As of now we are having this support only for Android platform. Also, we have considered this support as feature enhancement internally for other platforms (iOS, UWP) and will be available in any of the upcoming release. 
 
Query 2: Setting style for maps in json file 
 
You can set the customization properties directly in Maps as there is no support for setting the properties in json file. To know more on markers customization, refer the documentation link below. 
 
 
Thanks, 
Rachel. 


Scott
Replied On August 23, 2019 01:13 PM UTC

Regarding Query 1: Only Android won't help us very much. And I'm mainly developing / testing on Android right now. And even Android it isn't working for me. 

I guess the question is, when is the upcoming release that will work in Android and also in iOS / UWP? I realize release dates are glorious opportunity to make yourself into a liar, but if you could give me a general ballpark that would be helpful to us to assess what / where we go now.

Re: Query 2:

I was trying to set ShapeSetting for the layer:

            ShapeSetting shapeSetting = new ShapeSetting();
            shapeSetting.ShapeStroke = Color.Red;
            shapeSetting.ShapeStrokeThickness = 2;
            shapeFileLayer.ShapeSettings = shapeSetting;

But that wasn't working either (per Query 1). It would be more flexible to include the styles in the GeoJson so you could have red points and green lines or whatnot. But I understand you're not supporting that. 


Rachel A [Syncfusion]
Replied On August 26, 2019 12:11 PM UTC

Hi Scott, 
 
Query 1: Regarding timeline for json runtime support in iOS and UWP 
 
We have considered this feature for Volume 4 main release which is scheduled to be released on mid of December 2019. 
 
Also, we have checked by binding the json data, it is working fine in Android. Please find the sample attached below. 
 
Query 2: Regarding styles set in shape settings 
 
We have prepared sample to display the shape settings and you can download from the following location. 
 
 
Output: 
 
 
Please let us know if you face any problems. 
 
Thanks, 
Rachel 


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

;