GeoMedia GIS Blog

"A picture is only worth a thousand words. A map may be worth a thousand numbers. But a GIS is worth a thousand tables."

Creating a Hyperlink from a Point in GeoMedia to Google Maps

Posted by jeffhobbs on July 10, 2007

After spending much of yesterday moving text around, I decided to look at something different today. We have an application showing a myriad of GPS points along with other information. I thought it might be good to provide a hyperlink for each point to Google Maps to provide additional information and functionality like driving directions, routing, etc.

So…time for functional attributes. For those that have used them, they are tremendously powerful. Additionally, there’s quite a few samples in the GeoMedia documentation…that is, if you can find them :-(. I found a number of them in the GeoMedia Professional Help (the .chm). Initially I found an example to calculate latitude and longitude which turned out to be quite the overkill – but cool nonetheless. From the help:


The following example does the same as the previous one except the values are loaded to the same attribute field (that is, Long_Lat) where the longitude and latitude are separated by a comma (Example: -86:41:17.214,34:41:58.884)

FORMATMEAS(X(Input.Geometry, TrueMeas, Radian), FormatType.Angle, DegreesMinutesSeconds, 3)+’,’+FORMATMEAS(Y(Input.Geometry, TrueMeas, Radian), FormatType.Angle, DegreesMinutesSeconds, 3)

This looked cool, but didn’t return lat/long in a format that Google liked. So, I figured before I went and further, I’d need to figure out just what Google Maps DID want. After doing some research, it turns out what it wants is VERY simple. It wants degrees, rounded to six digits after the decimal.

This is the equivalent of going to Tools > Geoworkspace Coordinate System > Units and Formats > Geographic (under Type) and changing the Unit to deg and changing the precision to six digits (.123456).

Then in your precision coordinates bar, make sure Lon, Lat (deg) is selected

After that, I just needed to create the functional attribute. That turned out to be fairly easy (now that I knew what it wanted):

Y(input.gdo_geometry, TrueMeas, Degree) for the longitude and X(input.gdo_geometry, TrueMeas, Degree) for the latitude

After that I just need to added the ROUND() function into the mix to round to six numbers after the decimal:

ROUND(Y(input.gdo_geometry, TrueMeas, Degree), 6)

ROUND(X(input.gdo_geometry, TrueMeas, Degree), 6)

Finally, a wrapped it all into one long string and added the supporting URL specific information:

http://maps.google.com/maps?q=’+ROUND(Y(input.gdo_geometry, TrueMeas, Degree), 6)+’,+’+ROUND(X(input.gdo_geometry, TrueMeas, Degree), 6)

You can also add a one line descriptor of the point that will get pass with the URL. So, my VERY END functional attribute looks like:

http://maps.google.com/maps?q=’+ROUND(Y(input.gdo_geometry, TrueMeas, Degree), 6)+’,+’+ROUND(X(input.gdo_geometry, TrueMeas, Degree), 6)+’+(SIO + Number+’+Input.SIO_NUMBER+’)’

If you make sure to set the functional attribute to output Hypertext as opposed to standard text, the Properties Dialog will have your functional attribute as a hyperlink that can be clicked on and will launch Google Maps in your default browser. The end Properties Dialog will look like this (I’ve erased some of the private information)

When I click on the hyperlink, I get the following in Google Maps:

Try it for yourself: http://maps.google.com/maps?q=37.157914,+-121.9852+(SIO + Number+322879)

Advertisements

7 Responses to “Creating a Hyperlink from a Point in GeoMedia to Google Maps”

  1. Jeff,

    Great stuff! We do a similar process to link our assessor’s parcel base with the corresponding record at the Assessor’s web site.

    Dann

  2. Chris Matus said

    This is cool stuff! I was able to use this same process for WebMap using Publisher. I added the CENTERPOINT function and set the Hotspot to open this url.

    Thanks Jeff!

  3. Jeff Hobbs said

    Chris – Great point. One of the GREAT things about WebPub (there are many 🙂 ) is that you can indeed load a query into the web site. Very cool and great if you’ve already built the intelligence inside of GM. It’s nice to not have to recreate it again inside of GMWM.

  4. […] on October 15, 2007 by jeffhobbs For the "long-term readers", I posted an entry on Creating a Hyperlink to Google Maps in GeoMedia a few months ago. Well, Chris Matus sent me an example of linking to Microsoft’s Virtual […]

  5. Grey.. said

    Hy, I am trying to copy your syntax into Functional atribute box, but it always say Unexpected end of session…hmm what am I doing wrong?

  6. Jeff Hobbs said

    Grey,

    The functional attribute should work assuming you change the column name references to something that you have in the feature class. You might want to try and copy from the web site to a text editor like Notepad. Maybe you’re copying over some hidden HTML elements? That might cause a problem.

  7. Adrian Moisey said

    Hi peeps, I have managed to get the link to google maps working fine along with passing over attribute data, however I was wondering if anyone knew if it was possible to either zoom to fit an MBR from webmap in google maps or is it possible to set the zoom level from the hyperlink text?

Sorry, the comment form is closed at this time.

 
%d bloggers like this: