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
Advertisements

19 Responses to “Fastest Redline Functionality in MapGuide!”


  1. March 10, 2010 at 3:51 pm

    Just a quick note: if you want to move the Zoom Slider out of the way, open the JXTHEME.css in the same folder as the index.htm. Search for #Navigator and change to top to a higer number:

    #Navigator{position:absolute;right:10px;top:50px;

    For example…

  2. 2 Eric
    March 23, 2010 at 8:08 am

    Nice thread
    Can the redline feature be saved/ uploaded to database/ file for doing post-processing? Thanks

  3. March 23, 2010 at 1:06 pm

    It could if you do one of two things:
    1. Convince the MapGuide osgeo community (or Autodesk) to implement WFS-T (Transaction) so the features can be easily saved back.
    2. Build a tool to harvest the coordinates of the drawn feature and send it to be stored. I like to post the Coordinates to Oracle and create Oracle Spatial objects myself.

  4. 4 Ken C
    June 30, 2010 at 11:42 pm

    Thx gord…good post…I’m going to give this a try.

  5. March 29, 2011 at 8:45 am

    Hey This is not working on machine gives error
    Fusion Error:
    WARNING: Exception occurred in AJAX callback.
    Message: OpenLayers.Control.ModifyFeature is not a constructor

  6. March 31, 2011 at 1:50 pm

    This might be that the version of OpenLayers is incorrect. Try using 2.8?

  7. April 14, 2011 at 8:26 pm

    I tried using openlayers 2.8 but still gives me same error

  8. April 14, 2011 at 11:29 pm

    Perhaps it’s a permission issue?

  9. April 25, 2011 at 1:04 pm

    Hello,
    I can you tell me details what all you have used because it is not working by any way in both mapguide 2011 and also mapguide open source.

  10. April 25, 2011 at 2:43 pm

    Ok, try this:

    1. Add the following to your default page (i.e. main.hml) – script http://dev.openlayers.org/releases/OpenLayers-2.8/OpenLayers.js
    2. Then change the code to include “top”
      var addOLRedline = function() {
      var mapWidget = Fusion.getWidgetById('Map');
      var map = mapWidget.oMapOL;
      vlayer = new OpenLayers.Layer.Vector("Editable");

      map.addControl(new top.OpenLayers.Control.EditingToolbar(vlayer));
      map.addLayers([vlayer]);
      }

  11. 11 Brian
    November 2, 2011 at 3:16 pm

    I was able to add, but I cannot click on anything. It acts like they are not there…just appear to be non-clickable images I am using opensource 2.2

  12. November 2, 2011 at 11:00 pm

    Yes, its just graphics so you can print or copy the map.

  13. 13 Mahesh Jadhav
    May 3, 2012 at 12:21 pm

    can any body help me for optimal server configuration and bandwidth for mapguide opensource to support 100 users

  14. 15 Mahesh Jadhav
    May 6, 2012 at 6:11 am

    does mapguide opensource 2.2 support scaling like mapguide opensource 1.2

  15. May 6, 2012 at 4:42 pm

    Sure does. I would also trying out MapGuide OS 2.4 now.
    http://trac.osgeo.org/mapguide/wiki/Release/2.4/Notes

  16. 17 Mahesh Jadhav
    May 7, 2012 at 3:56 am

    thank you Gordan for forwarding the link of latest release.

    I tried to scale mapguide opensource 2.2 but was unable to find configuration for multiple mapguide support servers like that in mapguide opensource 1.2 can you please help me.(Site and support mapguide server).

    and thank you very much for the latest release (link).

  17. 18 Miklós
    February 3, 2016 at 11:10 am

    In AIMS 2016 it’s not working at all 😦

  18. February 3, 2016 at 1:38 pm

    It might be the open layers version, it has to match AIMS.
    2.13 I think…


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Gordon Luckett

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

gordonluckett@twitter


%d bloggers like this: