[mapguide-users] Tooltip on MapGuide Web API

Jackie Ng jumpinjackie at gmail.com
Wed May 27 03:29:32 EDT 2009


If you use the MgMap(MgSiteConnection) constructor, you should (must?) use
these overloads:

Create(MgResourceIdentifier, string)
Open(string)
Save()

See the gory details here: http://trac.osgeo.org/mapguide/wiki/MapGuideRfc9

- Jackie


gatopardo wrote:
> 
> USING OPEN METHOD
> mapGuideMap = new MgMap(this.mapGuideSiteCnn);
> mapGuideMap.Open(this.MapGuideResourceService,mapResourceIdentifier);
> //render map
> byteReader = mapGuideRenderingService.RenderMap(mapGuideMap, selection,
> mgEnvelope, width, height, new MgColor(backColor), "PNG", true);
> 
> mapGuideMap.Save(mapGuideResourceService);
> //this doesn't throw any exception, but GetDisplayHeight/GetDisplayWidth
> returns 0
> 
> //If i use this other overload
> mapGuideMap.Save(mapGuideResourceService,new
> MgResourceIdentifier(resourceId));
> //this throws "An exception occurred in the XML parser" exception
> 
> USING CREATE METHOD
> mapGuideMap = new MgMap(this.mapGuideSiteCnn);
> mapGuideMap.Create(mapGuideResourceService, mapResourceIdentifier,
> "testMap");
> //render map
> byteReader = mapGuideRenderingService.RenderMap(mapGuideMap, selection,
> mgEnvelope, width, height, new MgColor(backColor), "PNG", true);
> 
> mapGuideMap.Save(mapGuideResourceService);
> //this throws "Null reference" exception
> 
> //If i use this other overload
> mapGuideMap.Save(mapGuideResourceService,new
> MgResourceIdentifier(resourceId));
> //this throws "An exception occurred in the XML parser" exception
> 
> 
> 
> 
> Jackie Ng wrote:
>> 
>> Which constructor for MgMap did you use and which overload of
>> Create()/Open()/Save() did you use?
>> 
>> - Jackie
>> 
>> 
>> gatopardo wrote:
>>> 
>>> I've tried to open the map with MgMap.Create() and with MgMap.Open()
>>> I've tried to call Save(), but doesnt' work.
>>> 
>>> It could be a bug? Or I am doing something wrong?
>>> 
>>> 
>>> 
>>> Chris Claydon wrote:
>>>> 
>>>> I *think* that when you call RenderMap, it will set the width and
>>>> height for the in-memory map object. Try calling Save() on the map to
>>>> save the values back to the session repository before making the calls
>>>> to GetDisplayWidth/GetDisplayHeight.
>>>> 
>>>> Chris.
>>>> 
>>>> -----Original Message-----
>>>> From: mapguide-users-bounces at lists.osgeo.org
>>>> [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of gatopardo
>>>> Sent: Tuesday, May 26, 2009 7:05 AM
>>>> To: mapguide-users at lists.osgeo.org
>>>> Subject: RE: [mapguide-users] Tooltip on MapGuide Web API
>>>> 
>>>> 
>>>> I've tried QueryFeatures on MgRenderingService, but it throws an
>>>> exception.
>>>> I've been looking the MgRenderingService source code, and the exception
>>>> is
>>>> because the map has the height, width and scale equal to 0.
>>>> 
>>>> I don't know how can I set this values on Web Api. Because the map
>>>> doesn't
>>>> have setDisplayWidth or setDisplayHeight methods, only have
>>>> GetDisplayWidth
>>>> and GetDisplayHeight. Both returns 0.
>>>> 
>>>> First of all I have rendered map images, but the map object doesn't
>>>> save the
>>>> render height and width.
>>>> So I think the real problem is how to make that the MgMap Object
>>>> "remembers"
>>>> the last render height and width parameters, or how to set them.
>>>> 
>>>> 
>>>> Chris Claydon wrote:
>>>>> 
>>>>> I'm pretty sure that QUERYMAPFEATURES ends up calling the
>>>>> QueryFeatures
>>>>> method on the MgRenderingService. You'll need to create a geometry
>>>>> object
>>>>> that corresponds to the point you're clicking on. It is best to make
>>>>> it a
>>>>> small square rather than a single point, in order for the spatial
>>>>> filter
>>>>> to pick up the underlying feature. And it should use coordinates in
>>>>> the
>>>>> same coordinate system as the map (not image pixel cords).
>>>>> 
>>>>> Chris.
>>>>> 
>>>>> From: mapguide-users-bounces at lists.osgeo.org
>>>>> [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Kenneth
>>>>> Skovhede, GEOGRAF A/S
>>>>> Sent: Monday, May 25, 2009 7:35 AM
>>>>> To: MapGuide Users Mail List
>>>>> Subject: Re: [mapguide-users] Tooltip on MapGuide Web API
>>>>> 
>>>>> The operation is called "QUERYMAPFEATURES", but I can't seem
>>>>> to find it as a function from the Web API.
>>>>> You can see it in use if you look in the file:
>>>>> C:\program
>>>>> files\MapGuideOpenSource2.0\WebServerExtensions\www\viewerfiles\ajaxmappane.templ
>>>>> line 2555.
>>>>> 
>>>>> You may also want to read this thread:
>>>>> http://lists.osgeo.org/pipermail/mapguide-users/2007-January/004818.html
>>>>> 
>>>>> 
>>>>> Regards, Kenneth Skovhede, GEOGRAF A/S
>>>>> 
>>>>> 
>>>>> gatopardo skrev:
>>>>> 
>>>>> Nobody can help me?
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> gatopardo wrote:
>>>>> 
>>>>> 
>>>>> 
>>>>> How could I get the Tooltip on a point using MapGuide Web API?
>>>>> 
>>>>> 
>>>>> 
>>>>> Example:
>>>>> 
>>>>> I have generated an image using MgRenderingService.RenderMap, and
>>>>> after
>>>>> 
>>>>> that I want to get the tooltip on a point of this image, using the
>>>>> 
>>>>> coordinates on image pixels or converting them to lat-lon.
>>>>> 
>>>>> 
>>>>> 
>>>>> But I haven't found any method that makes this.
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> _______________________________________________
>>>>> mapguide-users mailing list
>>>>> mapguide-users at lists.osgeo.org
>>>>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>>>>> 
>>>>> 
>>>> 
>>>> -- 
>>>> View this message in context:
>>>> http://n2.nabble.com/Tooltip-on-MapGuide-Web-API-tp2732016p2974565.html
>>>> Sent from the MapGuide Users mailing list archive at Nabble.com.
>>>> 
>>>> _______________________________________________
>>>> mapguide-users mailing list
>>>> mapguide-users at lists.osgeo.org
>>>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>>>> _______________________________________________
>>>> mapguide-users mailing list
>>>> mapguide-users at lists.osgeo.org
>>>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>>>> 
>>>> 
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/Tooltip-on-MapGuide-Web-API-tp2732016p2979541.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list