This is a migrated thread and some comments may be shown as answers.

Is there any way to load shapefiles from database?

9 Answers 196 Views
Map
This is a migrated thread and some comments may be shown as answers.
Thomas
Top achievements
Rank 1
Thomas asked on 10 Jun 2011, 01:42 PM
Hi Team,

My shapefiles is user-defined and store in database,but the ShapeFileReader load shapefiles from resource.The shapefiles must be embed in the project assembly.

I want to find a way to load shapefiles from database.

Could you help me?

btw
I have retreived  shapefiles from my database to my silverlight application in chunks of binary.

Now I am able to combine all the binary chunks into a byte array to get the actual size of the shapefiles stored in my Database.

Can anyone tell how to bind these bytes directly into a RadMap?


9 Answers, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 15 Jun 2011, 07:47 AM
Hi Thomas,

If you have the shape file as a byte array, then I would recommend to use the ShapeFileReader.Read method which allows to read a shape file from a stream.
The sample code is below.
private void ReadShapes(byte[] bytes)
{
    using (MemoryStream stream = new MemoryStream(bytes))
    {
        List<FrameworkElement> list = ShapeFileReader.Read(stream);
        foreach (FrameworkElement item in list)
        {
            this.informationLayer.Items.Add(item);
        }
    }
}

Kind regards,
Andrey Murzov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Thomas
Top achievements
Rank 1
answered on 29 Jun 2011, 07:25 AM
It's work,Thank a lot.
0
Rasid
Top achievements
Rank 1
answered on 08 Apr 2012, 07:11 AM
can i have some project sample for me to understand the whole concept? I'm still can't get the idea how to load from database. I've the project with load the .shp file directly from the folder and it's fine if it running locally, but whenever i'm publish at the server, the shapefile never loaded. So, i'm thinking just using this method i.e. load from database which it will be flexible as user may update the source data in database.
0
Andrey
Telerik team
answered on 12 Apr 2012, 09:58 AM
Hello Rasid,

I think it is not too good idea to have shape-file "as is" in the database. When you use a folder of Web server for shape files then most often this problem occurs in published projects when MIME types for shp and dbf files are not defined on the web server.
Please check that MIME types for using shape files are defined:
Extensions: .shp and .dbf
MIME type: application/octet-stream

Also you can check if an error occurs during loading of shape files. You can use the PreviewReadCompleted or ReadCompleted event to check the eventArgs.Error property. It returns the exception when the error occurs.

Greetings,
Andrey Murzov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Josh
Top achievements
Rank 1
answered on 17 Jan 2013, 03:06 PM
How did you store the shapefiles in the database?  Just .shp or did you store .shp, .shx and .dbf?
0
Thomas
Top achievements
Rank 1
answered on 18 Jan 2013, 05:31 AM
All of .shp, .shx and .dbf,and handle load order .

0
Andrey
Telerik team
answered on 18 Jan 2013, 12:17 PM
Hello,

RadMap don't use .shx files and it have no interface to load them. The .dbf file is optional. If you need to accompany map shapes with additional information then you can use .dbf file.

Regards,
Andrey Murzov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Jon_BCV
Top achievements
Rank 1
answered on 25 Apr 2013, 05:02 PM
How do you load the dbf file too?  Along with the shape file?
0
Andrey
Telerik team
answered on 26 Apr 2013, 03:33 PM
Hello Jon,

Please, take a look into the following topic in our online documentation:

http://www.telerik.com/help/silverlight/radmap-features-shapefiles-support.html

It describes how the DBF file can be loaded along with the SHP file.

Kind regards,
Andrey Murzov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
Map
Asked by
Thomas
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Thomas
Top achievements
Rank 1
Rasid
Top achievements
Rank 1
Josh
Top achievements
Rank 1
Jon_BCV
Top achievements
Rank 1
Share this question
or