Print Story ATTENTION: Web developers/Google Maps infidels
Diary
By whazat (Mon Aug 01, 2005 at 05:53:05 PM EST) (all tags)
I am not normally a web developer but I have been inspired by the Google map/earth tom foolery and try and figure out how to creep out (not having to wait for pesky standards commitees and the like) a geological information kinda tag for html. See inside for my nights exploits.


I want a tag something like the following.


<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="geo.xsl"?>
<geoLocation geoLinkText="Fred is here" geoName="Fred">
 <geoLatLong geoLat="40" geoLong="90.0">

<geoLocation>

But without the gacky xml stuff. This would be linked in client side to whatever the client wanted to do with a location (open in gmaps/gearth/find route to/set flying cars autopilot to go to etc...). Also it could be extended to hold area or radii around points. Perhaps even altitude so that DU can place satellites in orbit.

Yes there is a huge thing at openGIS that may or may not do what I want. But reading through there documentation wasn't as much fun as hacking things out.

The first thing I thought I could do was to make a firefox plugin, it was rabbiting on about JS and DOM stuff. However I know little about that so I ended up making an XSLT thingmibob. Whether I can convert this to an xpi is another matter entirely. I also found this, which may be what I needed anyway.


Filename geo.xsl
StartFile
---------
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="1.0" encoding="UTF-8">
<xsl:template match="
">
<html>
<body>
<xsl:for-each select="geoLocation">

<xsl:element name="a">
<xsl:attribute name="href">http://maps.google.com/maps?q=N+<xsl:for-each select="geoLatLong">
<xsl:value-of select="@geoLat">+W+<xsl:value-of select="@geoLong">
</xsl:for-each>
</xsl:attribute>
<xsl:attribute name="name">
<xsl:value-of select="@geoName">
</xsl:attribute>
<xsl:value-of select="@geoLinkText">
</xsl:element>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:output>
</xsl:stylesheet>

I figured this might be a way of sneaking it in to usage. Also would be good would to be to get something similar into wikipedia appropriately wikified. So that searches can be done on coordinates.

This codes works and gives you a link in xalan. It doesn't seem to work in Firefox although that is acting up at the moment. Haven't tried it in IE.

Also I have a schema. That was fine a while back it may need updating and re-validation.

Before this takes over the world perhaps we can have a geo macro in hulver. Pretty please.


Filename geo.xsd
StartFile
---------
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

 <xs:element name="geoLocation">
  <xs:complexType>

   <xs:sequence>
    <xs:element name="geoLatLong">
     <xs:complexType>
      <xs:attribute name="geoLat" type="xs:decimal" use="required">
      <xs:attribute name="geoLong" type="xs:decimal" use="required">
     </xs:complexType>
    </xs:element>

   </xs:sequence>

   <xs:attribute name = "geoLinkText" type="xs:string" use="required">
   <xs:attribute name = "geoName" type="xs:string"> 
  </xs:complexType>
 </xs:element>
 </xs:schema>

Addenda: AAargh all the single line xml codes have had there ending slashes stripped. For reasons unknown. I blame scoop and Rusty. I shall sort this at some point in the future. IT WILL NOT WORK. All code is for purely aesthetic qualities at the moment. It should produce this
Fred is here

< Hi | BBC White season: 'Rivers of Blood' >
ATTENTION: Web developers/Google Maps infidels | 5 comments (5 topical, 0 hidden)
Tip by gazbo (2.00 / 0) #1 Mon Aug 01, 2005 at 11:12:39 PM EST
Wrap all your code and XML in <ecode></ecode> tags.

I recommend always assuming 7th normal form where items in a text column are not allowed to rhyme.

Thanks by whazat (2.00 / 0) #2 Tue Aug 02, 2005 at 02:54:57 AM EST
Knew there was something, but my tired brain omitted the e.

--
The revolution will not be realised
[ Parent ]
Yes, hello. by spcmanspiff (2.00 / 0) #3 Wed Aug 03, 2005 at 06:28:00 AM EST
I'm going to ask an annoying question:

Which geographic projection are these coordinates in? What if you only have one, e.g., pulling coordinates from a USGS topo quad (NAD 1927) but the system uses the other, e.g., I'd guess that Google Maps is using WGS 1984?

... GIS is annoying.

p.s. by spcmanspiff (2.00 / 0) #4 Wed Aug 03, 2005 at 06:29:57 AM EST
Also, in my one week+ of experience with XML and the like: Relax NG kicks the living crap out of XML schema.

[ Parent ]
Not annoying by whazat (2.00 / 0) #5 Wed Aug 03, 2005 at 10:45:32 AM EST
Useful. Criticism is always more useful than praise. I shall look into projections and get back to you. Probably that I would specify people use a single projection and then if they are wanting to use an application that uses t'other projections then javascript could translate the coordinates.

--
The revolution will not be realised
[ Parent ]
ATTENTION: Web developers/Google Maps infidels | 5 comments (5 topical, 0 hidden)