28
Nov
17

Editing SQL Server with MapWindow 5

In the past two posts, we saw how to edit with:

  • AutoCAD Map 3D
  • QGIS
  • ArcMap
  • ArcGIS Pro
  • MapInfo

In this video, we connect to the exact same table in SQL Server and try to edit with MapWindow 5.

Advertisements
24
Nov
17

Bonus SQL Server Spatial editing: MapInfo 16

In a previous post, I demonstrated editing SQL Server Spatial with 2 out of 3 standard GIS Desktop software.  Here is a 4th – MapInfo.

23
Nov
17

Comparison of SQL Server Editing with ArcMap, QGIS and AutoCAD Map 3D

Here is a quick video of me creating a very simple SQL Server table with a Geometry column, and try to edit data in 3 GIS Platforms:

  1. AutoCAD Map 3D 2018
  2. QGIS 2.18.14
  3. ArcMap 10.5.2

15
Jun
17

Magic of WKT (Well Known Text)

It’s been a long, long while since I posted anything, but I have been anything but idle.

I have been porting a lot of GIS Applications from Oracle Spatial to SQL Server Spatial. This is true for the Oracle OSE and the Topobase customers lately.

Typically Oracle 11g to Microsoft SQL Server 2014 is the migration path I have been following.

My first reaction is always to create a Safe Software FME batch file to do the translation but sometimes I like to do it the hard way.

I wanted a live view in SQL Server to look at the Oracle tables.  Normally very easy with a “Linked Server” in SQL Server.

linked

But, try doing this with Oracle’s SDO_GEOM datatype (NOT!).

Until I found the magic of Well Known Text (WKT).  This is a common Geometry standard that is shared between both SQL and Oracle.  It looks something like this:

POLYGON ((632995.706198033 6925343.8592000678, 632951.17949780729 6925366.6051015854, 632922.04199836869 6925309.5665011816, 632966.56860080548 6925286.8205018751, 632995.706198033 6925343.8592000678))

Now during the query to Oracle, I can ask for the SDO_GEOM column like this:

select SDO_UTIL.TO_WKBGEOMETRY(geom)  as wkt_geom from Parcels;

If I want to see that data in SQL Server, can query the linked server:

select geometry::STGeomFromText(wkt_geom, 26911) from [linked_oracle].gis_prod.Parcels;

NOTE: 26911 is UTM coordinate system.

So this little magic lets me go dynamically from Oracle to SQL Server without static translation.

Worth the wait I hope!

 

 

 

01
Aug
16

Paper Map to the rescue

Recently, on a road trip from my home in Guelph, I headed out on a road trip to Princeton New Jersey.

I was using Google Maps on my phone, but the power drained in my Moto G despite being plugged in.

I was map-less!

So, in the middle of Pennsylvania I stopped at the first gas station, no maps.  Went another 50km – no maps at that gas station either.  5 stations later I finally found a map – really small scale of North Eastern States.

So from now on, when the lights go out, I am always going to have a paper version of the map.

Like the boyscout motto: “Be Prepared”

13
May
16

ESRI Personal GeoDatabase in AutoCAD Map 3D 2017

The ESRI Personal GeoDatabase is an Access Database that contains spatial data.  If you want to quickly view this data you can add the OSGEO FDO Provider for OGR.

First download the OGR Provider from
http://download.osgeo.org/fdo/4.0.0/release/adsk/M040/binaries/win64/fdoogr-win64-4.0.0_4001.tar.gz

Copy the OGRProvider.dll into the C:\Program Files\Autodesk\AutoCAD 2017\Map\bin\FDO\ folder.

Within the same folder, open the Providers.xml in Notepad.

Add the following XML code:

<FeatureProvider>
<Name>OSGeo.OGR.4.0</Name>
<DisplayName>OSGeo FDO Provider for OGR </DisplayName>
<Description>Read/write access to spatial and attribute data OGR </Description>
<IsManaged>False</IsManaged>
<Version>4.0.0.0</Version>
<FeatureDataObjectsVersion>4.0.0.0</FeatureDataObjectsVersion>
<LibraryPath>OGRProvider.dll</LibraryPath>
</FeatureProvider>

Next, create an ODBC connection to the Personal GeoDatabase .

In Control Panel > Administrative Tools > ODBC Data Source (64-bit)

odbc

Browse to the Access File and add a new ODBC Connection.

odbc2

Finally, open AutoCAD  Map 3D 2017.

In the Display Manager, click Data > Connect to Data.

Choose Add OGR Connection.

