Archive Page 6

06
Sep
10

FOSS4G Barcelona 2010 – Day 1 – GeoServer Workshop

Today I attended a workshop at the FOSS4G at the Facultat d’Informàtica de Barcelona (FIB) in the Universitat Politècnica de Catalunya.  As always I arrived by my BikeFriday (whew it’s hot here but Barcelona is by far the best city I have every cycled in).

The GeoServer Workshop was hosted by Andrea Aime and Mike Pumphrey both of OpenGeo.

GeoServer Logo

We installed the OpenGeo Suite and it was a cinch.  We loaded SHP data through single file path, whole directory of SHP and with an Import Tool.  This just points the server to an existing folder on the server, it does not move data from your PC up to the Server although the GeoServer is completely administered and authored with a web interface.

I really like the ease of use and the ability to connect to data (mainly SHP, PostGIS and WFS – Vector) and various Raster/GRID formats.  I noticed on the GeoServer site that there are some more extensions such as Oracle and SQL Server 2008,  I would like to try that soon.

Now there is something that did disturb me a little, it was the stylization.  It is completely based on the OGC Styled Layer Descriptor (SLD) .  Basically XML.  The same issue is with MapGuide Point Style where you have to tweak away in XML to get it look the way you want (yucky).  I was glad to see that there is an application within the GeoServer called “Styler” that is a Rest Extension for GeoServer (GeoExt) and it comes built-in with the OpenGeo Suite…which is why when I installed GeoServer on my MacBook Pro it does not have the Styler available.  (this is an 80% solution but it beats whacking around in XML to make a cartographically pleasing map).

The layers were previewed with a default OpenLayers interface, and then with Google Earth.  This was really interesting as I learned that with a simple URL parameter, GeoServer can out put the map or layer as many types of data to the client.  For example, the url:

http://localhost:8080/geoserver/wms/kml?layers=barcelona:street

will return streets as KML into Google Earth.

For WFS you could even request a zipped shapefile!

&outputFormat=shape-zip

pretty cool!

I am really used to MapGuide so my only question in the class was how to I tag each feature with a URL derived by the column and some other text.  One other attendee suggested first I would have to build the URL in the database (what if I am using SHP?), but there was no real answer, I think the recommendation was to use the ImageMap extension for GeoServer but I am not sure how to make it dynamic for any layer.  Perhaps an OpenLayers tooltip?..

I can’t wait to see what happens tomorrow..

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”&gt;

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&#8217;);

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&#8217;);

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




Gordon Luckett

Unknown's avatar

Arrow Geomatics Inc's Gordon Luckett

Contact

gordon dot luckett at arrowgeo dot com 1-519-837-9500 (Arrow Geomatics Inc.)

Checkout MapGuide Guy’s Youtube Channel


Design a site like this with WordPress.com
Get started