On Mon, 4 Feb 2019 06:29:53 -0800 (PST), Joe Rose wrote:
> I found the same problem 4 years later.... Really?
>
> Using Windows 10/64 bit
> VS2013
> Mysql Data client
> Sqlite Data (with or without SpatialiteSharp)
> Mapwingis
> in a
vb.net 4.5.2 application
>
> Everything works for the Mysql & Sqlite3 (Spatiallite) until you add
> the axmap control to the application.
>
> I wished to use sqlite(3) as the spatial data source, for
> portability,
> but the adding the axmap control causes the spatial initialization on
> the sqlite data connection
> (SqliteConnection.LoadExtension(mod_spatialite.dll) to fail because
> of something axmap hijacked.
>
Hi Joe,
a very quick basic explanation:
1. load_extension(), as implemented by sqlite3, just searches the
module to be loaded within a list of directories specified by
the currently set system-wide searching rules for binaries.
if the required module cannot be found by using the current
settings an error will follow.
2. in the specific case of Windows, the directories usually searched
for binaries are (in this exact order):
2.a) the directory from which the main app was initially loaded.
2.b) the system directory (usually C:\Windows\System32)
2.c) the windows directory (usually C:\Windows)
2.d) the current working directory
2.e) any other directory defined by the system variable %PATH%
accordingly to your report it seems very alike that the "axmap"
control is silently resetting the current working directory (or
alternatively the %PATH% variable, or may be both) in such a way
that the directory where mod_spatialite is actually installed will
be removed from the searching path.
you say us absolutely nothing about the actual location of
mod_spatialite, but I strongly suspect that's it simply
installed on the current working directory.
possible hints and suggested remedies:
a) force your code to reset the expected working dir immediately
after loading "axmap" (and/or appropriately reset %PATH%)
b) alternatively you could install mod_spatialite in a fixed
immutable directory, as e.g. C:\Windows\System32
c) the last desperate resort; pass to load_extension() a fully
qualified path, as e.g. 'C:\myapp\spatialite\mod_spatialite.dll'
> This must be fixed if the mapwingis control is to be any good as a
> tool. The OGR "openfromquery" works regardless. I haven't checked
> "ogrdatasource".
>
> Also, the move shape option in the shape editor MUST be removed as
> it's a data destroyer!
>
sorry but there is nothing like "a shape option" in SpatiaLite;
I suppose that this latest claim should be reported to the
developers of some other package (probably Mapwingis).
bye Sandro