For Connection Name, enter: OGR_<whatever you want>

For Data Source, enter: PGeo:<whatever you named the odbc>

MAP3D2017_OGR

Click Connect.

MAP3D2017_OGR2

Check the OGRSchema and click Add to Map.  All the data from within the Personal Geodatabase will be rendered in AutoCAD Map 3D.

MAP3D2017_OGR3

Since you now have OGR installed, all you have to do for each Personal Geodatabase is to create an ODBC link for each one.

For those who want to use this same Florida Personal Geodatabase, you can download it from:

http://www.dot.state.fl.us/planning/statistics/gis/geo.shtm

 

have fun!

 

 

 

 

18
Nov
15

ArcGIS Rest (MapServer) in MapGuide/Autodesk AIMS

Lately, there has been quite a lot of talk about inter-connectivity of various web-based GISs.  The quickest way to share is to ensure your web server is sharing data with WMS or WFS.

Unfortunately most organizations do not do this.

So I wanted to consume ArcGIS Server Rest services within Autodesk Infrastructure Map Server 2016 (aka MapGuide).  There is no FDO Provider for ArcGIS Rest (not yet anyway – great wishlist item!)

Using the default Sheboygan map data that comes with AIMS/MapGuide I figured I would drop the Soil Map from ArcGIS Online.

http://server.arcgisonline.com/arcgis/rest/services/Specialty/Soil_Survey_Map/MapServer

First, we will use the Flexible Web Layout (Fusion) version of AIMS/MapGuide because it uses OpenLayers 2.13

I will use the SLATE template, so first I have to add ArcGIS Rest functionality to OpenLayers.

You will have to download the arcgisrest.js file and copy it to your folder:
C:\Program Files\Autodesk\Autodesk Infrastructure Web Server Extension 2016\www\fusion\templates\mapguide\slate\

(I am using SLATE for this demo)

In the index.html file in the slate folder, add the following line to attach the arcgisrest.js you downloaded.

< script type="text/javascript" src="arcgisrest.js"></script>

Next we will create a js file called mc_arcgisrest.js that we will attach to the index.html page too.

< script type="text/javascript" src="mg_arcgisrest.js"></script>

The following code will give us a function that will toggle the layer from arcgis server on and off in the current layout:

var loadTimer;
var esriMapService;
var arcrestIsOn=false;

function showArcRestData(arcgisRestURL)
{
var watch = function() {
try {
var mapWidgetId = ‘Map’;
var mapWidget = Fusion.getWidgetById(mapWidgetId);
if (mapWidget && mapWidget.isMapLoaded() && mapWidget.isBusy() == false)
{
clearInterval(loadTimer);
var OL=OpenLayers;
if(arcrestIsOn == false)
{
esriMapService = new OL.Layer.ArcGIS93Rest(“ArcGIS Dynamic MapService”, arcgisRestURL + “/export”, {
transparent:true,
isBaseLayer:false,
srs: “EPSG:3857”,
BBOXSR: “3857”,
IMAGESR: “3857”
});
mapWidget.oMapOL.projection=new OL.Projection(“EPSG:3857”);
mapWidget.oMapOL.displayProjection=new OL.Projection(“EPSG:3857”);

mapWidget.oMapOL.addLayers([esriMapService]);
arcrestIsOn=true;
}
else
{
mapWidget.oMapOL.removeLayer(esriMapService);
arcrestIsOn=false;
}
}
}
catch(e) {
alert(e);
}
};
loadTimer = setInterval(watch, 500);
}

So now you have two js files you add to your index.html page in the SLATE template (I usually put them under the fusionSF.js link:

< script type="text/javascript" src="../../../lib/fusionSF.js"></script>
< script type="text/javascript" src="arcgisrest.js"></script>
< script type="text/javascript" src="mg_arcgisrest.js"></script>

Finally, add a button in your menubar in Autodesk Infrastructure Studio.  I am using the existing Slate Flexible Layout at: Library://Samples/Sheboygan/FlexibleLayouts/Slate.ApplicationDefinition

In the Toolbar (Main Menu) create a new Invoke Script.

AIMS_STUDIO_INVOKESCRIPT_ARCGIS

Notice the script calls:

showArcRestData("http://server.arcgisonline.com/arcgis/rest/services/Specialty/Soil_Survey_Map/MapServer");

Once you add that, click “View In Browser” and try the button.

AIMS_ARCGIS

 

Now you can add any MapServer Rest Service to your MapGuide/AIMS map.

 




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