[fusion-dev] Error with displaying google imagery

JP_Staff jpps975 at sbcglobal.net
Wed Oct 7 12:52:24 EDT 2009


Zak,
thanks for all your help, I was able to get it working, looks like I had
some issues with the current projections and I ended up loading the map via
javascript and not through the application definition.

JP_Staff wrote:
> 
> Zak,
> I was able to get the google imagery to display with success thanks to
> your help. It seems like my  map projections weren't getting along with
> googles. Now my next question is kinda a curve ball. In my past
> implementations I have been using Weblayouts(not fusion) to display my
> maps to individuals customers. The process of creating the maps were
> dynamic so different user have different dataset and different layers. I
> was able to accomplish this by using the Maestro API and manipulating my
> weblayout,map,and add layers at runtime. My question is there any clean
> way to accomplish(besides modifying the xml) this by modifying the
> application definition dynamically in the Maestro API. In the past I was
> able to accomplish this using weblayouts by:
> Uri host = new
> Uri(ConfigurationSettings.AppSettings["MgFCGI_Path"].ToString());
> 
>             HttpServerConnection conn = new HttpServerConnection(host,
> SessionID, "en", true);
> 
>             WebLayout webLayout =
> conn.GetWebLayout(LayoutResourceID.ToString());
>             
>             MapDefinition mapdef =
> conn.GetMapDefinition(MapResourceID.ToString());
> 
> //add layers to map
>             foreach (MapLayerType layer in LayersToAdd)
>             {
>                 layer.Visible = true;
> 
>                 layer.ExpandInLegend = true;
>                 
>                 mapdef.Layers.Add(layer);
> 
>                 //mapdef.BackGroundColorAsHTML = "dbeaff";
>             }
> 
>             //add our layer group collection to map definition
> 
>             //create base map definition
> 
>             MapDefinitionTypeBaseMapDefinition baseDef = new
> MapDefinitionTypeBaseMapDefinition();
> 
>             baseDef.BaseMapLayerGroup = BaseGroupCollection;
> 
>             mapdef.BaseMapDefinition = baseDef;
> 
>             baseDef.FiniteDisplayScale = new DoubleCollection();
> 
> 
>             baseDef.FiniteDisplayScale.Add(0);
>             baseDef.FiniteDisplayScale.Add(10000);
>             baseDef.FiniteDisplayScale.Add(100000);
>             baseDef.FiniteDisplayScale.Add(250000);
>             baseDef.FiniteDisplayScale.Add(600000);
>             baseDef.FiniteDisplayScale.Add(1000000);
>             baseDef.FiniteDisplayScale.Add(1500000);
>             baseDef.FiniteDisplayScale.Add(2000000);
>             baseDef.FiniteDisplayScale.Add(2500000);
>             baseDef.FiniteDisplayScale.Add(3000000);
>             baseDef.FiniteDisplayScale.Add(4000000);
>             baseDef.FiniteDisplayScale.Add(6000000);
>             baseDef.FiniteDisplayScale.Add(10000000);
> 
>  //Save the modified map at its new temporary location
>             conn.SaveResource(mapdef);// , tempMapDef);
>  //Generate a temporary WebLayout id
>             string tempWebLayout = new ResourceIdentifier("MyLayout",
> ResourceTypes.WebLayout, conn.SessionID);
> 
>             //Update the WebLayout to point at the modified MapDefinition
>             webLayout.Map.ResourceId = mapdef.ResourceId;
> 
>             //Save the modified layout at its new temporary location
>             conn.SaveResource(webLayout);
>             
>             WebLayoutString = webLayout.ResourceId.ToString();
> 
> ---------------------------------------------------------------------------------
> --------------------------------------------------------------------------------
> currently I am trying the following for application definiton
> //get the application definition
> ApplicationDefinitionType app_Type =
> conn.GetApplicationDefinition(FlexibleLayoutResourceID.ToString());
> //iterate through the map groups find the reourceid of the map and set it
> to the modified with layers
> MapGroupTypeCollection map_Coll = app_Type.MapSet;
> 
>             foreach (MapGroupType mg_Type in map_Coll)
>             {
>                 MapTypeCollection mcollection = mg_Type.Map;
>                 
>                 
>                 foreach
> (OSGeo.MapGuide.MaestroAPI.ApplicationDefinition.MapType m_type in
> mcollection)
>                 {
>                    
>                         CustomContentType c_Type = m_type.Extension;
> 
>                         System.Xml.XmlElement[] elements = c_Type.Any;
>                         //here is where i would set the new map resource
> id to pointot the generated map with layers
>                       
>                 }
> 
>             
>             }
> 
>  //Save the modified map at its new temporary location
>             conn.SaveResource(mapdef);
> 
> 
>             //Generate a temporary application definition id
>             string tempWebLayout = new ResourceIdentifier("MyApplication",
> ResourceTypes.ApplicationDefinition, conn.SessionID);
> 
> //Save the modified layout at its new temporary location
>             conn.SaveResourceAs(app_Type,app_Type.ResourceId.ToString());
> 
> 
> Thanks,
> JPS
> 
> 
> Zak James-2 wrote:
>> 
>> JP,
>> 
>> I'm not sure what's wrong but I confess I haven't tried this with IIS.  
>> There aren't any path differences that I know of - fusion from svn  
>> should be a drop-in replacement under mapguide2010.
>> 
>> Are there any other error messages displayed in your javascript console?
>> 
>> zak
>> --
>> Zak James
>> Applications and Software Development
>> DM Solutions Group Inc.
>> http://www.dmsolutions.ca
>> http://research.dmsolutions.ca
>> 
>> 
>> 
>> On 2009-10-01, at 9:29 AM, JP_Staff wrote:
>> 
>>>
>>> Zak,
>>>
>>> Thanks for the quick response. I went ahead and got the latest  
>>> version from
>>> the svn trunk. I copied the files over and used my same config files  
>>> from
>>> original version in the fusion directory. I was able to view the  
>>> google
>>> imagery but no other layers. Toolbar is blacked out along with the  
>>> legend.
>>> Now when I load the application the mapviewer is throwing an  
>>> exception for
>>> the XMLHttpRequest Object is undefined. THis leads me to point  
>>> toward the
>>> json /ajax side of things. If I run the same map from mapguide  
>>> studio I end
>>> up with a configLoadError. I checked and make sure there were no  
>>> issues with
>>> the Mime Types in IIS, but they are configured correctly. Before I  
>>> revert I
>>> was wondering if there is a possible configuration setting in a file 
>>> (ie.
>>> path from mapguideopensource to mapguide2010) I am missing since I  
>>> am using
>>> the Autodesk supported version of fusion and the one I just copied  
>>> is the
>>> MGOS version.
>>> THanks Again,
>>> Jean-Paul
>>>
>>> Zak James-2 wrote:
>>>>
>>>> JP,
>>>>
>>>> Are you sure you have replaced the fusion folder installed by  
>>>> mapguide
>>>> 2010 with a fresh svn version of fusin trunk?
>>>>
>>>> Zak
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: JP_Staff
>>>> Sent:  30/09/2009 17:09:56
>>>> Subject:  [fusion-dev] Error with displaying google imagery
>>>>
>>>>
>>>> Hi All,
>>>>
>>>> I am a newbie to this site, and so far have gained alot of great
>>>> information. I am running into an issue when loading google maps in  
>>>> my
>>>> current fusion template. I am currently using MG2010, and using the
>>>> slate.html template. I am loading all layers dynamically to the map  
>>>> using
>>>> MaestroAPI.I have followed the implementation of the
>>>> http://trac.osgeo.org/fusion/wiki/MapGuideCommercialOverlays
>>>> for overlaying google imagery into my current map. I have modified my
>>>> index.html file to include the google javascript file reference and  
>>>> I am
>>>> currently using the fusion.js file. I have updated my current map
>>>> definition
>>>> to include the google reference here is a snippit of my map def
>>>>
>>>>
>>>>
>>>>        -95.854896545410156
>>>>        34.845642892061733
>>>>        10000000
>>>>
>>>>
>>>> 			 Google
>>>> 			
>>>>              google
>>>>
>>>>                  G_HYBRID_MAP
>>>>
>>>>
>>>>
>>>> 	
>>>>
>>>>        MapGuide
>>>>        true
>>>>
>>>> 			
>>>> 					   false
>>>> 					   true
>>>> 					   EPSG:900913
>>>> 			
>>>>          {0}
>>>>
>>>>
>>>>
>>>> 	
>>>>
>>>>
>>>>
>>>>
>>>> When loading the map I recieve the following javascript error
>>>> (1) this.mapWidget.oMapOL is null
>>>> (2)legend.currentRange is null
>>>> (3)lots of Object reference set to null
>>>>
>>>> Then the layers load in the legend, the toolbar is not visible  
>>>> above the
>>>> map.
>>>>
>>>> My layers load on the map, if I pan the map I am able to view the  
>>>> google
>>>> base map, then it is covered by my other layers. I have found in the
>>>> Legend.js where the issue is returning null, but I can't seem to  
>>>> locate
>>>> the
>>>> error wherethis.mapWidget.oMapOL is null, I am assuming it is in the
>>>> openlayers.js, any help or guidance is much appreciated.
>>>>
>>>> THanks,
>>>> Jean-Paul
>>>>
>>>> -- 
>>>> View this message in context:
>>>> http://n2.nabble.com/Error-with-displaying-google-imagery-tp3745357p3745357.html
>>>> Sent from the Fusion Developers mailing list archive at Nabble.com.
>>>> _______________________________________________
>>>> fusion-dev mailing list
>>>> fusion-dev at lists.osgeo.org
>>>> http://lists.osgeo.org/mailman/listinfo/fusion-dev
>>>>
>>>> _______________________________________________
>>>> fusion-dev mailing list
>>>> fusion-dev at lists.osgeo.org
>>>> http://lists.osgeo.org/mailman/listinfo/fusion-dev
>>>>
>>>>
>>>
>>> -- 
>>> View this message in context:
>>> http://n2.nabble.com/Error-with-displaying-google-imagery-tp3745357p3749026.html
>>> Sent from the Fusion Developers mailing list archive at Nabble.com.
>>> _______________________________________________
>>> fusion-dev mailing list
>>> fusion-dev at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/fusion-dev
>> 
>> _______________________________________________
>> fusion-dev mailing list
>> fusion-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/fusion-dev
>> 
>> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/Error-with-displaying-google-imagery-tp3745357p3783088.html
Sent from the Fusion Developers mailing list archive at Nabble.com.


More information about the fusion-dev mailing list