[mapguide-users] How to use API (get selection geom) on Remote Server using a GETRUNTIMEMAP session ID?
Flipper
scotth at mpowerinnovations.com
Thu Oct 22 07:30:42 PDT 2015
Thanks Hans,
I had actually abandoned everything for the REST service. But got stuck on
the Make Selection and PUT aspects and my requests for help have gone
unanswered so I appreciate this allot.
I will now revisit using the Maestro SDK although I really did like the
idea of using the REST service..Jackie Really does do amazing work! I just
wish I could ever get his work to work for me.
On Thu, Oct 22, 2015 at 2:33 AM, Hans Milling [via OSGeo.org] <
ml-node+s1560n5231862h9 at n6.nabble.com> wrote:
> This is how I would query a layer on a remote MapGuide server (I've cut
> bits and pieces fom my source):
>
> // 1. Connect:
> private static IServerConnection mgconnection;
> private static IMapDefinition map_definition;
> mgconnection = ConnectionProviderRegistry.CreateConnection("Maestro.Http", "Url", url, "Username", username, "Password", password);
> map_definition = (IMapDefinition)mgconnection.ResourceService.GetResource("library://maps/mymap.mapdefinition");
> ModelSetup.Initialize(); // Needed if you use v1.3 or later resources
> //2. Query the layer:
> ILayerDefinition layer_definition = null;
> foreach (IMapLayer layer in map_definition.MapLayer)
> if (layer.Name.ToLower() == "TestLayer")
> {
> layer_definition = (ILayerDefinition)mgconnection.ResourceService.GetResource(layer.ResourceId);
> break;
> }
> IVectorLayerDefinition vlayer = layer_definition.SubLayer as IVectorLayerDefinition;
> IFeatureSource fs = (IFeatureSource)mgconnection.ResourceService.GetResource(vlayer.ResourceId);
>
>
> IFeatureService featSvc = (IFeatureService)mgconnection.GetService((int)ServiceType.Feature);
>
>
> using (IReader fsr = featSvc.QueryFeatureSource(vlayer.ResourceId, vlayer.FeatureName, "ColumnA=1234", new string[] { vlayer.Geometry }))
> {
> while (fsr.ReadNext())
> {
> IGeometry geometry = fsr[vlayer.Geometry] as IGeometry
> // Do whatever you lik with the geometry
> }
> }
> return ret;
>
>
> Best regards
> Hans Milling...
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://osgeo-org.1560.x6.nabble.com/How-to-use-API-get-selection-geom-on-Remote-Server-using-a-GETRUNTIMEMAP-session-ID-tp5231522p5231862.html
> To unsubscribe from How to use API (get selection geom) on Remote Server
> using a GETRUNTIMEMAP session ID?, click here
> <http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5231522&code=c2NvdHRoQG1wb3dlcmlubm92YXRpb25zLmNvbXw1MjMxNTIyfDMyMzM0MDY4Mg==>
> .
> NAML
> <http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
--
*Scott Hameister | www.mpowerinnovations.com
<http://www.mpowerinnovations.com/>________________________________________**mPower
Innovations*
1051 N Lynndale Drive, Suite 2A, Appleton, WI 54914
Main: (877) 269-6971 x 204 <%28877%29%20269-6971%20x%20207> | Mobile: (920)
419-6250 <%28920%29%20470-0292>
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/How-to-use-API-get-selection-geom-on-Remote-Server-using-a-GETRUNTIMEMAP-session-ID-tp5231522p5231994.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapguide-users/attachments/20151022/3accfe0d/attachment.html>
More information about the mapguide-users
mailing list