Hi Tamil,
We created one simple for you. Please refer FileGeoDatabaseDemo.zip (13.3 KB)
If there is any issue, please let us know that.
Thanks
Mark
Hi Tamil,
We created one simple for you. Please refer FileGeoDatabaseDemo.zip (13.3 KB)
If there is any issue, please let us know that.
Thanks
Mark
Hi Mark,
I am using your Shapes.gdb file it will show no issue.
We are using ArcGIS 10.6 and created GDB file it’s load without exception but show empty screen,
Please do the needful…
Regards,
Tamilarasan.
Hi Tamil,
Please upload a sample file to us, so our developer can look into it.
Regards,
Ethan
Hi Ethan,
I tried with our GDB file its load but refer below screen shot.
1.ThinkGeo Map
Our GDB files is more then 5 MB show not able to upload,
Please do the needful.
Regards,
Tamilarasan.
Hi Tamil,
Does the two screen shots render the same data?
If your data is bigger than 5MB, you can upload that to our FTP (You can get an FTP account from our sales), or you can put that in some netdisk for example GoogleDrive, and so we can directly download it.
The data is necessary so we can look into it because our test GDB data works well.
Regards,
Ethan
Hi Ethan,
Yes , we used same data.
also use below link to get our GDB file.
Regards,
Tamilarasan.
Hi Tamil,
Thanks for your data, it looks our map render the table of “SCHOOL” and the ArcGis render the table of “COUNTY”.
In fact we have the parameter “tableName” and if you want to render many layers you need to add many instance of it.
new FileGeoDatabaseFeatureLayer(gdbname,tableName,id)
Wish that’s helpful.
Regards,
Ethan
Hi Ethan,
I also tried to get all table name from GDB file.
and loop all the tables to added new FileGeoDatbaseFeatureLayer(gdbName,tablename,id)
But still showing previously mention above conversion.
I have doubt , offline map it will show same output screen with styles like ArcGIS map screen?
Or else any tool have to enable all the feature our map like you previously mention screen shot?
Regards,
Tamilarasan.
Hi Tamil,
As below is rendered by GlobalMapper for “School” table.
And as below is our map render the “County” table:
Here is the sample:
9282.zip (11.7 KB)
Regards,
Ethan
Hi Ethan,
I am using map unit for DecimalDegree but your example used Meter.
Please refer below screen shot.
We already done all the functionality with MapUnit.DecimalDegree.
Please do the needful.
Regards,
Tamilarasan.
Hi Tamil,
Your GDB file is under meter, if you want to use it under decimal degree, you just need to reproject it.
private void Form1_Load(object sender, EventArgs e)
{
winformsMap1.MapUnit = GeographyUnit.DecimalDegree;
LayerOverlay layerOverlay = new LayerOverlay();
FileGeoDatabaseFeatureLayer fileGeoDatabaseFeatureLayer = new FileGeoDatabaseFeatureLayer(@"..\..\AppData\MapData.gdb", "COUNTY");
Proj4Projection proj4 = new Proj4Projection();
proj4.InternalProjectionParametersString = fileGeoDatabaseFeatureLayer.GetInternalProj4ProjectionParametersString();
proj4.ExternalProjectionParametersString = Proj4Projection.GetDecimalDegreesParametersString();
proj4.Open();
fileGeoDatabaseFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;
fileGeoDatabaseFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.Canal1;
fileGeoDatabaseFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.City1;
fileGeoDatabaseFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
fileGeoDatabaseFeatureLayer.FeatureSource.Projection = proj4;
layerOverlay.Layers.Add(fileGeoDatabaseFeatureLayer);
winformsMap1.Overlays.Add(layerOverlay);
fileGeoDatabaseFeatureLayer.Open();
winformsMap1.CurrentExtent = fileGeoDatabaseFeatureLayer.GetBoundingBox();
winformsMap1.Refresh();
}
Wish that’s helpful.
Regards,
Ethan
Hi Ethan,
May i know , How to find map unit for GDB?
Regards,
Tamilarasan
Hi Tamil,
You can use this code:
fileGeoDatabaseFeatureLayer.Open();
winformsMap1.CurrentExtent = fileGeoDatabaseFeatureLayer.GetBoundingBox();
If the point of CurrentExtent is in the range between -180 and 180, it may be DecimalDegree, if it’s a big value it must be meter.
Regards,
Ethan
Hi Ethan ,
I want to load all Layer from the GDB file.
I loop through all table from GDB file its throw object null reference error.
Please do the needful.
Code
private void Form1_Load(object sender, EventArgs e)
{
winformsMap1.MapUnit = GeographyUnit.DecimalDegree;
//NewMethod("COUNTY");
//NewMethod("SCHOOL");
Collection<string> tables = FileGeoDatabaseFeatureLayer.GetTableNames(@"..\..\AppData\MapData.gdb");
foreach (string strem in tables)
{
NewMethod(strem);
}
winformsMap1.Refresh();
}
private void NewMethod(string str)
{
try
{
LayerOverlay layerOverlay = new LayerOverlay();
FileGeoDatabaseFeatureLayer fileGeoDatabaseFeatureLayer = new FileGeoDatabaseFeatureLayer(@"..\..\AppData\MapData.gdb", str);
Proj4Projection proj4 = new Proj4Projection();
proj4.InternalProjectionParametersString = fileGeoDatabaseFeatureLayer.GetInternalProj4ProjectionParametersString();
proj4.ExternalProjectionParametersString = Proj4Projection.GetDecimalDegreesParametersString();
proj4.Open();
fileGeoDatabaseFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;
fileGeoDatabaseFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.Canal1;
fileGeoDatabaseFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.City1;
fileGeoDatabaseFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
fileGeoDatabaseFeatureLayer.FeatureSource.Projection = proj4;
layerOverlay.Layers.Add(fileGeoDatabaseFeatureLayer);
winformsMap1.Overlays.Add(layerOverlay);
fileGeoDatabaseFeatureLayer.Open();
winformsMap1.CurrentExtent = fileGeoDatabaseFeatureLayer.GetBoundingBox();
winformsMap1.Refresh();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
Also attach my screen shot.
Thanks,
Tamilarasan.
Hi Tamil,
You can modify your code like this:
public partial class Form1 : Form
{
bool IsFirstLayer = true;
string fileGeoDatabaseFeatureLayerProjectionString;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
winformsMap1.MapUnit = GeographyUnit.DecimalDegree;
Collection<string> tables = FileGeoDatabaseFeatureLayer.GetTableNames(@"..\..\AppData\MapData.gdb");
LayerOverlay layerOverlay = new LayerOverlay();
foreach (string table in tables)
{
FileGeoDatabaseFeatureLayer layer = GetLayer(table.Substring(1));
layerOverlay.Layers.Add(layer);
if (IsFirstLayer)
{
winformsMap1.CurrentExtent = layer.GetBoundingBox();
IsFirstLayer = false;
}
else
{
winformsMap1.CurrentExtent.ExpandToInclude(layer.GetBoundingBox());
}
}
winformsMap1.Overlays.Add(layerOverlay);
winformsMap1.Refresh();
}
private FileGeoDatabaseFeatureLayer GetLayer(string tableName)
{
FileGeoDatabaseFeatureLayer fileGeoDatabaseFeatureLayer = new FileGeoDatabaseFeatureLayer(@"..\..\AppData\MapData.gdb", tableName);
if (IsFirstLayer)
{
fileGeoDatabaseFeatureLayerProjectionString = fileGeoDatabaseFeatureLayer.GetInternalProj4ProjectionParametersString();
}
Proj4Projection proj4 = new Proj4Projection();
proj4.InternalProjectionParametersString = fileGeoDatabaseFeatureLayerProjectionString;
proj4.ExternalProjectionParametersString = Proj4Projection.GetDecimalDegreesParametersString();
proj4.Open();
fileGeoDatabaseFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;
fileGeoDatabaseFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.Canal1;
fileGeoDatabaseFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.City1;
fileGeoDatabaseFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
fileGeoDatabaseFeatureLayer.FeatureSource.Projection = proj4;
fileGeoDatabaseFeatureLayer.Open();
return fileGeoDatabaseFeatureLayer;
}
}
In fact I don’t suggest you render the layer like this, it looks not so well.
You should want to write render logic for each layer, and assign a best current extent so it looks better.
Regards,
Ethan
Hi Ethan,
Thanks for your update.!.
Please suggestion us to which layer projection seems look good to get from GDB file?
And how i find the layer from GDB file?
Thanks,
Tamilarasan.
Hi Tamil,
Please refer the below details about your questions:
Using which projection is up to you. The reprojection affects the performance of map rendering, so we suggest you reduce reprojection. You should set map unit according to the projection that your data uses the most to reduce reprojection.
Please refer the below code to get the projection:
var projections = new Collection<string>();
foreach (var tableName in tableNames)
{
var layer = new FileGeoDatabaseFeatureLayer(@"..\..\AppData\MapData.gdb", tableName.Substring(1));
layer.Open();
var projection = layer.GetInternalProj4ProjectionParametersString();
projections.Add(projection);
}
var projectionGroups = projections.GroupBy(proj => proj);
var selectedProj = projectionGroups.First(p => p.Count() == projectionGroups.Max(g => g.Count())).Key;
If you have any questions, please feel free to contact us.
Thanks,
Hi Rex,
Thanks for your update.
Please do the needful.
Thanks,
Tamilarasan.
Hi Team,
Now i am testing with different GDB file.
But some layer throw exception.
Please refer my screen shot.
Regards,
Tamilarasan.
Hi Tamil,
If you want to show label, I think you need to set the correct text style for layer.
If you met exception please find which layer have the problem, and just like the exception shows:
Please make sure the column which you used in code is exist in the data.
Regards,
Ethan