Thursday, December 11, 2008

Camels

Well, the final report on the Camel project has officially been released. Here is a link where you can download it. There is a separate report (54) for the stuff I worked on. THis was incorporated into chapter 11 of the main report. Essentially it is a multi-criteria evaluation using weighted linear combination. There is python code in the appendix for performing (modularly) a weighted linear combination, including calculating weights. To calculate the weights you need NumPy.

Google Earth In Marketing

Was in Brisbane last week and noticed a new marketing campaign for Qantas. Here is a picture of one their posters. Map pushpins have been around since the seventies at least, that is according to old cop movies. But I think the notion of a pushpin being put into 3-dimensional space is really influenced by Google Earth. Perhaps I can even coin a term - ge-marketing. :)

Sunday, November 30, 2008

Cool

I do have interests outside of GIS and Geography. One is movies...It's great when the two meet. Here is a really beautiful information visualization of movie revenues for the past 30 years. To me it looks the way oil paint can layer together. Very well made.

Correction Manifold and SQL Server 2008

I misunderstood about Manifold and SQL Server 2008. It sounds like you actually need the Enterprise edition of the product to use the native spatial data type...A point for MapInfo on this one, minus 1 for Manifold....If anyone is keeping a tally.

Saturday, November 29, 2008

Tutorials

My tutorials page is fairly dormant, which I apologize for. I'd like to add to it, but I've been busy. Also, the page is hosted on Google Pages, and it has been announced that Google Pages will be discontinued and migrated to Google Sites. I think having the tutorials on Google Sites will actually be better, but I'm not sure when this "migration" will actually happen. I just hope that I don't lose any of that work...

You've Got the Points - Now What?

