09
Jul
10

Migrate invokereport.php to vb.net for MapGuide 2011

I had to move the invokereport.php that I always use for passing the key values from MapGuide to a pre-existing report (such as one written in PHP, CFM,ASPX, ASP, CGI, etc)

The report expects a few things from MapGuide, and you will have to set them up in MapGuide Studio:

<%@ Page Language="VB" debug=true %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="OSGeo.MapGuide" %>
<%
    ' get the SESSION id
    Dim configFilePath As String = "C:/Program Files/Autodesk/MapGuideEnterprise2011/WebServerExtensions/www/webconfig.ini"
    Dim errorMsg As String
    Dim mgSessionId As String = Request("SESSION")
    Dim mapName As String = Server.UrlDecode(Request("MAPNAME"))
    Dim layerName As String = Request("LAYER")
    Dim reportUrl As String = Request("URL")
    Dim methodType As String = Request("METHOD")
    Dim keyName As String = Request("KEY")
    Dim objkeys As String = "'0'"
       
   
    Try

        MapGuideApi.MgInitializeWebTier(configFilePath)
        Dim userInfo As MgUserInformation = New MgUserInformation(mgSessionId)
        Dim siteConnection As MgSiteConnection = New MgSiteConnection()
        siteConnection.Open(userInfo)
        Dim resourceService As MgResourceService = siteConnection.CreateService(MgServiceType.ResourceService)
        Dim featureService As MgFeatureService = siteConnection.CreateService(MgServiceType.FeatureService)
        Dim queryOptions As MgFeatureQueryOptions = New MgFeatureQueryOptions()
        Dim map As MgMap = New MgMap(siteConnection)
        map.Open(mapName)
        Dim sel As MgSelection = New MgSelection(map)
        sel.Open(resourceService, mapName)
        Dim selLayers As MgReadOnlyLayerCollection = sel.GetLayers()
        Dim layerCount As Integer = selLayers.GetCount()
       
      
        Dim i As Integer = 0
        Dim layer As MgLayerBase
        'Loop through layers
        If (layerCount > 0) Then
            For i = 0 To layerCount - 1
                layer = selLayers.GetItem(i)
                Dim featureClassName As String = layer.GetFeatureClassName()
              
               
                Dim featureReader As MgFeatureReader = sel.GetSelectedFeatures(layer, featureClassName, True)
              
                If (layer.GetName() = layerName) Then
                    While (featureReader.ReadNext())
                        If (objkeys.Length <> 0) Then
                            objkeys = objkeys + ","
                        End If
                        objkeys = objkeys + "'" + featureReader.GetString(keyName) + "'"

                    End While
                    featureReader.Close()
                End If

            Next i
          
        End If
    Catch mge As MgException
        errorMsg = mge.GetExceptionMessage() + "<br><br>" + mge.GetDetails()
        Response.Write(errorMsg)
    Catch e As Exception
        errorMsg = e.Message()

    End Try
   
   

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body onload="OnPageLoad()">
    <form action="<%=reportUrl %>"  method="<%=methodType%>" name="invokeReport" target="_self">
    <input name="OBJ_KEYS" type="hidden"  value="<%=objkeys%>"/>
   
   
    </form>
   
<script language="JavaScript" type="text/javascript">
function OnPageLoad()
{
 document.invokeReport.submit();
 
 
}
</script>
   
   
</body>
</html>

 
17
Jun
10

Installing MapGuide Maestro on Mac OS X (MacBook Pro)

So I went to the download page for MapGuide Maestro and downloaded the Linux/Mac binaries:

http://trac.osgeo.org/mapguide/wiki/maestro/Downloads

And unzipped them to DOWNLOADS/MapGuideMaestro/  folder

The instructions said to run MONO.  Mono enables the .NET libraries on your Mac.  So I went to the site:

http://www.go-mono.com/mono-downloads/download.html

Downloaded the DMG for the Mono 2.6.4 – Intel Framework and installed Mono (defaults)

Now this is where it gets weird, I have to run TERMINAL to get it work.  This is like the DOS window in Windows (LINUX people know this environment well).

In Applications > Utilities > Terminal

Type: 

  • cd //
  • cd downloads/MapGuideMaestro/
  • mono Maestro.exe

And MapGuide Maestro opens!

But, I don’t want run Terminal this each time I want to run Maestro, so I can use Mac Automator.

So, open Applications > Automator

  • Choose Workflow
  • Drag and drop “Run Shell Script” into the Workflow
  • In the shell, remove “cat”
  • Type:
    • cd //
    • cd downloads/MapGuideMaestro/
    • mono Maestro.exe
  • To create a link on the desktop to run Maestro, click File > Save As
  • For Save As, enter:  MapGuideMaestro
  • For Where, ensure Desktop is selected
  • For File Format, choose Application
  • Click Save

You now have a Link on the Desktop that will open MapGuide Maestro!  

The only issue I have seen is that the PREVIEW modes do not work (except for previewing Web Layouts)..

16
Jun
10

Upgrade to MapGuide Enterprise 2011 from 2010

We’ll I upgraded www.mapguide.ca to MapGuide Enterprise 2011 yesterday.  

It went pretty well, I just: 

  • Exported the MGP file of the site using the MapGuide Site Administrator
  • Backed up any files I put in the “C:\Program Files\Autodesk\MapGuideEnterprise2010\WebServerExtensions\www\”  folder
  • Installed MapGuide Server and Web Extension (I am using PHP and Apache)
  • Copied the MGP file into the new Packages folder (“C:\Program Files\Autodesk\MapGuideEnterprise2010\Server\Packages\”)
  • Used the MapGuide Site Administrator to load the package
  • Pasted the files into the www folder
  • Reviewed all my code to ensure the webconfig.ini is found (“C:\Program Files\Autodesk\MapGuideEnterprise2010\WebServerExtensions\www\web.conifg”)
  • I had to set up my License Manager

The one thing I really love is the MapGuide Studio 2011 (not just for working in 64 bit!) is the Google/Bing/Yahoo integration. 

MapGuide Studio 2011 - Commercial Layers

MapGuide Studio 2011 - Commercial Layers

 

They work beautifully – and I don’t have to program this anymore!!  Just when I was getting a handle on OpenLayer.org too! 

07
Jun
10

MapGuide 2011 on Windows Server 2008 R2 64bit and IIS 7.5

Ok, this stumped me for days. I could not for the life of me get the License Manager to work – here is what worked:
-ADLM (License Manager) 32 bit version

-MapGuide Enterprise 2011 64 bit version

That was ok, but then I could not get PHP to run with IIS 7.5

So I had to:

  1. Go into IIS Manager
  2. Click on Handler Mappings for the Site
  3. Click Add Module Mapping
  4. In the Add Module Mapping:
    1. For Request Path, enter: *.php
    2. For Module, choose FastCgiModule
    3. For Executable, browse to: C:\Program Files\Autodesk\MapGuideEnterprise2011\WebServerExtensions\Php\php-cgi.exe
    4. For Name, enter: PHP via FastCGI
  5. Click Ok.
  6. Click Yes in the Add Module Mapping dialog box.
  7. Restart IIS.

Ok, so now PHP is running and I can login into the MapGuide Administrator and then – pow!

PHP Warning: getdate() [function.getdate]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Los_Angeles' for '-7.0/DST' instead in C:\Program Files\Autodesk\MapGuideEnterprise2011\WebServerExtensions\www\mapadmin\packagemanagement.php on line 65

How did I fix it?  Well, I opened PHP.INI in the C:\Program Files\Autodesk\MapGuideEnterprise2011\WebServerExtensions\Php folder.

And at the end of the file, added the line:

date.timezone = "America/Anchorage"

And restarted IIS.

Whew!  That was dumb.

26
Apr
10

OpenLayers 2.9 Problem with MapGuide Enterprise 2010

So I have had some issues with this new roll-out of OpenLayers 2.9. My maps are just “brown” without the Google, Yahoo, Bing or OpenStreetMaps underneath.
I fixed it by using the 2.8 version:

< script src=”http://openlayers.org/api/2.8/OpenLayers.js”>

this fixes everything…I haven’t figured out what has changed yet…

10
Mar
10

Fastest Redline Functionality in MapGuide!

This is the fastest way to get Redlines (for printing etc) in MapGuide.

  1. Open the Index.htm page in one of your MapGuide Templates (i.e. C:\Program Files\Autodesk\MapGuideEnterprise2010\WebServerExtensions\www\fusion\templates\mapguide\maroon\index.htm)
  2. Add the JavaScript link to the OpenLayers site at the top of the pages. script type="text/javascript" src="http://openlayers.org/api/OpenLayers.js"></script>
    
  3. Next modify the fusionInitialized function to call a function called addOLRedline:
    var fusionInitialized = function() {
        $('AppContainer').resize({forceResize: true});
        Fusion.getWidgetById('Map').registerForEvent(Fusion.Event.MAP_LOADED, addOLRedline);
    }
  4. Add the new addOLRedline function that gets the map, adds an empty Vector layer and shows the OpenLayers edit toolbar:
     var addOLRedline = function() {
            var mapWidget = Fusion.getWidgetById('Map');
            var map = mapWidget.oMapOL;
            vlayer = new OpenLayers.Layer.Vector( "Editable" );
            map.addLayers([vlayer]);
            map.addControl(new OpenLayers.Control.EditingToolbar(vlayer));
         }
That's it. You get a redline toolbar. gordon Add Toolbar to MapGuide
25
Feb
10

Targeting the TASKFRAME in MAPGUIDE with FUSION

I had to dig a little to find this:  thanks Mike!

To target the TaskFrame in FUSION just launch it like this:

Fusion.getWidgetById(‘TaskPane’).setContent(‘http://www.google.com’);

Otherwise, if you embed you map in an IFRAME or Frame, you might want to set it to:

top.iFrameMap.Fusion.getWidgetById(‘TaskPane’).setContent(‘http://www.google.com’);

02
Feb
10

Wiarton Willie Sees His Shadow

Since Arrow Geomatics Inc. anniversary falls on Groundhog Day (11 years today!), it is only fitting to report that Wiarton, Ontario’s Willie the Albino Groundhog has seen his shadow (6 more weeks of winter).

Wiarton Willie 2010 Sees His Shadow

Wiarton Willie Sees His Shadow 2010

23
Dec
09

Autodesk MapGuide Enterprise 2010 Courseware

Hi, I thought I should post Autodesk’s MapGuide Enterprise Courseware and dataset…

Autodesk MapGuide 2010 Enterprise and Studio Essentials

Autodesk MapGuide 2010 Enterprise and Studio Essentials (data).exe

15
Dec
09

MapGuide Studio 2010 with 64 BIT

I recently found I could not install MapGuide Studio 2010 on 64 BIT.  Then I found a Knowledge Base Article at Autodesk. This mentioned CORFLAGS.exe.   I couldn’t find this anywhere. 

Here is how to install MapGuide Studio 2010.

  1. On the Autodesk MapGuide Enterprise 2010 DVD, browse to the “Autodesk\Autodesk MapGuide Enterprise 2010 Setup\Studio\” folder and double-click on the Setup.msi file.
  2. Download the .NET Framework 2.0 Software Development Kit (SDK) (x64)
  3. Browse to the “C:\Program Files\Microsoft.NET\SDK\v2.0.64bit\Bin\” and copy the CorFlags.exe file.
  4. Paste the CorFlags.exe file into your “C:\Program Files\Autodesk\MapGuideStudio2010\” folder.
  5. Click START >Run, type CMD and click OK.
  6. Using CD,  type CD Program Files (x86)\Autodesk\MapGuideStudio2010
  7. Finally, type: CorFlags Studio.exe /32BIT+

This will enable Autodesk MapGuide Studio 2010 on your 64 bit machine.

whew.