[mapguide-users] Programmatically using GetMapKML, GetLayerKML and GetFeatureKML in .NET

Jackie C. Ng jumpinjackie at gmail.com
Sun Apr 20 08:06:56 EDT 2008


Try using the MgByteSource class and call its get reader (returns
MgByteReader)

MgByteSource expects a byte[], so you can use MemoryStream or a Stream
subclass that either can connect to MemoryStream or exposes byte content and
length.

Hope that helps.

- Jackie


DevMan wrote:
> 
> Jackie. Many thanks for this.
> 
> Yes, I have been able to set up the functions to work, but it returns a
> MgByteReader, which can only be taken in the MgByteSink to generate an XML
> file.
> 
> What if someone does not want to create an XML file and just use an
> XMLWriter to create the XML in memory and stream it to the client (Google
> Earth).
> 
> Hope to find a solution to this.
> 
> Thanks a lot.
> 
> A.
> 
> http://www.vouchers4gifts.co.uk/2008/04/watch-ipl-cricket-in-uk-for-5-pound.htm 
> 
> Jackie C. Ng wrote:
>> 
>> The key to using the KML service programmatically is that you need to
>> have the runtime map (ie the MgMap object), that you either:
>> 
>> - Create() from a Map Definition resource id
>> 
>> OR
>> 
>> - Open() from a runtime map name
>> 
>> Once you have an MgMap instance, the rest of the parameters should be
>> self-explanatory.
>> 
>> - Jackie
>> 
>> 
>> DevMan wrote:
>>> 
>>> Hello All,
>>> 
>>> I am a newbiew to Mapguide 2.0 OS API and I would be very grateful, if
>>> someone could plz help me out on this.
>>> 
>>> All I need to do is to use the GetMapKML, GetLayerKML and GetFeatureKML
>>> programmatically in a C# aspx page. The purpose is to generate a KML
>>> feed for Google Earth on the fly.
>>> 
>>> The GetMapKML in MapAgent and also the link like
>>> http://localhost/mapguide/mapagent/mapagent.fcgi?OPERATION=GetMapKml&VERSION=1.0.0&MAPDEFINITION=Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition&FORMAT=KML&LOCALE=en
>>> 
>>> works fine, but I need to implement it on a separate aspx page, which
>>> would then return the KML.
>>> 
>>> I know that the GetMapKMl etc. return a ByteReader, but can't really put
>>> in the parameters in these GetKML methods.
>>> 
>>> Its really urgent, so If someone could please post a functional code
>>> that I could possibly implement or modify to my needs.
>>> 
>>> Many thanks in advance.
>>> 
>>> Ajay
>>> 
>>> 
>>> 
>> 
>> 
> 
> 


-----
http://themapguyde.blogspot.com

http://www.linkedin.com/in/jackieng
-- 
View this message in context: http://www.nabble.com/Programmatically-using-GetMapKML%2C-GetLayerKML-and-GetFeatureKML-in-.NET-tp16697335s16610p16790685.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list