stophun / fdotoolbox

Automatically exported from code.google.com/p/fdotoolbox
0 stars 1 forks source link

MapGuide Server extension module #69

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
It would be great to be able to connect to a mapguide server and just login
to gain access to all the preconfigured FDO connections

Original issue reported on code.google.com by zac.spit...@gmail.com on 30 Jul 2008 at 3:08

GoogleCodeExporter commented 8 years ago
Does MapGuide expose the MG_DATA_PATH alias (?) via the mapagent/http? 
Otherwise, you
would only be able to get the unmanaged feature sources.

Original comment by jumpinja...@gmail.com on 30 Jul 2008 at 3:19

GoogleCodeExporter commented 8 years ago
You'd have access to the RDBMS data sources.

For Windows servers, even for unmanaged data sources, they'd either need to be 
UNC 
paths or you'd have to be able to perform mapping from the data path 
(E:\MapGuide) 
into admin UNC shares(\\server\e$\mapguide)... which typically wouldn't be 
available 
to users.

Original comment by ja...@jasonbirch.com on 31 Jul 2008 at 9:03

GoogleCodeExporter commented 8 years ago
Short of checking the provider name, does MapGuide expose a property indicating
whether a feature source is rdbms-based or not? 

Kind of like the ProviderDatastoreType property of the ConnectionInfo object in
FdoIConnection?

Also please be aware that the MapGuide Server would have to be in localhost or 
at
least the local network for this to actually work. Which kind of limits its
usefulness from a MapGuide integration point of view.

Original comment by jumpinja...@gmail.com on 1 Aug 2008 at 12:41

GoogleCodeExporter commented 8 years ago
If you use the MaestroAPI, you can access the FeatureSource data over a Http
connection. If you want a little lighter access to MapGuide, you can manually 
call
the EnumerateResources on mapagent.fcgi, and retrieve a list of all resources in
MapGuide. It is possible to let the server filter the results, so you only get 
the
FeatureSources.

This list also has a header property for each element, where you can find out 
what
icon to display for the featuresource. Fortunately, RDBMS and file based 
providers
have different icons associated. It's not fool prof, since OGR supports both 
types of
data.

AFAIK, there is no way to read out the MG_DATA_PATH variable, or retrieve data 
other
than files attached to a resource. You can however get the content of a 
featuresource
as an Xml file. Again, MaestroAPI has a feature reader for parsing this data, 
if it's
too much work to parse it manually.

Original comment by kenneth....@gmail.com on 4 Aug 2008 at 1:48

GoogleCodeExporter commented 8 years ago
Jackie, there's a small example I've left overthere few days ago: 
http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI/samples/RuntimeMap - 
it's not 
about feature sources, but more about general Meastro API usage pattern. Sorry 
for 
posting this note to Futures section, you may freely delete the comment.

Perhaps I should leave another example related to MgFeatureSoruce access only?

Original comment by LivelyTe...@gmail.com on 30 Aug 2008 at 2:03

GoogleCodeExporter commented 8 years ago
My main issue right now is figuring out a use-case that is foolproof.

We can't really use http/mapagent unless its to localhost because you can't 
exactly
hope to connect to a FDO connection referenced by a MapGuide Server half-way 
round
the world, for example.

So that means that in terms of MapGuide integration, we can only really 
integrate
with locally-reachable MapGuide servers (Using the official MapGuide Web API or
whatever the equivalent is in MaestroAPI). 

We could ask for the IP address of the MapGuide Server and dynamically generate 
a
webconfig.ini to init the API (Can MaestroAPI do this?)

Then there is an issue of de-referencing MapGuide Feature Sources. Because 
there is
no way to get the value of MG_DATA_PATH (preventing us from being able to 
connect to
managed flat-file spatial data), we are almost exclusively restricted to 
un-managed
feature sources.

Just thought I'd point these issues out.

Original comment by jumpinja...@gmail.com on 31 Aug 2008 at 3:57

GoogleCodeExporter commented 8 years ago
what's the de-referencing issue, MG_DATA_PATH isn't problem coz mapguide 
handles it
all, you are just accessing a feature class, aside from provider quirks, it 
doesn't
matter what your connecting to it's all the same. 

how far away the server is not really a problem to worry about either.. might 
be slow
but it will still work. the api connection requires a non standard port access 
aside
from http, that's the extra layer of complexity with webconfig.ini...

if we are local on the same machine, theoretically you could pull the 
featuresource
defs from mapguide but create them locally within fdotoolbox

Original comment by zac.spit...@gmail.com on 31 Aug 2008 at 5:01

GoogleCodeExporter commented 8 years ago
If you use the MaestroAPI HttpServerConnection for remote connections, it does 
not
use the webconfig.ini file, and it does not use any other port than 80 (or 
whatever
the webserver uses).

Again, with MaestroAPI, you can download/upload the files attached to a
FeatureSource, so even though you cannot convert MG_DATA_PATH, you can 
read/write the
files by calling GetResourceData/SetResourceData (again without webconfig, and 
using
only port 80).

The problem is with RDBMS stores and unmanaged files, as those are not 
obtainable
from the WebAPI. You can read any datastore using a FeatureSetReader, but cannot
write them.

Original comment by kenneth....@gmail.com on 1 Sep 2008 at 7:29

GoogleCodeExporter commented 8 years ago
Are you after integration with MapGuide by accessing data in MapGuide's via its 
APIs
instead of using raw FDO? 

I just want to know if we're on the same wavelength here :-)

Original comment by jumpinja...@gmail.com on 1 Sep 2008 at 9:14

GoogleCodeExporter commented 8 years ago
i would like to be able to leverage all the fdo configs which are already 
defined
within mapguide....

assuming we are local, reading out the feature source definitions out from 
MapGuide
and then creating the fdo connections natively within fdo toolbox would be 
cool. but
my my initial idea was just treating mapguide as generic fdo datasource 

Original comment by zac.spit...@gmail.com on 1 Sep 2008 at 9:28

GoogleCodeExporter commented 8 years ago
Ok I think we're getting on the same track here.

I've changed the issue summary to something more fitting. Here is my current 
line of
thinking.

- A new root tree node will be available in the Object Explorer: "MapGuide 
Feature
Sources"

- The Object Explorer code interface and implementation will be changed to allow
addition of new root nodes.

- The MapGuide tree node will have the following context menu options:
    - Connect to a MapGuide Server
    - Disconnect (if connected)

- When connected it will enumerate all the feature sources and populate the 
MapGuide
tree node. Basically the node will function like the Site Explorer in MG
Studio/Maestro except this will only concern feature sources.

- Each feature source node will essentially be the same as the fdo connection 
nodes.
with a similar set of commands and context menu options.

- Use the existing AJAX/Fusion viewer (via WebBrowser control) for spatial data
preview, but use our own grid preview instead of the MapGuide schema report 
which is
more richer and will have more functionality.

- Extra bulk copy functionality:
    - FDO connection -> MG Feature Source
    - MG Feature Source -> FDO Connection
    - Database table -> MG Feature Source (point features)

Comments are appreciated.

Original comment by jumpinja...@gmail.com on 2 Sep 2008 at 9:26

GoogleCodeExporter commented 8 years ago

Original comment by jumpinja...@gmail.com on 2 Sep 2008 at 9:26

GoogleCodeExporter commented 8 years ago
Regarding the bulk copy:
The MG Feature Source manipulation is not avalible via the WebAPI, so you 
cannot copy
data directly from a connection into a MG Feature Source. You can create a new
Feature Source, and add an SDF file to that one. You can also update an SDF on 
an
existing featuresource, but only if it is managed.

There are some functions avalible to insert and remove data in an MG 
FeatureSource,
but those are only exposed in the local API, and thus requires use the official 
API,
with the WebConfig.ini file.

I think this extension will be very usefull.

Original comment by kenneth....@gmail.com on 2 Sep 2008 at 9:43

GoogleCodeExporter commented 8 years ago
This sounds great, have you guys considered merging your tools together?

Original comment by zac.spit...@gmail.com on 2 Sep 2008 at 10:07

GoogleCodeExporter commented 8 years ago
Ok I've made the first drop of the MapGuide extension module. You can establish 
a
http connection to a MapGuide server and it will fill the root tree node with 
all the
feature sources.

Right click on any feature source to open the data preview tab. 

And then here is where it breaks down:

When you click "Go" an MgArgumentOutOfRangeException (559) will occur at this 
line: 

http://code.google.com/p/fdotoolbox/source/browse/trunk/MGModule/Controls/MgData
PreviewCtl.cs?spec=svn470&r=470#73

Any ideas Kenneth? I thought the call to SelectFeatures() looked 
self-explanatory, I
can really figure out what's wrong.

Original comment by jumpinja...@gmail.com on 2 Sep 2008 at 3:01

GoogleCodeExporter commented 8 years ago
It's can't not can! :-)

Original comment by jumpinja...@gmail.com on 2 Sep 2008 at 3:01

GoogleCodeExporter commented 8 years ago
Re: Merging tools together

Though MapGuide and FDO are related technologies. I believe that MapGuide 
Maestro and
FDO Toolbox serve different purposes and as a result, I believe they should 
remain as
separate tools/projects.

Original comment by jumpinja...@gmail.com on 2 Sep 2008 at 3:17

GoogleCodeExporter commented 8 years ago
Re: Merging tools,
The projects share some of the same user base, but have very different focus, 
so I
agree that they would not easily merge, and I don't think a merge is desireable 
for
either project.

Re: MgArgumentOutOfRangeException,
Do you get more info in the server error log?
The call should be pretty self explanatory, and it looks like you are calling it
correctly.
The "QueryFeatures" is the same as using the "SelectFeatures" WebAPI call:
http://localhost/mapguide/mapagent/selectfeaturesform.html

Original comment by kenneth....@gmail.com on 2 Sep 2008 at 3:30

GoogleCodeExporter commented 8 years ago
I just tried building from trunk, but I couldn't see the mapguide stuff?

Original comment by zac.spit...@gmail.com on 2 Sep 2008 at 3:33

GoogleCodeExporter commented 8 years ago
You have to load the extension module manually

Original comment by jumpinja...@gmail.com on 2 Sep 2008 at 3:38

GoogleCodeExporter commented 8 years ago
Ah, i got it. good stuff :) 

the tilda's need to be treated specially, i that's making the king oracle 
classes
preview fail

It did get confused with an sdf with multiple classes, showing the same schema 
for
each class as a seperate schema. see attached screen shot

Original comment by zac.spit...@gmail.com on 2 Sep 2008 at 3:55

Attachments:

GoogleCodeExporter commented 8 years ago
I think that is resolved by http://trac.osgeo.org/mapguide/ticket/684

However please note that I'm currently using v1.0.8 of MaestroAPI which 
pre-dates
that fix

Original comment by jumpinja...@gmail.com on 2 Sep 2008 at 4:00

GoogleCodeExporter commented 8 years ago
Re: MgArgumentOutOfRangeException

I have noticed something fishy in the error logs (bad class name). I'll double 
check
what I've coded.

Original comment by jumpinja...@gmail.com on 2 Sep 2008 at 4:09

GoogleCodeExporter commented 8 years ago
I'm pretty sure that the "bad class name" is the mentioned #648 in the 
MaestroAPI.
The most recent binaries should have a MaestroAPI dll with the fix (the one 
called
Preview Release).

I have tested the plugin on my own setup, and I have many broken featuresources.
This makes the call in MapGuideModule.cs:101 fail, because
conn.DescribeFeatureSource(fsNode.Name) fails.

There is nothing to do about the error, so I would suggest simply logging the
exception. I have attached a small patch that explains what I mean.

Once I applied the attached patch, everything worked as expected. Very nice :).

The "DescribeFeatureSource" is a potentially lengthy operation (especially on 
large
Oracle databases). I would suggest that you delay the schema info load until 
the user
views the data or expands the node.

Original comment by kenneth....@gmail.com on 2 Sep 2008 at 6:17

Attachments:

GoogleCodeExporter commented 8 years ago
Re: MgArgumentOutOfRangeException

It turns out the error log I was looking at was out of date.

When I call SelectFeatures() the only that is being logged is Access.log

Here's the gist of what was written:

