[mapguide-users] Maestro Api runtime map selection

Kenneth Skovhede, GEOGRAF A/S ks at geograf.dk
Wed Mar 3 03:10:32 EST 2010


Dooh! That was the method that did NOT work :)

The workaround method is:
selection = new OSGeo.MapGuide.MaestroAPI.Selection(rtMap);
selection.FromXml(rtMap.CurrentConnection.GetSelectionXml(rtMap.ResourceID));

Regards, Kenneth Skovhede, GEOGRAF A/S

On 03-03-2010 09:05, Kenneth Skovhede, GEOGRAF A/S wrote:
> Unfortunately the MaestroAPI cannot create datastores,
> or update/insert features because this is not exposed in the MapGuide 
> http API.
> You have to use the MapGuideDotNetApi.dll or similar to access those 
> functions.
>
> As a workaround, you can instead use an SQLite database, which you can 
> create
> and upload to a FeatureSource. This enables you to control the 
> database layout,
> and also allows you to connect to the database with standard tools
> (such as ODBC or System.Data.IDbConnection), for updates and inserts.
>
> There seems to be a bug regarding Selections (selection support was 
> introduced recently).
> You can get the selection this way until the bug is fixed:
> selection = new OSGeo.MapGuide.MaestroAPI.Selection(rtMap, 
> rtMap.CurrentConnection.GetSelectionXml(rtMap.ResourceID));
>
> This should also reveal how to get the selection document directly.
>
> The ToString() function is not overloaded, so when using the selection 
> object you have to use ToXml() instead.
> I will fix this too.
>
> Regards, Kenneth Skovhede, GEOGRAF A/S
>
> On 02-03-2010 21:57, Jamo wrote:
>> Ok I started creating a class of my own that would produce a layer 
>> definition
>> and save it to the repository...
>> Got upto the point of creating vector scale ranges and thought ..... 
>> Dang
>> this has already been done.
>> Enter -->  Maestro Api.
>> Is this the correct place to be asking about the maestro api?
>>
>> Can maestro Api create an SDF data store ? with actual SDF data file 
>> ....?
>> Can maestro Api write features to the SDF data store ?
>>
>>
>> It looks like It can do everything else I need.
>> prepare a new layerdefinition and add it to the map. (and save it to the
>> library if the user requires)
>> grab existing layer definition amend it and save it back.
>>
>>
>> I've been requested to improve my markup tools to include more 
>> variety, at
>> the moment users can just draw a red line draw a red polygon and 
>> place a red
>> ricle ..... very bland.
>> I'm suggesting maybe to produce a dialog that lets the user choose 
>> all the
>> style options themselves. then save it as a vectorscale range and 
>> filter it
>> with style = 1, style =2 on the actual elements...
>>
>> I'm just trying some basic maestro commands and the below code 
>> returns no
>> selection (blank featureset) ....
>> Have I got the real instance of the runtime map?
>>
>> Uri host = new Uri(mapagent);
>> ServerConnectionI conn = new HttpServerConnection(host, sessionId, "en",
>> true);
>> ResourceIdentifier res = new
>> ResourceIdentifier("PortBris",ResourceTypes.RuntimeMap,sessionId);
>> RuntimeMap rtMap = conn.GetRuntimeMap(res.ResourceId);
>> Response.Write(rtMap.Selection);
>>
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users


More information about the mapguide-users mailing list