Archive Page 2

15
Jun
15

Oracle Spatial Extension in AutoCAD Map 3D dead and gone

The Oracle Spatial Extension was a tool that enabled AutoCAD Map 3D to push your DWG directly in Oracle.  Your Block Definitions, Block Attributes, Object Data and Link Templates were all maintained in Oracle and you could round trip back and forth from Oracle to DWG and back again with a READ/WRITE button.

MAPOSEREAD

This extension was added in AutoCAD Map 2000- but only for 32bit.
Those days are past, although if you install 32bit version of AutoCAD Map 3D 2015 you might still get it to run.

Yet I doubt you’ve been able to buy a 32bit computer in any store in the past 5 years.

I talk about it in detail in my AUGI post here:   https://www.augi.com/library/highs-and-lows-of-moving-dwg-into-a-database

Luckily there is FDO (Feature Data Objects).  This is a generic data connection tool found in products such as AutoCAD Map 3D, InfraWorks, AutoCAD Civil 3D, Autodesk Infrastructure Map Server AND MapGuide.

You can connect to more than just Oracle such as SDF, SHP, SQL Server Spatial, ArcSDE, and almost anything that Safe Software’s FME can connect to with the FDO Provider for FME (http://www.safe.com/solutions/for-applications/autodesk/autodesk-autocad-map-3d/fme-fdo-provider/)

Now there are a few organizations out there that still store their data in OSE (ask them and they don’t want to move since the DWG round tripping to Oracle and back is so seamless).  But, now we are in the 64bit world, we may have to move forward.

In this document that I wrote for Autodesk a number of years ago, I talk about moving from Oracle OSE to FDO using AutoCAD Map 3D.  The information is still relevant for all those OSE users:

Moving from OSE to FDO with AutoCAD Map 3D

Although the document moves OSE data to Oracle, there is no reason you can’t move OSE data from Oracle to any FDO data source.  I have recently used this technique to move OSE data in Oracle to SQL Server Spatial 2012.

01
Apr
15

Some Of My Courses Available at Lynda.com

autocadmap3d_lynda

AutoCAD Map 3D with SQL Server Spatial

MapGuide Open Source

01
Dec
14

Pre-work for Autodesk University 2014 – Life of a Building Footprint

After arriving in Las Vegas today for the beginning of Autodesk University 2014, I have been reviewing my presentation.
https://events.au.autodesk.com/connect/sessionDetail.ww?SESSION_ID=5030

This class touches on the following products:

  1. AutoCAD Map 3D
  2. Autodesk Raster Design
  3. Autodesk InfraWorks 360
  4. SketchUp
  5. Autodesk Infrastructure Map Server
  6. MapGuide Maestro
  7. Google Earth
  8. mapguide-rest project
  9. Cesium

All this in 90 minutes.

It’s a lot to cover, but it is some of the tools we need to publish data to the web.

There should be a lot more GIS-y things at AU, but AutoCAD Map 3D and Infrastructure Map Server have not had many big functionality increases over the past few years, so they don’t get much press.  They still are used by thousands of users everyday, but the tools you use every day are not considered “sexy”.

Hopefully there will be some big leaps in the products soon  –  like integration with Cesium – or seamless round tripping from DWG to FDO and back (using block rotations, object data, etc) – this was done extremely well with an old Oracle Spatial Extension but doesn’t work with 64bit now.

Fingers crossed.

 

18
Mar
14

Autodesk MapGuide 6.5 Retired But Still Downloadable

Here are the links to download MapGuide 6.5 Service Pack 1 (for now):

MapGuide ActiveX Control

MapGuide Author 6.5

MapGuide Server 6.5

MapGuide SDF Loader 6.5

MapGuide Raster Workshop 6.5

MapGuide Dynamic Authoring Toolkit 6.5

MapGuide Component Toolkit 6.5

 

Use at own risk as these products are no longer supported!  I have been continuing to consult with people to help move them to Autodesk Infrastructure Map Server 2014 or MapGuide Open Source – let me know if you need help migrating.

 

11
Jun
13

Autodesk Infrastructure Map Server – Auto-Zoom On Load

Whether you are using AIMS 2014 or MapGuide OpenSource 2.5, there is a way to automatically zoom and highlight objects.

I will do this demo using FUSION or Flexible Web Layouts.

We want to be able to pass parameters to the template like the following.

http://localhost/mapserver2014/fusion/templates/mapguide/slate/index.html?LAYERNAME=Roads&KEYNAME=ID&KEY=644,684&ISSTRING=1

The parameters are:

  • LAYERNAME
  • KEYNAME
  • KEY
  • ISSTRING

The LAYERNAME is the layer name in the map (i.e. Roads)
The KEYNAME is the column you want to search by (i.e. ID)
The KEY is the comma delimited list of matches (i.e. 644,684)
The ISSTRING flag tells whether the KEYNAME is String or Number.

I am using the SLATE template in MapGuide/AIMS, found in C:\Program Files\Autodesk\Autodesk Infrastructure Web Server Extension 2014\www\fusion\templates\mapguide\slate\index.html

To start the process, we need to trigger a javascript function once the map is loaded, around line 174, add a call to a function called zoomToObject()

var initPanelHandler = function() {
zoomToObject();
if(isTaskPaneRegistered) return;

Next create a zoomToObject() function that will pass all the parameters to a PHP Page to get the selectionXML, (paste this above the var showOverviewMap = function() { line):

function zoomToObject()
{
var mapWidget = Fusion.getMapById('Map');
var SESSION =mapWidget.aMaps[0].getSessionID();
var MAPNAME = mapWidget.aMaps[0].getMapName();

var KEY=getParam('KEY');
var ISSTRING=getParam('ISSTRING');
var KEYNAME=getParam('KEYNAME');
var LAYERNAME=getParam('LAYERNAME');

//The GETSELECTIONXML.php returns the XML of selected features.
var AJAXURL = "/mapserver2014/GETSELECTIONXML.php?MAPNAME=" + MAPNAME;
AJAXURL = AJAXURL + "&SESSION=" + SESSION;
AJAXURL = AJAXURL + "&KEYNAME=" + KEYNAME;
AJAXURL = AJAXURL + "&LAYERNAME=" + LAYERNAME;
AJAXURL = AJAXURL + "&KEY=" + KEY;
AJAXURL = AJAXURL + "&ISSTRING=" + ISSTRING;

var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
mapWidget.setSelection(xmlhttp.responseText, true);
}
}
xmlhttp.open("GET",AJAXURL,true);
xmlhttp.send();

}

we also need the getParam() function to harvest the parameters sent to the page:


function getParam(sname)
{
var params = location.search.substr(location.search.indexOf("?")+1);
var sval = "";
params = params.split("&");
// split param and value into individual pieces
for (var i=0; i<params.length; i++)
{
temp = params[i].split("=");
if ( [temp[0]] == sname ) { sval = temp[1]; }
}
return sval;
}

Finally, the GETSELECTIONXML.php (I put this in the www folder of C:\Program Files\Autodesk\Autodesk Infrastructure Web Server Extension 2014\www\)

<?php

$configFilePath = "C:\Program Files\Autodesk\Autodesk Infrastructure Web Server Extension 2014\www\webconfig.ini";

$session = urldecode($_REQUEST["SESSION"]);
$mapName = urldecode($_REQUEST["MAPNAME"]);

$keyName = urldecode(stripslashes($_REQUEST["KEYNAME"]));
$layerName = urldecode(stripslashes($_REQUEST["LAYERNAME"]));
$isString = urldecode(stripslashes($_REQUEST["ISSTRING"]));

$key = urldecode(stripslashes($_REQUEST["KEY"]));

if($isString == true)
{
$key = $key . ',0';
$key = str_replace(",", "','", $key);
$key = "'" . $key . "'";
}

try

{
MgInitializeWebTier($configFilePath);

$userInfo = new MgUserInformation($session);

$siteConnection = new MgSiteConnection();

$siteConnection->Open($userInfo);

$featureService = $siteConnection->CreateService(2);

$resourceService = $siteConnection->CreateService(0);

$map = new MgMap($siteConnection);

$map->Open($mapName);

$queryOptions = new MgFeatureQueryOptions();

$queryOptions->SetFilter($keyName . " in (" . $key . ")");

$layer = $map->GetLayers()->GetItem($layerName);

$parcelDataResId = new MgResourceIdentifier($layer->GetFeatureSourceId());
$featureClassName = $layer->GetFeatureClassName();

$featureReader = $featureService->SelectFeatures($parcelDataResId, $featureClassName, $queryOptions);

$selection = new MgSelection($map);

$selection->AddFeatures($layer, $featureReader, 0);

$selectionXml = $selection->ToXml();

$selection->Save($resourceService, $map->GetName());

//dump the XML out to a JAVASCRIPT variable

echo $selectionXml;

}

catch (MgException $e)
{

echo $e->GetMessage();

echo $e->GetDetails();

}

?>


That’s it.  It will work with the sample data that comes with MapGuide and AIMS, Sheboygan, or with any map you wish.

This will work with any FUSION application (flexible web layout),  on any version of mapguide.  The only thing you have to change is this line:

$configFilePath = “C:\Program Files\Autodesk\Autodesk Infrastructure Web Server Extension 2014\www\webconfig.ini”;

Just point it to the correct www folder.

ZOOMTOOBJECT_MAPGUIDE

23
Mar
13

Interesting article on mapping Nunavut’s unique place names

http://www.theglobeandmail.com/news/national/audacious-mapping-project-to-tell-nunavuts-story-through-its-place-names/article10252292/

16
Mar
13

Canadian cities ‘hopeful’ about fed. budget pledge for infrastructure

Article from Sat. March 16, 2013 Globe and Mail news section. I’m optimistic the fed’s acknowledgement of underfunding for municipalities will trigger a wave of investment for our crumbling cities.

http://www.theglobeandmail.com/news/politics/canadian-cities-hopeful-about-federal-budgets-new-pledges-for-infrastructure/article9842096/

The first thing that municipalities must do is create a detailed inventory of their infrastructure assets (pipes, hydrants, etc).  This is done with a combination of CAD and Geographic Information Systems.

Creating an inventory is just the first step not a complete system.  Municipalities also need the purchasing, work order and maintenance components to manage their infrastructure.

Systems such as Maintenance Connection, provide GIS/CAD inventory in conjunction with the entire asset management system.

Arrow Geomatics Inc. have teamed up with Maintenance Connection Canada to build a complete package of GIS (inventory) and Asset Management.

Contact:

Gordon Luckett  contact@arrowgeo.com

12
Feb
13

Perils of Monolithic Map Layers

Now there is the ability to add all our layers for your organization in a single map,

does not mean we should.

 Image

The maps we put online tend to have every tool imaginable and every last layer of information any one could ever want.  It may check every box on the requirements for the proposal or project but it is like having a swiss army knife with a thousand tools.  Un-usable.

Monolithic Map Legend  

Solution?

We should start making maps and interfaces customized for various users.  In the same way that some users need an Austin Mini and some need a Peterbuilt Transport Truck, we need to make simpler maps and interfaces based on what the user needs.  Lets stop putting 600 layers in our maps, and choosing the layers for the need.

For example, rather than having a “City Map”, break it down into Business Development map, Utilities Map, Transportation Map, etc.  

Remember, sometimes, the simpler the better:

Mobile Map with Few Layers

You may even find simpler maps (< 10 layers) would be very effective for mobile platforms. 

 

02
Aug
12

SQL Server Spatial in ArcMap 10

In my last post, I showed how to load geospatial data into SQL Server.  I want to continue that post with how to show that data in ArcMap 10. 

We are going to use that same data to render it in ArcMap.

  1. In the File menu, choose Add Data > Add Query Layer.
  2. In the New Query Layer dialog box, click Connections.
  3. In the Manage Connection(s) dialog box, click New.
  4. In the Database Connection dialog box:
    1. For DBMS Client choose sqlserver
    2. For Data Source, enter you SQL Server (i.e. HOGWARTS\SQLEXPRESS)
    3. For Data Base, enter the database name (i.e. WORLD)
    4. For Authentication, choose OS Authentication.
    5. Click OK.
  5. In the Manage Connection(s) dialog box, click OK.
  6. In the New Query Layer dialog box, double click the table that contains the spatial data.
  7. For Name enter the of the query (i.e. Major Highways)
  8. Click Finish.

Unfortunately, this is READ ONLY.  If you want to see how to EDIT this data, stay tuned for the next Post.

30
Jul
12

Two Free Ways to Push Geographic Data in SQL Server

If you own SQL Server 2008 or higher (even the free Express version) you have the essentials of a GIS. 

But how to put GIS data into SQL Server?  I cover 2 simple ways to get data into SQL Server:

  1. SharpGIS’s SQL Server Spatial Tools http://www.sharpgis.net/page/sql-server-2008-spatial-tools.aspx
  2. OGR2OGR as part of the GDAL Suite at http://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries

If you downloads SharpGIS’s tool, you can load a ShapeFile (actually it is series of files such as Road.shp, Road.dbf, Road.idx..) into SQL Server.

 SharpGIS's Shapefile Uploader

In the Configure Dialog dialog box, you need to log into SQL Server, enter the SQL Server name and choose the database.

ShareGIS Shapefile Uploader Configure

If you shapefile has a coordinate system that is projected, such as State Plane or UTM, you should use the Geometry, otherwise choose Geography (Latitude and Longitude).

Also, I recommend not to create the Spatial Index right away as I find this often causes errors during load with this tool.

Leave the default Table Name, Geometry Name and Key Name and click Upload to Database.

To view the data, open the Microsoft SQL Server Management Studio and expand the Databases to your current database.

Right-click On your Table and choose Select Top 1000 Rows to see the SHP you just loaded.

Now, to load the same SHP File, you will have to use the Command Prompt with the OGR2OGR Tool.

To create a BAT or batch file, simply create a text file and save it with a .bat extension.

In the *.bat file, first add the path of the OGR2OGR.exe:

“C:\Program Files\GDAL\ogr2ogr.exe”

Then add the -f MSSQLSpatial switch to import into SQL Server.

Next, add the connection to SQL Server:
“MSSQL:server=HOGWARTS\SQLEXPRESS;database=WORLD;trusted_connection=yes”

Finally, add the path of where the Shapefile is:
 D:\Projects\DMTI\SHP\RAIL75.shp

Full entry:
“C:\Program Files\GDAL\ogr2ogr.exe” -f MSSQLSpatial  “MSSQL:server=HOGWARTS\SQLEXPRESS;database=WORLD;trusted_connection=yes”  D:\Projects\DMTI\SHP\RAIL75.shp

Finally, double-click on the ogr.bat file or whatever you named it, and the SHP file will be loaded into SQL Server.

To view the data, open the Microsoft SQL Server Management Studio and expand the Databases to your current database.

The additional dbo.geometry_columns and dbo.spatial_ref_sys are used by Open Source GISs such as QGIS to determine the spatial data columns and their coordinate system.  QGIS can render the data without these support tables however, so they are not required.




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