<2008-09-03T12:29:58>           Administrator
SelectFeatures.1.0.0:3(Library://Samples/Sheboygan/Data/BuildingOutlines.Feature
Source,BuildingOutlines,MgFeatureQueryOptions)
Success
<2008-09-03T12:29:58>           Administrator   GetFeatures.1.0.0:1(222319744) Success
<2008-09-03T12:29:58>           Administrator   
...
...
GetFeatures.1.0.0:1(222319744) Success
<2008-09-03T12:30:10>           Administrator   CloseFeatureReader.1.0.0:1(222319744) 
Success
<2008-09-03T12:30:10>           Administrator   GetFeatures.1.0.0:1(222319744) Success

So there doesn't seem to be anything wrong, or MapGuide is just not reporting 
it. The
feature source, class name and property list all check out.

???

Original comment by jumpinja...@gmail.com on 3 Sep 2008 at 2:34

GoogleCodeExporter commented 8 years ago
Ok it just dawned on me that the feature I was querying has about 30000 
features.
Does SelectFeatures() break down on large data sets? (hopefully not)

Original comment by jumpinja...@gmail.com on 3 Sep 2008 at 2:40

GoogleCodeExporter commented 8 years ago
I've made some updates to the trunk. Map preview will open the schema report 
for the
selected feature source in the embedded web browser.

I've also found out that the grid preview will actually work with certain 
feature
classes and fail on others. Some of the errors include:

- MgArgumentOutOfRangeException
- MgNullPropertyValueException

I'm testing with the Sheboygan data set. It will work with "Trees" but will 
fail on
most of the others.

Original comment by jumpinja...@gmail.com on 3 Sep 2008 at 6:54

GoogleCodeExporter commented 8 years ago
I tested it again, and the geometry preview works.

I can reproduce the errors you mention.
I have attached an updated version of the MaestroAPI (r3300).
That version fixes the encoding problem which gives MgUnclasifiedException.
It also gives a little more detail on the exceptions.
The parcel layer has som invalid geomtry, and so, trying to view the geometry 
column
throws an exception.
The MgNullValue usually occurs if a database is joined to a featuresource, and 
there
are DbNull values somewhere (don't know the details).

I can get the MgArguemntOutOfRangeException, and it seems to come from 
something with
MgByte in the server, but I don't know what that is exactly.

Original comment by kenneth....@gmail.com on 3 Sep 2008 at 9:34

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks for the updated assembly. 

There is something strange with SelectFeatures(). Basically I have two version 
of the
Sheboygan sample data set.

- The normal one
- One where all the feature classes are combined into a single sdf file.

It is the combined version where I am getting MgNullValueException when it 
would be
fine for the normal version. Strange.

Original comment by jumpinja...@gmail.com on 3 Sep 2008 at 11:58

GoogleCodeExporter commented 8 years ago
I have a theory about the MgNullValueException. 

Could it be that an exception is now thrown when calling 
MgFeatureReader::GetXXX()
methods on null values? And that the mapagent request handler (or something in 
that
call chain) is not doing null checks via calling IsNull() before fetching each 
property?

Original comment by jumpinja...@gmail.com on 17 Sep 2008 at 11:13

GoogleCodeExporter commented 8 years ago
Yes, I'm pretty sure that is the problem.
It's nice to know that the MapGuide implementers did not think it is logical to 
check
for null values before reading :).

Original comment by kenneth....@gmail.com on 18 Sep 2008 at 6:40

GoogleCodeExporter commented 8 years ago
I have just tried out the current trunk of MapGuide, and it no longer fails to
preview the data from the samples. This should mean that the errors will go 
away once
MG 2.1 is out.

Original comment by kenneth....@gmail.com on 8 Oct 2008 at 9:25

GoogleCodeExporter commented 8 years ago
I am closing this down because I have set up another project site for the 
purpose of
hosting add-ins for FDO Toolbox, one of which is a MapGuide add-in.

This add-in is being recreated from scratch. So it is best to move the
discussion/suggestions/ideas over there instead.

http://fdotoolbox-addins.googlecode.com

Original comment by jumpinja...@gmail.com on 21 Jan 2009 at 1:01