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)
7 Responses to “Creating a Hyperlink from a Point in GeoMedia to Google Maps”
Sorry, the comment form is closed at this time.