Jump to content

DMS to WGS84


MiCR0

Recommended Posts

I have found how to do this in perl

 

  foreach (@{$r->{data}{array}}) {
    if (length($_->{latitude})) {
      print "  <item rdf:about=\"$_->{objectno}\">\n";
      print "    <title>$_->{objectno} - $_->{objectname}</title>\n";
      print "    <description>$_->{postext}</description>\n";
      print "    <georss:point>";
      if ($_->{latitude} =~ /(\d+).*?(\d+).*?(\d+\.\d*)\s+([sN])/) {
        my $latitude = $1+$2/60+$3/3600;
        $latitude *= -1 if ($4 eq 'S');
        print $latitude;
      }
      print ' ';
      if ($_->{longitude} =~ /(\d+).*?(\d+).*?(\d+\.\d*)\s+([EW])/) {
        my $longitude = $1+($2/60+$3/3600);
        $longitude *= -1 if ($4 eq 'W');
        print $longitude;
      }
      print "</georss:point>\n";
      print "  </item>\n";
    }
  }

Link to comment
https://forums.phpfreaks.com/topic/221748-dms-to-wgs84/#findComment-1147609
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.