heloo,
i want to use my shape file to load the map.for some shape files i dont have DBF files.for those shape files it throws an error.can we load the shape files without using dbf filles.is it possible.
heloo,
i want to use my shape file to load the map.for some shape files i dont have DBF files.for those shape files it throws an error.can we load the shape files without using dbf filles.is it possible.
Hi Raj,
Well, you’d better generate the dbf files for those shape files, here is the code to generate the dbf file,
GeoDbf.CreateDbfFile(“xxx.dbf”, new DbfColumn[] { new DbfColumn(“Name”, DbfColumnType.String, 10, 0) });
Regards,
Edgar
Hi Edgar,
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Map1.MapUnit = GeographyUnit.DecimalDegree;
ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(Server.MapPath("~/Torrington Maps/majtrans2001.shp"));
worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.Transparent, GeoColor.FromArgb(100, GeoColor.SimpleColors.Green));
worldLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.Capital3("NAME");
worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
Map1.StaticOverlay.Layers.Add(worldLayer);
}
}
so where i need to use this statement for convert in to dbf file.
GeoDbf.CreateDbfFile("xxx.dbf", new DbfColumn[] { new DbfColumn("Name", DbfColumnType.String, 10, 0) });
Hi rajanikanth,
We need to create the DBF for your shapefile before we define the Shapefile in your code. So you would want to setup the creation of your DPF perhaps like this:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Map1.MapUnit = GeographyUnit.DecimalDegree;
//Make the DBF file name the same as your shapefile.
GeoDbf.CreateDbfFile("xxx.dbf", new DbfColumn[] { new DbfColumn("Name", DbfColumnType.String, 10, 0) });
ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(Server.MapPath("~/Torrington Maps/majtrans2001.shp"));
worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.Transparent, GeoColor.FromArgb(100, GeoColor.SimpleColors.Green));
worldLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.Capital3("NAME");
worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
Map1.StaticOverlay.Layers.Add(worldLayer);
}
}
Thank tou Ryan
You’re welcome, if you have any questions please let us know.
Regards,
Edgar