Hi,
We are trying to use SqLite as to compare the performance with shapefile. But there are very limited information or code sample on how to use SqLite specially with some of its function.
We know there are API etc SqliteFeatureSource. But there are no other details about how to write a simple program to view the map.
Could you provide some simple function on how do we load .sqLite files into wpf and how do we display using the SqLite commands etc SqliteFeatureSource with wpf?
We are using VS2010 and .net 4.0.
Thank you.
Using of SqliteFeatureSource and WPF Map Suite 9
Hi Joseph,
I think our WorldMapKit SQLite version is a good sample, it use SQLite as data source instead of shape file. You can download that from our ProduceCenter.
Regards,
Don
Hi Don,
Due to our nature of our job, we are unable and can’t access ProductionCenter (pcs are not connected to the Internet) so we totally restriction. Even pc with Internet connected are not allowed to install any software.
I really appreciated if there are samples uploaded on the website or somewhere so we can have a rough idea.
It is really frustrating that every details are on the ProductionCenter which not every companies have the privilege to access due to firewall issue.
Meanwhile I have attached the codes that I wrote to try to understand how Sqlite works. It doesn’t seems to be working. And error prompt "System.InvalidOperation Exception occurred in SQLiteExtension.dll"
Help and advice is appreciated
Simple_MapLoading.txt (1.45 KB)
Hi Joseph,
If you cannot download our ProductCenter, I think you can view our wiki samples here: wiki.thinkgeo.com/wiki/map_suite_world_map_kit_sdk_all_samples
Because I hadn’t found the data you are using, I did small change with your code and it works well.
private void WpfMap_Loaded(object sender, RoutedEventArgs e)
{
Map1.MapUnit = GeographyUnit.Meter;
LayerOverlay overlay = new LayerOverlay();
overlay.TileType = TileType.MultipleTile;
SqliteFeatureLayer sqlLayer = new SqliteFeatureLayer(@“Data Source=D:\LasVegas3857.sqlite”, “osm_water_polygon”, “id”, “geometry”);
sqlLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.Capital1;
sqlLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.GeographicColors.Grass); //WorldMapKitAreaStyles.Military();
sqlLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
overlay.Layers.Add(sqlLayer);
sqlLayer.Open();
Map1.CurrentExtent = sqlLayer.GetBoundingBox();
sqlLayer.FeatureSource.BeginTransaction();
sqlLayer.FeatureSource.AddFeature(new Feature(Map1.CurrentExtent.GetCenterPoint()));
sqlLayer.FeatureSource.CommitTransaction();
Map1.Overlays.Add(overlay);
Map1.Refresh();
}
Please build a clean project, then don’t install SQLite by NuGet, just directly reference our SQLiteExtension.dll and the System.Data.SQLite.dll in its folder.
Regards,
Don
Hi Don,
Thanks for the sample code.
But on my side I am unable to display the map out. We are still encountering the same error
"System.InvalidOperation Exception occurred in SQLiteExtension.dll"
I’ve to reference with .dll (as suggested) based on the path MapSuiteWorldMapKitSuite/ManagedAssembiles(Strong Named)/ . And I do notice that there are other same version of dll in other path etc WorldMapKitSDKSource folder. May I know which one we should use
The source, WorldMapKit-4326-20151220-335893627.sqlite, is given to us in the product package. Thus where can we find the LasVegas3857.sqlite?
Finally on the sample website, it seems like OsmWorldMapKitLayer is needed in order to use Sqlite. Am I right to say that?
Apologized for lots of question as we are very new in this area.
Hi Joseph,
The LasVegas3857.sqlite is my test sqlite database, the sample shows how to use our new version world map kit. Our new version world map kit is based on the sqlite database, our old world map kit is based on shape file.
I reference the sample url is just want to point the sample contains the code between our map and sqlite server, so which should be helpful if you want to know how to use our API to work with SQLite.
It looks you are using strong name dll, I think maybe you can try the non strong name dll first, if you still met exception there, we can know this exception won’t because strong name.
If you download any version of our dll package, please just reference the dlls in same folder, which can keep version the same.
Any question please feel free to let us know.
Regards,
Don
Hi Don,
Sorry for the late reply, as I’m busy with another assignment.
I’ve tried the non strong name as suggested.
And did not display the error. We are still unable to display the map out (only the zoom bar and the logo is out).
I didn’t change the code much, only the sqlite which we are using WorldMapKit-4326-20151220-335893627.sqlite base on what was giving to us.
Regards,
Joseph Yeo
Hi Joseph,
The code Don attached here is okay. It will take a moment to render the features because it will load all the features by setting the Map1.CurrentExtent = sqlLayer.GetBoundingBox();. In order to short the render time please try setting the CurrentExtent to smaller.
Thanks,
Peter