So in the last post I showed how I got some points into SQL Server 2008. Not the most elegant bit of code (I'm a dabbler not a developer), but it worked. Now what can you do with it. Besides the many Transact SQL (Microsoft own brand of SQL) methods available for interacting with spatial data (see OGC ones here), you could create your own GeoRSS feed. I'm fairly new to creating RSS feeds, so this might not be exactly correct, but you may find the query useful. The key here is adding a reference to Microsoft.SqlServer.Types. Then you can actually use their geometry type and the methods associated with it to retrieve your results.

This is all in an generic handler (*.ashx). The Imports:

Imports System
Imports System.Web
Imports System.Xml
Imports System.Data
Imports System.Configuration
Imports System.Collections
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.Data.SqlClient
Imports System.Net
Imports System.Threading
Imports Microsoft.VisualBasic
Imports System.IO
Imports Microsoft.SqlServer.Types

And the Class:



Public Class geo_content : Implements IHttpHandler

Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest


context.Response.ClearHeaders()
context.Response.Clear()
context.Response.ContentType = "text/xml"
context.Response.ContentEncoding = System.Text.Encoding.UTF8
context.Response.AddHeader("ContentType", "text/xml; charset=utf-8")

Dim xmlWriter As New XmlTextWriter(context.Response.Output)
xmlWriter.WriteStartDocument()
xmlWriter.WriteStartElement("rss")
xmlWriter.WriteAttributeString("version", "2.0")
'xmlWriter.WriteStartElement("rdf:RDF", "http://www.w3.org/1999/02/22-rdf-syntax-ns#")
'xmlWriter.WriteAttributeString("xmlns", "rdf", Nothing, "http://www.w3.org/1999/02/22-rdf-syntax-ns#")
xmlWriter.WriteAttributeString("xmlns", "geo", Nothing, "http://www.w3.org/2003/01/geo/wgs84_pos#")
xmlWriter.WriteStartElement("channel")
xmlWriter.WriteElementString("title", "geoContentRSS")
xmlWriter.WriteElementString("description", "latitude and longitude from sql server 2008")
xmlWriter.WriteElementString("language", "en-US")

Dim con As SqlConnection = Create_Connection()

If con.State = ConnectionState.Closed Then
con.Open()
End If

Dim geoReader As SqlDataReader = Create_Geo_reader(con)
Try
Dim q As String = """"
If Not IsNothing(geoReader) Then
If geoReader.HasRows Then
Do While geoReader.Read
xmlWriter.WriteStartElement("item")

Dim geom As New SqlGeometry
geom = CType(geoReader("Geom_Data"), SqlGeometry)
Dim lat As Double = CType(geom.STY, Double)
Dim lng As Double = CType(geom.STX, Double)
Dim id As Integer = CType(geoReader("GeoID"), Integer)
Dim name As String = CType(geoReader("Name"), String)

xmlWriter.WriteStartElement("title")
xmlWriter.WriteCData(name)
xmlWriter.WriteEndElement()

xmlWriter.WriteStartElement("description")
xmlWriter.WriteCData(Name)
xmlWriter.WriteEndElement()

xmlWriter.WriteElementString("link", "http://www.boxshapedworld.com")
xmlWriter.WriteElementString("id", id)

xmlWriter.WriteStartElement("source")
xmlWriter.WriteAttributeString("url", "http://www.boxshapedworld.com")
xmlWriter.WriteString(name)
xmlWriter.WriteEndElement()

xmlWriter.WriteElementString("geo:lat", CStr(lat))
xmlWriter.WriteElementString("geo:lng", CStr(lng))

'close item element
xmlWriter.WriteEndElement()
Loop
End If
End If

If con.State = ConnectionState.Open Then
con.Close()
End If

Catch ex As Exception
MsgBox(ex.ToString)
con.Close()
End Try

xmlWriter.WriteEndElement()
xmlWriter.WriteEndElement()
xmlWriter.WriteEndDocument()
xmlWriter.Close()
End Sub

Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
Get
Return False
End Get
End Property

Private Function Create_Connection() As SqlConnection
Try
Dim Connection As New SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings("baseBSWstr").ConnectionString)
Return Connection
Catch ex As Exception
MsgBox(ex.ToString)
Return Nothing
End Try
End Function

Private Function Create_Geo_reader(ByVal Connection As SqlConnection) As SqlDataReader
Dim programReader As SqlDataReader
Dim sqlStatement As String
Dim command As New SqlCommand
Dim dt As New DataTable("geograph_data")


sqlStatement = "SELECT * FROM geograph_data WHERE [GeoID] <> @negGeoID ORDER BY [Name]"


Try
If Connection.State = ConnectionState.Closed Then
Connection.Open()
End If

With command
.CommandText = sqlStatement
.Parameters.AddWithValue("@negGeoID", -9999)
.CommandType = CommandType.Text
.Connection = Connection
End With

programReader = command.ExecuteReader
Return programReader
Catch ex As Exception
MsgBox(ex.ToString)
Connection.Close()
Return Nothing
End Try

End Function
End Class



This starts by creating an xmltextwriter that is set to the context output stream. I add the xml namespace for geo. There is a separate function to create the connection string, and a separate function to create the sqldatareader. In this function you see a simple SELECT statement with parameters for the where value. This is returned and the geoReader starts to cycle through each row. A variable called geom is used to house the geometry, and you can see that it is of a type SqlGeometry. Using this type gave access to the STY and STX methods. Again, not the most elegant bit of code, but it works.

Thursday, November 27, 2008

SQL Server 2008 Express

I've finally gotten a chance to play around with SQL Server 2008 express edition. In case you haven't heard 2008 introduced native spatial support. I'm not sure how the internals store spatial data but you can add geometry (or geography) data types as Well-Known Text or Well-Known Binary. Well-Known Text is pretty easy to understand and work with. It's pretty easy to work with SQL Server using the Management Studio Express Edition. If you have MapInfo 9.5, or Manifold version 8 you can directly connect to express edition and edit geometry that way. I don't think there is support for this in ArcGIS 9.3 without SDE (personal or otherwise) which means you probably need an ArcEditor license. I happened to have an XML file with latitude and longitude locations in it that I used to store locations for a mini (personal) google maps project. Using VB.NET 3.5 I could easily connect to both the xml file and sql server to add the geometry as point locations.

Here is the code that I used. It is server side code, with the connection string stored in the web.config file.


Dim xDoc As New XmlDocument
xDoc.Load(Server.MapPath("cities.xml"))
Dim cNodes As XmlNodeList
cNodes = xDoc.GetElementsByTagName("marker")
Dim i As Integer = 0
Dim con As Data.SqlClient.SqlConnection
con = New Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings _
("baseBSWstr").ConnectionString)
For Each XNode As XmlNode In cNodes
Dim ac As XmlAttributeCollection = XNode.Attributes

Dim lat As Double = CDbl(ac.Item(0).InnerText.ToString)
Dim lng As Double = CDbl(ac.Item(1).InnerText.ToString)
Dim name As String = CStr(ac.Item(2).InnerText.ToString)

con.Open()
Dim cmd As New SqlCommand("INSERT INTO geograph_data
VALUES (" & i & "," & "geometry::STGeomFromText('POINT
(" & lng & " " & lat & ")', 0), '" & name & "')", con)
'cmd.CommandText = "INSERT INTO geograph_data
VALUES (" & i & "," & "geometry::STGeomFromText('POINT
(" & lat & " " & lng & ")', 0), '" & name & "')"
cmd.ExecuteNonQuery()

con.Close()
i += 1

Next


This was just run on my hard drive with a local instance, so I wasn't too concerned about security. From what I understand using parameters is meant to be more secure. Here is an example.

Now if you want to play around with sql server 2008 with just management studio here are some tutorials.
Boston GIS
JasonFollas - this describes the difference between geometry and geography...pretty good series.
Developer Fusion
MSDN

Tuesday, November 25, 2008

Book Recommendation

A colleague let me glance over this book by Chang. I have to say it is one of the better introductory GIS texts I have seen. I've owned a few. The one for my undergrad courses was weak, but in fairness it was one of the least expensive textbooks I had to purchase. Longley et al. produced a nice one as well. I would go with Chang over Longely, though. Chang's book is ESRI-biased, but I think it is of value to everyone. There are a number of worked examples that show how the little black box works, e.g. affine transformations, and ordinary kriging. I'm not talking about point and click, I mean actual mathematics. My colleague also said the section on modeling is excellent, but I didn't look through it in great detail.

Unfortunately the book budget is a little low right now, as I've made a number of purchases recently so I don't own a copy. Speaking of which, I also recommend Bivand et al.'s spatial statistic book for R. This fills a void in Spatial Statistic books that has been growing. Most spatial stat books focus heavily on theoretical, which is fine, but for someone like me that is not in a course there is a lack of worked examples. Waller and Gotway's book is theoretical and has exercises, but now answer key so who knows if I produced the "correct" results....Andy Mitchell's book is a great start, but doesn't go into much depth (doesn't talk much about first and second order effects, doesn't talk about inhomgeneous k-functions, etc...)

Thursday, November 6, 2008

Find values in one table that are missing in another table MapInfo

Took me a little while to find an example of this, so I thought I would add one to the "interweb" to help other people.

One part of MapInfo that is extremely powerful is the SQL functionality. It isn't comprehensive, but there are a number of things you can do with it. Where I'm currently living/working (The Northern Territory) has a number of communities that could have several different names for the same location. This comes from communities named by European settlers in the area, and Indigenous names. Basically, you can have a spreadsheet of data that you want to tie to a geographic location via the name of an organisation, but the spreadsheet names might not necessarily match the database names that have the latitude and longitude. So I want to find out which values in the spreadsheet are "missing" from the database. In other words, which values did not join.

Two Tables: sdss_geography and tutorial_sample_2
Two Columns: sdss_geography.Organisation_Name and tutorial_sample_2.School

The first step is to perform a Join on the two tables. Using Query --> SQL Select

Select Columns: *
From Tables: sdss_geography, Tutorial_Sample_2
Where: sdss_geography.Organisation_Name = Tutorial_Sample_2.School
Ordered By: School
into Table Named: InitialJoin

Next go to File --> Save Query and save the InitialJoin query as a table. Then close the query table and load the InitialJoin.tab table.

Once the table is loaded, go back to Query --> SQL Select.

Select Columns: *
From Tables: Tutorial_Sample_2
Where: not School in (select School from InitialJoin)
Ordered By: School
into Table Named:MissingJoin

Click OK.

This produces a table of missing values. I take this table and make sure the name and spelling matches the central database.

Hopefully that helps someone else.

Monday, November 3, 2008

Does everyone have an API?

Came across this last night when I couldn't sleep (yes I'm even looking at maps at 2am :)).

It started through a great blog called Kelso's Corner. It's a cartography/visualizations oriented blog/website, but he posts examples of some great (mostly interactive) cartography. A lot of them, not surprisingly, come from the New York Times. Newspapers don't always produce the greatest or most appropriate maps, but the NYTimes seems to make the extra effort at doing this (The Economist is another one that does a great job). Anyway, I "discovered" that they have an interactive visualization creator called Visualization lab. They have a number of visualization techniques available for the user to create their own interactive visualization. According to this, it is based on technology from IBM Research. I didn't explore too deeply, so I don't know if the NYTimes site allows you to load your own data, but the Many Eyes does. Honestly, I'm a bit wary of these types of "map your own data" neogeography things. But I think the NYTimes site has done a great job of restricting users so that they make an appropriate map (e.g. a choropleth using derived data instead of raw counts). They are even using a good map projection for their world map data! I'm not too keen on the bubble visualization, because when I see it I expect the countries to be in the right place, so I find it hard to read. I guess I couldn't really find any order to the arrangement (hey I'm a Geographer, I look for spatial patterns automatically). Either way, I thought it was pretty well done, and fast.

Naturally when I see something like the Visualization lab, I immediately think "How can I do that?" Well the NYTimes has made it easier for me to try and make my own. They didn't release the code or anything, but they now have their own data API. One of the first that they have released is the campaign finance api. I believe this would be the same data used for creating this interactive map.

Wednesday, October 29, 2008

Add tickmarks to the horizontal

I needed to add a bunch of tick marks to a line in a layout in ArcGIS. I am not aware of a built-in tool to do this, so I created my own. It is just for the horizontal, but may be modified for the vertical. I made it fairly generic so that the inputs might be automated as well.

It is available here...Hopefully it will help someone.

Sunday, October 26, 2008

Forums

This is off topic...

I've been trolling the technical forums a lot recently while learning more about Windows Presentation Foundation, which I'm using in a little project. I've noticed certain commonalities in all forums that bug me...which I will now list...just giving you enough opportunity to ignore this entry.

For one, certain forums award points to posters. Sometimes this leads to a prize of some sort poster. I suppose this is an incentive to get people to participate. What bugs me is when a poster new or old ends the post with "If this answers your question be sure to mark it as answered." I like the people who don't care about the points and just help answer the question.

I also don't like the posters who berate the question asker...especially if it is obvious English is a second language. It's just uncalled for. On the other hand, I don't like it when with the question asker writes "URGENT!!!!", or when they don't receive a response in an hour post "HELLO? NO ANSWER!!!!??" But I don't think it warrants berating the question asker.

Finally, I don't like the forum lecturers. These are the people that instead of helping or answering questions lecture the question asker or poster about how to post. Kind of like what I'm doing right now...no, no, it's different, really it's different. :)

Basically, I wish every forum could be like CartoTalk where the posters love the topic and helping people, and everyone is polite and friendly. I just don't get why some posters treat the question askers like they are waisting the poster's time. Don't volunteer your time if you're going to be a jerk about it.

Just my 2 cents.

Thursday, October 23, 2008

MapInfo MapCad 9.5

I thought I should post a little more about MapCAD than just "I Couldn't get it to install." If you are using 9.5 you should definitely download MapCAD. It will give you more data editing control than previously, as well as speed up some general data editing tasks.

To add MapInfo MapCad. Go To --> Tool Manager. Click on Add Tool, and navigate to C:\Program Files\AGIS\MapCAD. Then add the MapCAD.mbx. Two new toolbars should be added.

Highlights:
Basic CAD stuff like mirroring and filleting. The Copy Style tool is cool, and can be useful at times. This is a common feature in Word (AutoCAD has one as well).

There are some more sophisticated options such as splitting a polyline (exploding) to different line segments. There is a tool to add nodes at intervals on a segment. The Calculate angle and direction tools will be useful for more precise drawing.

I think the Create Lines and Create Polylines from database are interesting. Seems to be a way to store geographic data without using a spatial object...but with SQL server 2008 express this might not be necessary...

Basically they've added some nice little features that are part of a CAD application.

I found the tools a little cumbersome initially, but it didn't take long to figure them out.
-------------

I've complained about Named Views on here a few times, so with that in mind here is a feeble attempt to produce something "different." This is my first MapBasic Application, so feel free to improve upon it. Basically it adds to options to the Map Menu - Load Saved View and Save View. All it does is write the centre coordinates and zoom to a text file. Nothing fancy, but it might work for you.

For the source code.

For a compiled file (mbx, version 9.5).

Good to know

Just wanted to thank Hampden GIS/IT for a very valuable MapInfo tip. As I've said a few times, I'm not a fan of workspaces, but there is something you can do with a workspace that you can't with any other proprietary program file I've worked with (e.g. *.dwg, *.mxd, *.map). You can open it up in Notepad or WordPad. This is excellent for fixing broken paths (which I'm needing to do right now). It's actually neat to read through it, because it is like reading a program...a LISP or FORTRAN program. Sort of takes me back to working with AutoCAD commandline. Personally, I think commandline is more efficient than searching for icons...This is probably a good workaround to the Named Views problem. Pick a view that works at then use map basic to set it...even copy and paste it into the workspace in Notepad. That's much better than saving it at the application level. In fact to rebuild this workspace, I'm just copying the Map Basic code because it wouldn't load anymore. That's definitely a mark in the plus column for MapInfo.

Still I couldn't resist an experiment. I started a new workspace with one Map Window and one Layout Window. Saved the workspace, then added a piece of text to the layout, closed the layout window and saved as a new workspace. I compared the two in Notepad, and the layout was gone in the second workspace. I was secretly hoping that it just retained all the commands, but of course that really isn't efficient to save all the commands. Oh well, nothing is perfect. In the end, I shouldn't be trying to fit MapInfo into an AutoCAD ArcGIS mold, all three are different programs. It's useful to know the quirks so that I can compensate when using any of the programs.

Tuesday, October 21, 2008

Handy Information

Good demonstration on how to use Representations in ArcGIS to create the ED effect for building footprints...

http://blogs.esri.com/Support/blogs/mappingcenter/archive/2008/10/21/3d-effect-for-a-building-footprints.aspx

Thursday, October 9, 2008

MapInfo Tutorial

I can't help but laugh at this. I'm back in government land putting together a "manual"/"tutorial" for working with MapInfo. There was a copy of version 4.5 floating around with the manuals, so I was flipping through it. It looks exactly the same! And, this was for Windows 95! So I went online and searched for MapInfo tutorials. I didn't see any of the initial hits that were for greater than version 7.5...

On the one hand, MapInfo is like a rock and doesn't change. On the other hand, they haven't fixed fatal flaws with their program (IMHO), like workspaces.

I'll post the tutorial (edited to remove gov' related info) when it is done.

Monday, September 29, 2008

More ArcScene Stuff

So, I spent all that time setting up the repair data source code, and then discovered that by right-clicking on the layer, going to Data --> Repair Data Source, ArcWhatever fixes all the ones that were in the same folder. Same problem with the base heights though.

Now I'm exporting ArcScene scenes to 2d images. I had originally done this on my laptop and got everything setup on there. There were problems exporting the image with background vector data (roads and coastline). The coastline was a polygon and came out with extra lines cutting across the 3d. So my work around was to export the vector and 3d as separate images and then make them as layers in PhotoShop Elements. This works pretty well. Now I'm working on the desktop and discovered that the images don't export the same size. The reason for this is the monitor size and resolution as the export dimensions are determined by this. You can also change the export dimensions by changing the height and width of ArcScene. This is a pain to duplicate, but at least now I know what the problem is.

Repair Datasource

I had a number of ArcScene documents (sxd) with several layers (>20) with a broken source, and I didn't really feel like manually going through each one and repairing it, so I poked around trying to find an example to do it in VBA. Most of the examples were for feature layers, whereas these were all raster layers, and none were for ArcScene. I found one that worked for rasters, but then I lost the renderer and layer name which were both important in the file.

This is the mesh that I came up with. Probably a good idea to save your sxd as something else before running the code. I also needed to close out and open back up before the settings took effect. The base heights disappeared and I'm not sure why this happened but I already had a bit of code to set the base height to the layer because I'm lazy and didn't want to go layer by layer setting the base heights.

Here is the code to set the source:


Private Sub SetSource()
Dim pDoc As ISxDocument: Set pDoc = ThisDocument
Dim pScene As IScene: Set pScene = pDoc.Scene
Dim pSG As ISceneGraph: Set pSG = pScene.SceneGraph
Dim pSV As ISceneViewer: Set pSV = pSG.ActiveViewer
Dim il As Integer
Dim pNewWorkspaceName As IWorkspaceName
Set pNewWorkspaceName = New WorkspaceName
With pNewWorkspaceName
.PathName = "D:\gamblingout"
.WorkspaceFactoryProgID = "esriDataSourcesRaster.RasterWorkspaceFactory.1"
End With

For il = 1 To pScene.layerCount - 1
Dim pLayer As ILayer: Set pLayer = pScene.Layer(il)
Dim pRLayer As IRasterLayer: Set pRLayer = pLayer
Dim pDataLayer2 As IDataLayer2: Set pDataLayer2 = pRLayer
Dim pDatasetName As IDatasetName
Set pDatasetName = pDataLayer2.DataSourceName
Set pDatasetName.WorkspaceName = pNewWorkspaceName
pDataLayer2.DataSourceName = pDatasetName
pDoc.UpdateContents
Next
End Sub


You will probably need to change the start layer, as I had it set as 1 instead of 0.

Here is the code for the base heights.


Public Sub Set3d()
Dim pDoc As ISxDocument: Set pDoc = ThisDocument
Dim pScene As IScene: Set pScene = pDoc.Scene

Dim il As Integer
For il = 1 To pScene.layerCount

Dim pLayer As ILayer: Set pLayer = pScene.Layer(il)
Dim pLayerExt As ILayerExtensions: Set pLayerExt = pLayer
Dim p3dProps As I3DProperties

Dim i As Integer

' look for 3D properties of layer:
For i = 0 To pLayerExt.ExtensionCount - 1
If TypeOf pLayerExt.Extension(i) Is I3DProperties Then
Set p3dProps = pLayerExt.Extension(i)
Exit For
End If
Next
Dim pSurf As IRasterSurface
Dim pBands As IRasterBandCollection
Dim pRasterLayer As IRasterLayer
Set pRasterLayer = pLayer
p3dProps.BaseOption = esriBaseSurface
Set pSurf = New RasterSurface
Set pBands = pRasterLayer.Raster
pSurf.RasterBand = pBands.Item(0)
Set p3dProps.BaseSurface = pSurf
p3dProps.Apply3DProperties pLayer
Next
pDoc.UpdateContents

End Sub


There are no checks to make sure the layer is raster and not a feature layer. This is one area that could be expanded. Since it is for a fairly custom file, I know which layers are what type.

Wednesday, September 17, 2008

Flow Mapping

Getting a head start on a new project that is more cartographic. It will involve mapping migration/flows from Australia to the Northern Territory (probably smaller geographic units than states). I like making maps, and so I'm excited to do some cartography beyond standard ArcGIS layouts. There are different possibilities on how to map this. Initially, I think I will use something like this that creates a more trunk/branch flow map instead of the typical straight line between places (Tobler's Flowmapper). The project lead doesn't like this style too much, but thought the trunk/branch style might work. We might pursue other mapping techniques, which would be cool to try and apply different map techniques to this area...

The Flow Map Layout tool that comes with the article is actually pretty slick, at least when using the supplied examples. Instructions are lacking unfortunately, so I'm not sure how to use multiple root points. The output is nice, and allows for export to an eps file. That could be brought into Adobe Illustrator and edited. Ad ambitious as I can be, I'm thinking of creating something similar for ArcGIS but using a shapefile. This would give a lot of control over the final product. In their tool, you can move things around too...Anyway, there are limits and I'm a control freak.

Camel project finished up as much as that type of project can finish. It's one of those projects that you can keep adding to and making it more sophisticated. It was part of a larger part, but it sounds like this will also be produced as a separate GIS/Model report. See how that goes. It was an interesting and fun project to work on. Good people too.

Tuesday, September 16, 2008

Great Application

I've been traveling a broad, and two days after returning I caught a cold, so I haven't felt much like posting. But, this was too cool to pass up.

http://www.turningthepages.com/

You can look at Mercator's Atlas :).

Saturday, August 16, 2008

More Anti-Geoweb Rhetoric

Ok, like I've said before - I don't see the Geoweb as GIS, but I do see it as part of the same spectrum. Here is more evidence that the Geoweb is not GIS. Just learned about the Google Visualizations API. Sounds pretty cool, and looks like a more advanced API than their Google Charts. Instead of using a URL you actually use Javascript. One of the first examples of a visualization in their gallery is a World Map of Population. Fist off, they call it an "Intensity" map which doesn't make much sense to me. In reality they are creating a choropleth map where color indicates a change in a range of values. For one, this is an inappropriate use of a choropleth map. The numbers should be derived not raw numbers. So instead of population, it should be population density or deaths per 1000 or something like that. Secondly, they do not divulge what type of classification scheme they are using (Jenk's Natural Breaks, Quartile, Equal Interval, etc..) That's particularly important when creating a map of this type, because the type of classification used can create very different maps. So I guess that is my problem with the Geoweb. Making this available to everyone is not necessarily a good thing. More often than not, there will be inappropriate uses. I guess this is probably the same complaint of specialists everywhere. I'm sure statisticians everywhere shudder when I use Excel for basic statistics. I think though, it is even worst when the creators of the GeoWeb like Google are giving inappropriate examples themselves. Its one thing when a user does it wrong, that's out of Google's hands, but when they do it wrong...

Anyway, that's my rant of the day...

Thursday, August 7, 2008

MapInfo 9.5 MapCad

There have been a few comments on the MapInfo 9.5 semi-review I wrote in regards to MapCad. Sounds like I had an installation problem, but I let the trial version expire so I couldn't resolve it. But it sounds like people are using it without problems. I found this page which gives a better description of the MapCad tools. It seems hard to find independent reviews of the new version though. I suppose if you are happy with MapInfo then you will continue to be happy with 9.5, although you might have to break habits to use the new righ-click editing features. If you are unhappy with MapInfo for some of the reasons I am unhappy with it (named views, and workspaces), then MapInfo 9.5 will suffer from the same problems. I am impressed to see the MapCad direction, and have always disliked the GIS software editing environments. This bias comes from my AutoCAD origins. I have never worked in a better editing environment with better snapping tools. Commandline makes it so much easier and faster to call up a particular snapping tool or feature type (polyline, polygon).

Tuesday, August 5, 2008

Amateurs and Professionals Unite

The information business is being transformed by the Internet into the sheer noise of of a hundred million bloggers all simultaneously talking about themselves.
Andrew Keen - Cult of The Amateur

I was led to that quote in a round about manor via Jame's Fee's blog to an entry by Sean Gorman. There is an interesting discussion on the tensions between the Geoweb and the GIS industry (ESRI, MapInfo). In short, the GIS industry apparently considers GIS is what professionals do and the Geoweb is for amateurs. I don't really agree with this, but don't see too much of a problem with the terms used. I do agree that the Geoweb is not GIS, at least not at this point. I see a little danger with people who do not understand fundamentals about maps creating maps, but you get this even with so-called "professionals." Plus, the people, generally speaking, who build the Geoweb do have an understanding. I see GIS and the Geoweb on the same spectrum supplying different services around spatial data, they aren't the same but aren't too different. People who do Geoweb are professionals at Geoweb, and I'm definitely an amateur. I'd like to think of myself as a professional at GIS, and a person who does Geoweb probably would be an amateur at it. Everybody is a little defensive (me too) about their industry, and a little protectionist, for example just tell a Geoweb zealot that it isn't GIS. When I say it, it isn't meant to be an insult. There's just a lot of capabilities that I have in a GIS that isn't there in the Geoweb, just like there is a lot of capabilities that isn't in a GIS. The problem with ESRI is that they want their software to do everything. It's not practical or possible. I agree with James Fee's sentiment about all getting along, after all we are all under the same Geography hat. Sean Gorman had a link to the Cult of The Amateur book which had an excerpt you could read. I found the bits that I read of this book interesting. I don't agree with his points entirely. In the end the web is a bit of a quasi-market, and the users gravitate to the best sites, best blogs, best news organizations that meet their criteria. If a film review blog is filled with boring analysis and misspellings, then it is not going to be popular and not overshadow someone like Roger Ebert. This blog is proof positive that people avoid crap (except for 7-10 people one of which is my Mom). Even Wikipedia has had to tone down their encyclopedia for everyone to edit and now use "experts" to do the writing or monitoring. I do think the inclusion of a comments section on news articles is ridiculous, and although it is sometimes entertaining, they are usually filled with vulgar bigoted remarks. I forgot who's axiom it was about Usenets/newsgroups but if they go on for long enough eventually someone will start to call someone else Hitler or a Nazi. That is perhaps where the Web's greatest enemy lies is the anonymity. Which makes it difficult to tell where certain information comes from, but unlike Keen I'm pretty sure Web 2.0 users can tell that a blog is going to be a form of an OpEd piece, and if you visit the Ford blog you can expect propaganda. I think perhaps the greatest flaw in Keen's argument is that the "quality of public civil discourse" has been declining since before Web 2.0. Personally I point the finger at the political pundits like Rush Limbaugh, Anne Coultour, Michael Moore, Al Franken, and on and on; who leave little room for "civil discourse" and bifurcate an already bifurcated system. Anyway, that's way off topic and probably not the type of info you would read a GIS blog for. So I apologize, but I've typed it and it would take too much effort to remove it.

Wednesday, July 30, 2008

Et Tu ESRI?

Sigh. I'm impressed to see the new effort ESRI is putting in trying to emphasize ArcGIS as a GIS that also can be used as a cartographic product. In the past, maps have seem to be an after thought. In the 1st edition of Getting to Know ArcGIS, one of the projects has the user create a series of beautiful, colorful, thematic maps...without a single legend. What good is that? So when I caught site of the recent MappingCenter Blog entry I was a little dismayed at what they are advertiseing with the photo they have up:

This is a terrible example that they are using. If I'm not mistaken, bodies of water are treated as a single elevation at the water surface (unless showing bathymetric contours), therefore showing contours cutting off at the edge of the water surface is totally inappropriate. These contours should go around the pond not through it!

On a side note. The Mapping center does have some useful information. I really like all the Historic Map symbols they created.

Monday, July 21, 2008

Back

I'm back, which I'm sure is a relief to all 2 of you who read this. We were on a 5 day backpacking trip along the Jatbula trail near Katherine Northern Territory. If you're interested, here is the blog entry on it.

The camel project finished up shortly before the trip. I was a little nervous but it seemed to work out. In the least, it gives some base on which to develop a more robust decision support system for camel management. The difficulty that I ran into was because everything was tied to access (i.e. roads), most of the management plans overlapped. There were ways around it though, for example doing a cost distance surface from the abattoir limited camel regions to how close they were to the abattoir along the road. I actually used the cost distance surfaces most of the time. Instead of using point locations for say boreholes (necessary for transporting the camels because of the amount of water they require) I used those as starting locations for a cost-distance surface and the roads a friction surface. I also used the major roads as a starting place, with tracks and 4wd roads as a friction surface. This created an implicit cost (cost as in the cost of implementing a camel management action) where it was less money to implement the plan on a major road (easier access) than on a track and then of course off road was the most costly. I originally based aerial culling off of roads, but then switched that to community base, which gave a different range....It was an interesting project. Difficult due to the time constraints, though.

Finishing an article based on some school choice analysis I worked on in 2007. Hopefully it will be accepted for a special edition on mapping school choice. I used kernel density estimation to explore some of the changes in distribution across the school district. Also calculated network distances to see how distance from home to school has changed.

Working on another article using kernel density to calculate a segregation index. It is based on the methodology in this article by O'Sullivan and Wong, A Surface-Based Approach to Measuring Spatial Segregation. I'm not entirely sure if this will actually happen, but I'm experimenting a little bit.

Monday, June 30, 2008

MapInfo 9.5 Update

Downloaded and installed the evaluation version. I also downloaded and installed MapCad. Workspaces are still there, so that alone is enough to turn me off. There is some handy right-click context menu functionality in the map browser. Especially for editing. The interface looks essentially the same, and I can't see if they changed anything. On the one hand this is nice, because everything looks the same and makes it easy to learn from one version to the next (can't say this about Autodesk).

I tried to use the MapCad tools but, honestly, couldn't find how to load them. I ran the installer, twice, but nothing happened. I looked in the helpfile for MapCad and it said to go to the Help dropdown and go to MapCad Help. This, of course, did not exist. So again I ask the question, why spend over a 1000$ when you can get the same functionality out of Manifold (plus both the extensions for that amount)? It will supposedly also work with MSSQL 2008 spatial as well.

I didn't bother playing with the .NET features...

Friday, June 27, 2008

MapInfo 9.5

The geoblogosphere seems to be all a twitter (no relation to twitter) with the release of ArcGIS 9.3. I made the mistake of getting my knickers in a twist when 9.2 came out. I installed it wanting to try the new features, but unfortunately I used it to work on some project work when the rest of the office hadn't upgraded from 9.1 (or 9.0 in some cases). That was dumb on my part, so now if I happen to receive a copy, I don't think I'll upgrade till SP1 comes out. Though, sometimes service packs can lead to more headaches as I found with 9.2 sp3 and the loss of some of my python tools in the toolbox...weeeeee!

Anyway, all the talk around 9.3 has overshadowed the pending release of MapInfo 9.5. Its fairly obvious from my posts that I am primarily an ESRI user, and have given a fair share of MapInfo criticism. They must have heard the call (I'm certain I wield such influence), because it sounds like they have made some substantial changes. They are a little behind the times on some things, like the .NET MapBasic features. ESRI has had that for over a year now. I'm not too impressed by having support for MSSQL, because it sounds like everyone will. Although, I bet MapInfo won't require any extra extension to handle it. I am hopeful but very much doubt that there will be direct support in ArcGIS 9.3 without the need for ArcSDE. MapInfo should also add PostGIS support in my opinion. It seems to be gaining some commercial acceptance through Manifold, ArcSDE, zigGIS (also ArcGIS), etc...

I'm downloading an evaluation copy of 9.5. I can't test everything, but I read that they designed the interface with .NET, so I'm hoping it doesn't look like crayon on sandpaper anymore. I also hope they replaced workspaces with something more functional. I'll post my findings here.

Friday, June 20, 2008

Geography of Teeth

Was reading the recent National Geographic Article about stonehenge. They discovered a burial site of a rich neolithic man in the Salisbury plain near Stonehenge. Turns out he was originally from the Southern Alps of Europe, and apparently had migrated to that area...how I'm not sure. But they discovered this information by doing an Isotopic Tooth Analysis. I just thought that was pretty cool that they can determine geography via your teeth. Here are a few articles that might be of interets: here and here.

Wednesday, June 18, 2008

Place...Countries.

I was watching the English Patient the other night. I have to admit, I think it is one of the best movies made...Anyway, you don't search for GIS blogs to here about the writer's favorite movies. I guess I had not seen it since finishing at university, because it never struck me how geographical that movie was. Not in that it was shot in several countries, but in geographical concepts. One of the major themes of the movie is place and identity. Another related theme was with borders, country borders to be specific. I don't think that movie could have been made at any other time than the 90's. Sort of that reshuffling of the deck period between the fall of the Berlin wall and September 11th. The internet and global communication was create a borderless world. The idea of a one world government seemed to have gained momentum. So here you have this movie where the characters defy borders and create their own sense of place, only to have that destroyed by the invasion of ownership of place.

One other part struck me too, was when Juliette Binoche's character is asked if she knows anyone from a dying soldier's hometown. I think it is later in the movie that she questions this action. The desire to see someone from where you come from. This probably interested me more than normal, as I am now living abroad. We just went to a party of Americans living abroad. The only reason for the party was that we were Americans, or spouses and children of Americans. So that was the one connection - you're American. There was even a hierarchical scale to the connection - America --> State --> Close to the same town....It's just funny, because without the concept of place, it's not like we would have ever met or been friends with any of these people, especially in the states. We only had one thing in common. This happened when I traveled too. It's such an easy introduction - WHERE are you from? As if Where defines who you are. I would probably make the argument it does partly define you.

I noticed that Harm de Blij has a new book coming out this winter/summer (july), and I think it will be about this topic. From the product description:

"In recent years a spate of books and articles have argued that the world today is so mobile, so interconnected and so integrated that it is, in one prominent assessment, flat. But as Harm de Blij contends in The Power of Place, geography continues to hold billions of people in an unrelenting grip. We are all born into natural and cultural environments that shape what we become, individually and collectively. From our "mother tongue" to our father's faith, from medical risks to natural hazards, where we start our journey has much to do with our destiny, and thus with our chances of overcoming the obstacles in our way."

I find it to be interesting, but I can only offer anecdotal experience as my view. I also find Geography in the movies to be interesting. A recent AAG newsletter had a short article about this. I think it was just before the Boston Conference, because all the movies were about/took place in Boston.

***********************
Forgot the book came out shortly before the movie, but still in the early 90's. Although similar themes between the book and movie exist, I think the movie had a few of its own. Anyway, here are some articles on the book here and here.

Sunday, June 15, 2008

Projections!!!

There are so many great new cool projects on the web it is hard to keep up. They probably aren't even new, but I just found out about them. Here is an example. But why, with all the new innovations and ideas do people still create these maps using latitude and longitude? The Social Explorer presents this distorted lat and long thematic map, when they should really be using a projection that preserves area. I know technology like Mapserver, and Sharpmap possess the capability to project into a multitude of projections (I believe using PROJ4).

I see with Google Maps why it is necessary to use Lat and Long, because it just makes it easier for Google if people conform to a standard Latitude and Longitude. Projections or the lack there of can greatly influence people's perceptions of the world. Look at the Mercator projection and Greenland. I think this is related to Dr. Parks' talk as well. She says people don't have an understanding of satellites, but they also don't have any understanding of projections.

I can't tell if Google Earth is a culprit of this as well, because I'm not sure if it uses a Geoid or some other "true" representation of the Earth.

Friday, June 13, 2008

Why am I always the last to know?

Apparently the term GIS died...How come I'm always the last to know these things...

:)

And when did GIS just become data and mapping?

Tuesday, June 10, 2008

ArcGIS QuickTip #2

This isn't a quicktip. I've posted a short example on how to use ModelBuilder in ArcGIS to build a more robust tool by adding options to manipulate the Environmental Settings.

http://boxshapedworld.googlepages.com/modelbuildertips

Monday, June 9, 2008

Camel's 'R' Us

I am working on creating scripts to create weighted linear combination. Basically duplicating different features in Idrisi so that I can have two models, one in ArcGIS and Idrisi. This is for the "Camel Project." I have a script now that calculates the weights for a pairwise matrix. Once I found a little information on this topic it was fairly easy to create. It is mostly just multiplying the matrix until the differences between the weights calculated from each iteration equals zero. Unfortunately, the python script is dependent on NumPy (Numerical Python), so it isn't as self-contained as I would like. I didn't feel like writing a function to multiply matrices, although I did this in VB.NET. I also am able to calculate the consistency ratio. I would share the script, but I because I am getting paid to do it, it is up to the client.

I also have managed to use Raster Calculator to duplicate the Fuzzy tool in IDRISI. It is a duplicate of the Linear function, and there are two ways to calculate it. One for monotonically increasing, and the other for monotonically decreasing. The formula is for 0 to 255.
Con is a map algebra function that means conditional. Con(test, true, false).

Here is how it works for monotonically decreasing:

INT((Con([RasterToBeScaled] <> 900, 0,( ((900 - [RasterToBeScaled]) * 255) / 900) + 0))) + .5)

Con([RasterToBeScaled] <> 900, 0 if the cell value is greater than 900 give this cell a value of 0. If it is false then calculate the value
( ((900 - [RasterToBeScaled]) * 255) / 900) + 0)))

INT and +.5 rounds the values properly and removes the decimal places.
The range of this example is from 0 to 900, so you need to change those values depending on what your "maximum and minimum" values are going to be. You really divide 900 - [RasterToBeScaled] by the range (max - min raster values). Since my range was 0 to 900 I skipped this and put 900.

If you need this to increase then you have to change some of it around.
INT((Con([RasterToBeScaled] <> 900, 255,( (([RasterToBeScaled] - 0) * 255) / 900) + 0))) + .5)

Now, whatever is less than zero is zero and greater than 900 is 255. Everything in between is calculated using the formula:
( (([RasterToBeScaled] - 0) * 255) / 900) + 0))
So now we subtract the cell value by the lowest value in your range and everything else is the same.

This is similar, but not quite what I was looking for.

Hope that helps...

Wednesday, June 4, 2008

Python QuickTip

I'm not much of a Python user. I don't care for the syntax (probably because I don't use it enough). It took me forever to find where I could read the input list from a toolbox in ArcGIS...i.e. a multivalue parameter.

Here is the help file that I found. Look under the Using a multivalue input in a script section.

Another problem I have with Python mostly comes from ArcGIS, which is the only time I ever use Python. Well, most of programming revolves around Spatial Software in some way. Everytime I try and do something with the geoprocessing scripts, I seem to run into a bug. I wrote a script once that exported coverages from all the featureclasses in a workspace. This script stopped to function from the toolbox with service pack 3 (9.2). I think this is working again with service pack 4. Also, apparently the reset method on a lot of the cursors do not work, so forget about reusing a cursor. Seems like every time I need to write a little geoprocessing script I need to try and figure out a workaround because I find another problem. Granted though, I've had some success too.

On a completely different note:

I was also updating my Antivirus and saw that one way to help them was add a link to their site. I use the ClamWin open source antivirus program. I've probably used it for maybe a year, and have been happy with it. It isn't the beast of a software that Norton is. I can only vouch for it on a personal computer, so I don't know how it would work at an "enterprise" level. I haven't had any viruses, but then again, I didn't have any before I installed it either...knock on cyber wood.

Tuesday, June 3, 2008

New Media

I've noticed this topic in a few blogs recently, sparked by a presentation given at Where 2.0 this year by Dr. Lisa Parks. I did not attend this conference or see the presentation, so all my information is second hand. I think this is an interesting topic, repositioning GIS as not a tool but as media, or a form of communication. Her topic revolved much more around Satellites and the lack of public knowledge or information about satellites (metadata). Here is a transcript and notes on the presentation. There has been varied reactions, some quite critical. Personally, I think the criticisms are coming from the pragmatic or post-positivist stance so commonly found in the GIS as tool perspective. I don't want to put words in her mouth, but my interpretation of her presentation is that the GIS (Geospatial, neogeography, etc...) community needs to recognize that satellites are not impersonal objective eyes in the world. They serve a purpose, their lens' are not focused arbitrarily on the world, but pointed at places, for profit in most cases. I think this is a perfectly ok stance to take. I think that it is good to leave aside the notion that GIS is an objective tool and recognize it as a communication devise that serves a purpose. Not only that, but that the information stored in a database is inherently unobjective as well. We have the notion that raw data is objective, but regardless that data is stored in a format that was "invented" and the structure of the data "invented." Right off the bat, there is a western bias to the structure of the data, because it revolves around western thinking. The primitive geometric structures of a GIS are western biased and evolved from the western cartographic tradition. I'm not criticizing the formats, just recognizing the problem.

Obviously, communication can be twisted (see How to Lie with Maps). I think it is even easier to lie with satellite imagery. If a satellite image is shown in a presentation and you are told it is of a certain location at a certain time, you just have to accept or not accept that as the truth.

The link above was mostly critical of her critique of the Darfur project. Again, following my explanation, then the point is that the unbiased imagery begins to serve a biased purpose (or second biased purpose if you count the original acquisition), that of stopping the Darfur crisis. I'm not arguing against or criticizing the Darfur project, but recognizing that there is a goal behind showing the geographic information...

Anyway, when it comes to working in GIS, I use it as a tool, and I'm very much a pragmatic post-positivist (if I may mix epistemologies). I wouldn't be surprised if we start to see more conversations like this popping up, especially with more and more geographic information becoming readily available, and programs like Google Earth gaining in popularity...

PDF and ESRI

This has been blogged by several people already (Spatially Adjusted and Fantom Planet to name a few). It sounds like it will be pretty cool in theory. A spatial pdf direct from ArcGIS 9.3. Maybe now I'll stop getting those stupid GeoPDF spam mails.

Sunday, June 1, 2008

Programming Tutorials Update

I've managed to do 7 lessons so far, and am working on the 8th. I used to be pretty good at taking ideas and writing it in plain English, but I realized that the more you learn about a topic the harder it becomes not to use the custom terminology. I'm trying to do my best to keep the lessons in plain English. We'll see how that goes.

I hope to do a lesson every couple of days. Starting with lesson 8, there will probably be a total of 2 or 3 lessons that build a little project.

Hope you enjoy.

Wednesday, May 28, 2008

Programming Tutorials

I am creating a series of lessons to teach GIS Programming in an ArcGIS Environment.

Please visit the site here.

Please post your comments about the lessons at this post.

Hope you enjoy.





http://www.boxshapedworld.com/tutorials/ArcGIS%20Programming%20TOC.ashx

Read the Fine Print

Still doing KML Google Earth stuff. I'm working on a tool that generates kml/kmz files from an Excel file, and you can set it up to do some classifications including color, etc...I kept coming across that the legend I was creating in .NET (using GDI+) was not the same colors as the symbols. These were simple icons, testing using the paddle icon. Could not figure out why I was getting different colors, until I revisited the KML reference and actually read the whole paragraph regarding color. I had only read the alpha part to set transparency. Unlike the rest of the world (including Google Maps, and Google Charts APIs), KML color is Blue Green Red, not the typical Red Green Blue. I guess the fault, or annoyance, really lies with Keyhole. Not difficult, just needed to rearrange the values.

Thursday, May 15, 2008

Quick Tip #1

Here's a quick tip that I learned today. In ArcMap 9.2, instead of using copy and paste. While moving a label at the same time press the ctrl button. Release the mouse button, then the control button and the label is copied to the new location.

Wednesday, May 7, 2008

The Anarchist's Cookbook to MapInfo

*Edit*
There have been a number of posts about working with MapInfo. You may also be interested in them.
*End Edit*

Let's get one thing straight - I hate working with MapInfo. I know a lot of people love it. At least one person has said, "I used to work with ArcView, and then I tried MapInfo and never switched back." I can understand this if maybe you worked with ArcView 3.2 (which I hate working with too), but the newer version of ArcGIS is a different program. At some point, as a software company, you have to wake up and stop building on top of your legacy programs. AutoCAD has done this(at least twice), ESRI did this, Microsoft does this annoyingly (office 2007). Yes this creates bugs and in some cases a slightly less stable program, but the capabilities and improvements, in my opinion, outway the negatives. Now, there are good ways and bad ways to handle this. Autodesk handled it well, simultaneously releasing versions of their old land desktop and new civil 3d. Increasing the stability of civil 3D with each release, and eventually phasing out the old product. The temptation is not to learn the new product because it is easier to work in the old product. Microsoft handles this badly, because they just give you something new and different. I've heard it estimated it takes at least a full month of using the new version of office regularly in order to get back to your level. If you are in a workplace, when do you have time? I'm sure ESRI didn't phase well, but this was before my time. My main question is why would anyone pay 3000$ for MapInfo when you get essentially the same product for 300$ with Manifold GIS (complete with its own annoyances)?

I will add this caveat though - I come from an AutoCAD ArcGIS background. Obviously I am biased, and I'm probably trying to force Arc methods on MapInfo tools. So if my tips point to something I'm doing wrong, hopefully I will be corrected. I appreciate any additions, corrections, complaints. I've spent enough time ranting, time to move onto some tips. My focus is on Layouts, Maps, and Labels.

1. Use workspaces. You are forced to use workspaces, so might as well use what you are given. Save often, too. This is a no brainer, but it was a struggle for me to get over how crappy workspaces are. Be sure to close all tables before opening another workspace, or you'll merge two workspaces together. Workspaces are not like a drawing in AutoCAD, or a Map in Manifold, or an Mxd in Arc; these are static saves of your "project". A workspace is the closest thing to a project MapInfo offers. If you happen to close a layout, or a Map Browser without saving a workspace, then you have lost this information. That doesn't happen in other "normal" software. If you couldn't tell, I've made this mistake several times.

2. Add the named views tool to your program (Tools --> Tool Manager --> Named Views), and use it. Let me explain what I mean by views: a view on a layout is a frame that looks out onto your world. In most cases the view looks out onto a Map Browser. If you don't use named views, then it is difficult to maintain the same view in a frame on a layout. As soon as you zoom or pan in a map browser, this changes the associated views in your layout. To get back to where you were there is previous zoom, but that is lost if you move 2X. A named view is really your only way (as far as I can tell) to retrieve a view. Named Views would be similar to a bookmark in ArcGIS, or a view in Manifold. There is no need for views in AutoCAD because it is intelligent enough to remember your view regardless of what you do in modelspace (data view, map browser). I wish GIS systems would do this as well, but they don't.
The main problem with named views is a view is saved at the program level. This means it is not saved in the workspace. Also, it is only saved at the program level if you shutdown properly. If your MapInfo crashes, all the named views are lost since your last shutdown, even if you've saved your workspace. If you have two versions of MapInfo open, named views from the first program you shut down are lost. If someone opens up a workspace, they will need to create their own views. Please Please someone tell me I'm an idiot, and there actually is something better than this! (or just tell me I'm an idiot if you prefer, but I'd prefer something more constructive).

3. Layouts and views. This isn't a tip, but a warning. You can't double click on a view and access the map browser. This is just an irritation if you've used Arc or CAD. You just need to switch back to the map browser. It's a slight loss of productivity, but doesn't matter to much.

4. Labeling is pretty good in MapInfo. It's sort of a combination of automatic labeling and manual labeling. That really makes labeling fairly easy, because you can turn the labels on, and then move them around. The nice thing is they don't loose their associativity with the layer, so you can turn them off. You can also change the style en masse too, which is handy. When moving labels, it behoves you to first set up your layout and views(frames) with a chosen scale. This, of course, changes your map browser scale. Create a named view in this map browser view, so you can get back to it later. Then change the map browser scale to the same as the layout view scale. Now move the labels. Go back to the named view when done, and check out the results in the layout. If you don't do this, and edit the labels with the named view scale, they will suffer from "5 year old needing to pee" syndrome and will bounce all over the place. This syndrome also happens in Arc on occasion (in particular with the dynamic scale bar in layout view). Here is an example. Add a frame to a layout and select a map browser. This is your view of the map browser. When you double-click on the frame/view, you can set the scale (1 cm = 20 km). When you go to your map browser, the scale will be set as 1cm = 11km (or something like that). Save the named view, then change the scale to 1cm = 20km. Move the labels. Go back to the saved view (this changes the scale back to 1cm = 11km). The labels should look correct on the layout view.

If you're not confused, then I haven't done my job.

Wednesday, April 30, 2008

Google Earth and Charts Tutorial Part 2

Thanks to an anonymous poster below it was brought to my attention that the chart in the description info window does not load in Google Earth 4.3. At first I thought it was just a very slow load time, but then it doesn't ever load. After some experimenting, I discovered for some reason when I add the labels to the chart, the image never loads. If I remove the following line from the url then it loads fine: &chl=MaleFemale. I haven't the slightest idea why it does this, and afterall GE 4.3 is still in beta (what of Google's isn't still in beta?)



If you want to see this in action, create an empty text file with .kml instead of .txt for the extension. Paste the following kml in the file and then save it. The image shouldn't load in the info window. Then remove the &chl=MaleFemale, and save. Now the image should load.



<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Placemark>
<name>080690013023044</name>
<description><![CDATA[<img src="http://chart.apis.google.com/chart?chs=250x100&chd=t:59,41&cht=p3&chf=bg,s,65432100&chl=Male|Female"> ]]></description>
<Style>
<IconStyle>
<Icon>
<href>http://chart.apis.google.com/chart?chs=250x100&chd=t:59,41&cht=p3&chf=bg,s,65432100</href>
</Icon>
</IconStyle>
</Style>
<Point>
<coordinates>-105.040382,40.615846,0</coordinates>
</Point>
</Placemark>
</kml>

Tuesday, April 29, 2008

“Trust in Allah, but tie your camel”

I was doing some AJAX today, trying to dynamically load markers from points stored in a geodatabase. Basically, just an XML response formatted specifically for my data, and parsed using Javascript. It works, surprisingly given my programming skills :). Anyway, probably wouldn't have gotten finished if it weren't for FireBug. A handy little Javascript debugger that lets me know when I have errors in my code. I use Visual Web Developer express for ASP.NET programming, and the 2005 version doesn't really have anything like this for Javascript (I think I read version 2008 does). FireBug works with Mozilla Firefox, but I think there is an alternative version for Internet Explorer. Be sure to disable FireBug when not debugging because it will report errors on any website, and slows down Gmail...

So I've started work on another project. I am a little unsure of confidentiality, so I won't list all that are involved. I'm sure the project will be made public, or at least the publication will be. It probably wouldn't be too difficult to guess who this work is for if you are in Australia. I'll be modeling camel management plans...while it is tempting (and easier) to just turn in a set of photographs of myself shooting camels, I'm of course referring to GIS-based models. Since the turn around time on this is pretty quick (2 months!), the model is a fairly simple Multi-Criteria Evaluation. I'm planning on using IDRISI (Andes?) to do this, but in the back of my head I'm thinking of writing a plug in for MapWindow. Two months isn't long, and IDRISI has a number of built-in tools for performing a Multi-Criteria Evaluation, as well processing rasters (distance surfaces, friction surfaces, etc...). The reason I want an open source solution is to create a user interface that could be used by anybody. That way a land manager could come in, and given a set of criteria (most-likely predefined), they could spit out a map showing potential locations for different camel management plans.

As idyllic as camels look in the Australian desert, they aren't native species. They were brought in as pack animals, and in many cases the train routes and road routes actually follow the same route as the old camel trains. Now their population is approaching one million, and they can be quite destructive to infrastructure, and biodiversity (or vice versa). Probably the unique part of this model is it is trying to identify locations for management plans based on a perspective, and also including perspectives in the model. Obviously, when a question is asked it comes from a certain perspective, and to answer that question certain criteria will be relevant. On top of that, there will be a layer that explicitly shows where certain management plans cannot be implemented based on the community, land owner, etc... This will most like be a constraint factor...but also could be a distance surface I suppose...Have to think about that one.

I'll keep you up-to-date on it.

Friday, April 25, 2008

GIS Recognition

I recently moved to Australia a few months ago, from the United States. My goal was always to continue in my GIS career, but in case that wouldn't be practical I was prepared to go another route (like work in a bookstore). Luckily, though, finding GIS work has not been a problem.

Of course finding work in Darwin isn't that difficult. If you can't find a job here, you're not looking, or you don't actually want one. Actually, you probably don't even need to look, and a job will fall into your lap. This probably refers mostly to "skilled" labor.

I'm sure the job market has something to do with all my new found work, but I think there is a deeper issue going on. I believe that Australians are more open to the spatial side of life. Spatial awareness seems to be much more prevalent here. Even on the bus the other night, I overheard a mobile phone conversation (not that you cannot overhear someone talking on their phone in public) and he said, "Do you want me to do a presentation on the geographic study?" In the states, I felt I constantly had to insist on the value of GIS and Geography. Here it is more like: "Oh, you do GIS, would like a job?"; instead of "You study rocks?[glassy eye look]" It just seems that Australians are already thinking spatially. I've worked for a company where I tried to implement GIS, and it was a struggle (despite already using CAD extensively). Actually, it really never happened. Then I've worked for a company where GIS was already established, and continued to invade every aspect of the firm's services. Once GIS is there, then it is there to stay. In the least, most everyone in Australia has heard of GIS, if they are not able to explain it, and are definitely open to the value of maps. Some people are skeptical though. As in one case, I was told that it is silly Google Earth (I believe "flashy technology" was used) is the motivator for data collection initiatives. In other words, this flashy technology was what they were using to push for more data. I resisted the urge to state that this person had just slapped an entire industry in the face by calling GE and GIS by extension "flashy technology", and calmly explained that the true value lies in the capability to analyze and display said data geographically. I asked, "Wouldn't it be useful to consolidate thousands of pages of financial data and display it on a map, where one can quickly identify where the resources are and are not?" There is probably a paper in there somewhere about the impact GIS has had on policy and policy/makers.


I think Australia, and probably all of the commonwealth, gives geography a higher place in education than Geography has in the United States. Let's face it, we Americans really aren't geographic people. The Geographic Literacy survey shows that. I think the downfall of Geography is well documented in the American Geography community. From the loss of Geography in Ivy League Universities to the advent of social studies, Geography lost its ground in the 20th century. Take a look at Why Geography Matters for a good read. It's coming back though; the American Association of Geographers is reporting record membership and conference attendance numbers, Harvard has even made steps to reintroduce Geography. I'm sure we all know that this is partially due to the Google Maps and Google Earths. These technology have made Geography extremely accessible.

Moving too Australia has definitely been a good career move for me.

Thursday, April 10, 2008

Multi-What?

I was tasked with creating a Google Earth file for a presentation. The main goal was to demonstrate change in enrolment from one year to the next (two years). I can't go into data specifics due to confidentiality. There were a handful of variables they wanted to show, mainly enrolment, and indigeneity (indigenous status), at two scales (cluster (similar to school district in scale), and individual school). If you try to approach this traditionally, cartographically speaking, who knows how many maps you would end up with. Some sort of bivariate or multivariate symbol would probably have to be created. With GE though, there are different possibilities. The obvious benefit is being able to show data at multiple scales using regions. This allows the presenter to zoom into specific areas of interest and as you get closer, the cluster symbols disappear and schools pop up. To show change, I used the timespan tag and GE's animation capabilities. Basically, I used the total enrolment as the altitude and animated between the two years. So you could see the rise and fall of the points in "3D." I also had the symbol set to different colors indicating positive, negative, or no change. Essentially, I took the route of "dynamic multivariate symbols" (I'm citing myself, b/c I think I just made that term up :)). This obviously wouldn't have been possible without Google Earth. Then again, this wouldn't have been possible without modern-day presentation technology.

Well, I think I'm off Google Earth for a while. I was focused pretty heavily on it for this presentation. In my spare time I'm working on a Box Shaped World tool set. The focus is mostly on tools that I need, weighing heavily on spatial statistics. I have a Ripley's K that is functioning quite well, and I think I've got a basic kernel density tool built. All the tools are built in VB.NET, for MapWindow 4.4 (and presumably 4.5 when that is released). I chose MapWindow for my project for a variety of reasons: supports .NET (the only programming language I know), has an editing environment for shapefiles (unfortunately it only supports shapefiles for vectors, but shapefiles are a universal format), extensive raster/grid support, and an apparent plan for future directions. Plus it is free! My tools will be free as well, but I don't think I'll release source code, at least not initially. I thought about sharpmap, but didn't go with it. I like sharpmap and hope it continues along its path. I didn't want to program a GIS interface, and there isn't much editing support from what I could gather. I guess (this may or may not be true) my impression is the MapWindow folk seemed to have it a little more together, but I'm not involved in the development process and I appreciate their efforts and time. Sharpmap seems to be completely volunteer based, too, where MapWindow is University based...Again, I like sharpmap and hope to use it in the future. Anyway, my tools will advance as I have time for them...

Wednesday, April 9, 2008

Google Earth and Charts Tutorial

This isn't really a tutorial in the proper sense of the term, but just a posted example of using a combination of KML, NetworkLink, ASP.NET generic handler (ashx), and Google Charts to create a dynamic symbolized map for Google Earth.

I started by downloading some 2000 census data in census block format, along with SF1 data, from ESRI's free download area. Then I brought it into Manifold selecting just a few census blocks for all of Fort Collins, Colorado, and created their inner centroids. I filtered some of the data that had 0 population from the SF1 table. Clearly, when/if you open this up you will find that I should have weeded a few more points, but on the other hand it shows how quick this runs. My server is pretty slow, and I tested this on a wireless internet connection that didn't have a very strong connection (plus I was streaming both Google Earth and some music). In Manifold, I related the two tables and exported it back out to a shapefile. On export I added two columns for lat and long.

In Visual Web Developer Express I created a generic handler (ashx). Instead of going into each line of code, I'll just summariz(s)e. Below is a link to a zip file where you can download both the KML file and the ASHX file. I used Sharpmap 0.9 to connect to the shapefile and read the table's contents. I just took the percentage of Males and Females (number of males / population, number of females / population) for my working statistic (truly groundbreaking stuff :)). You can see from the code that it basically just writes out the KML file, creating a Google Chart api url as it goes.

You can view the final product by opening this KML file in Google Earth. This KML file contains very little KML, and basically just has a Networklink back to the address of the handler.

If you want the files used, they are available here.

As always, any suggestions, comments, questions are much appreciated.

Here are some other examples I've found:
http://googlemapsapi.blogspot.com/2007/12/using-chart-api-in-kml-for-quick-data.html
http://www.barnabu.co.uk/interactive-spiders-and-charts/

EDIT:
Just noticed the Thematic Mapping Blog also has a post on using charts in Google Earth. Here is the link: http://blog.thematicmapping.org/2008/04/using-google-charts-with-kml.html
or with open layers http://blog.thematicmapping.org/2008/04/openlayers-and-google-chart-mashup.html

Tuesday, April 8, 2008

More Fun With Goolge Earth

This is a bit of a continuation with the previous blog entry. Instead of using the networklink I wanted to create something dynamic but portable. So basically, it consists of the same process of generating a kml file and images of pie charts, only this time the kml isn't written as a response but to the server. Then the whole folder is zipped up to a kmz including all the images. To do the zipping I used an opensource solution called #ziplib (sharpziplib) which worked very easily and only required a few lines of code (below).

Of course I'm not the first or last person to do this dynamic kmz creation with ASP.NET, and a brief search will produce essentially the same process using #ziplib. Although, I don't think many people or dynamically creating graphs at the same time (could be wrong, if so please correct). I really want to use Google charts to do this, because they have some nice looking charts, but due to some proxy server issues this became more hastle than it was worth. I think if I do a tutorial or something, I would use Google charts instead. Again this has probably been done somewhere.

Here is a fix to a problem I was running into. You need to set the size of the file before adding it as an entry: http://community.sharpdevelop.net/forums/p/6986/19897.aspx#19897

On a side note. I keep delving more and more into programming. I do think it is a necessity. I can handle working with vb.net, vba, javascript, and python. Definitely more of dabler than developer. I keep telling myself that I should start to learn C# to take things to a more advanced level. A lot of these language structures look similar to c#: javascript, python, java, j#, etc. At least to me anyway. But what can I say - I love VB. As I've read elsewhere, it is such a verbose language you can read it like a book. I just think it is so easy to use, and in a lot of ways so portable with VBA, VBScript (I've used this with dos to repeat creating a directory structure over and over again), VB.NET, VB6. I can use it in so many different environments. It's hard to resist the temptation to come back to it...and so C# will have to wait some more.

Here is a copy of the code I am using:

Private Sub ZipFolder(ByVal currentFolder As String)
Dim Filenames() As String = System.IO.Directory.GetFiles(OutputPath & currentFolder & "\")
Dim s As New ZipOutputStream(System.IO.File.Create(OutputPath & currentFolder & ".kmz"))
s.SetLevel(9)
Dim buffer() As Byte
ReDim buffer(4096)
For Each file As String In Filenames
Dim entry As ZipEntry
Dim fileInfo As New System.IO.FileInfo(file)
entry = New ZipEntry(fileInfo.Name)
entry.Size = fileInfo.Length
s.PutNextEntry(entry)
Dim fs As System.IO.FileStream = fileInfo.OpenRead
ReDim buffer(fileInfo.Length)
Dim sourceBytes As Integer = 1
Do Until (sourceBytes <= 0)
sourceBytes = fs.Read(buffer, 0, fileInfo.Length)
s.Write(buffer, 0, sourceBytes)
Loop
fs.Close()
fs = Nothing
sourceBytes = Nothing
entry = Nothing
Next
s.Finish()
s.Close()
Filenames = Nothing
s = Nothing
buffer = Nothing

End Sub

Monday, March 31, 2008

Mmmmmm Goooooogle Eaarrtth....

I have to admit, I didn't much bother with Google Earth when it first started making headlines (however many years ago that was). Sure like any Geonerd I downloaded and goofed around. "Oooh spinning globe (Wheeee!)." The imagery, of course, was stunning. It wasn't until recently that I've really found a use for it and started to delve into it. Now, I'm quite enamored with Google Earth.

The current project I'm working on is for the Department of Employment, Education, and Training....and water sports. The NT government has some good department names. I'm under the education department and there is currently a push to be able geolocate all the schools and associate this with their excellent data warehouse. The Northern Territory has some very remote communities (some still are lacking in power/electricity). I'm sure to fellow GISers it is obvious the need to be able to locate where your resources are going, and not going. A map is a simple way to do this. I'm the only GIS user working there and only on a part time basis at that, so it is important for everyone to be able to view the data when I'm not available to create a map. Their data warehouse is already running on SQL Server, and so I've been building my system on top of that (or next to). MapInfo was chosen as the GIS, and I'll describe my woes with this program later. I got into Google Earth, because another department had set up their on Google Earth server and had a site license for GE Enterprise. That's when I started to explore what we could do with it.

This is what I've come up with. I'm sure I'm not the first person to do this, but I thought I would at least share my methodology.

KML has a special section called network link. This allows the KML creator to instead of populating a file with the coordinates and geometry, to tie it to a web based server side script. This was extremely easy to do. I created a generic handler (ashx) in asp.net, and wrote a small class that created the response in the kml/xml format. The class pulled all of the coordinate information directly from the database server. Pretty cool to have the dynamic capability built into Google Earth. and only requiring a little server side scripting. Maybe 50 lines of code if that.

That's good, but it is just the location of schools. Obviously the description for the info window that pops up when the location is clicked can be populated with various data from the warehouse, but this might become a bit tedious to code. Instead I just placed a link to a profile page I had already set up. Unfortunately, you can't place an iframe in the window, because it isn't sophisticated enough to handle every scenario. No big deal.

What I really want to do is be able to display the data as a symbol. I could easily classify the symbols using some sort of nominal data stored in the database, or even some continuous data. I had originally created some maps with pie chart symbols in MapInfo showing the break-up of enrollment. I was asked if there was a way to click on the map and see what the numbers actually were. Well, this was a PDF, so the answer in that case was "no." I started to think if there was a way to do this with Google Earth, that would allow for the creation of a much more interactive environment. Using GDI+ and .NET, I was able to create a png image of a pie chart from the data in the warehouse, while programatically creating the kml file. Originally, I manually took this data and created a KMZ file. Then I started to use network links and tied my pie chart code in with my server side script. Now I have a dynamic kml file that creates pie charts on the fly as it is shown in Google Earth (images stored on the webserver). Now whenever it is opened up, it will reflect the current changes in the data warehouse. I plan on achieving the same effect with a proportional symbol. .NET has assemblies that allow me to compress data, so I could easily create a fixed kmz file based on this same method.

I would also like to do something similar using 3D. I attempted to create an extruded polygon based on the data. Unfortunately, these do not change their scale based on zoom. I looked around, but did not find anything. I'm thinking I could do this using regions. But at this point, I'm a little confused how regions work.

Anyway, it isn't difficult with a little programing to create a highly interactive map with Google Earth and ASP.NET.

Tuesday, March 11, 2008

Is Geospatial a Bad Word?

So I "discovered", in the same sense Columbus "discovered" America, a new podcast available through ITunes. It is the Penn State Department of Geography Coffee Hour to Go, http://www.geog.psu.edu/coffee_hour/. Basically they have prominent Geographers discuss current research and the like. The one that I listened to was Dr. Michael Goodchild's presentation on the impact of GIS in Geography. It's an interesting take on the importance of GIS in the discipline of Geography, worth a listen. But, in the lecture, Dr. Goodchild uses the word "Geospatial," saying it somewhat disdainfully. He doesn't elaborate on why this is the case, but it is clear he doesn't like the term. I'm sure I've used the term before, in speech or in writing, but I've never really thought about. The first thing that popped into my head when I really thought about it was that it seems redundant. Wouldn't Geo imply Spatial? Maybe to a Geographer it would. Mostly, though, I'm curious why Dr. Goodchild would be opposed to the term. So I'll toss that question out to cyberspace in hopes that it comes back with a response - Is Geospatial a bad word?