logo       

AW: AW: AW: [opengeodb] Code für die Berechnung von Entf ern ung von zwisc: msg#00065

Subject: AW: AW: AW: [opengeodb] Code für die Berechnung von Entf ern ung von zwischen 2 Orten
Hallo,

das wäre super wenn du ein beispiel hättest.
Wie ist der link zu deiner hp?

lg

-----Ursprüngliche Nachricht-----
Von: opengeodb-bounces-r1mDYR0DdAyzQB+pC5nmwQ@xxxxxxxxxxxxxxxx 
[mailto:opengeodb-bounces-r1mDYR0DdAyzQB+pC5nmwQ@xxxxxxxxxxxxxxxx] Im
Auftrag von Rolf Varga
Gesendet: Sonntag, 30. Januar 2005 08:53
An: Mailingliste OpenGeoDB
Betreff: Re: AW: AW: [opengeodb] Code für die Berechnung von Entf ern ung
von zwischen 2 Orten

Hallo,

für eine Simple umkreisbereichnung mit PLZ wie du Sie für deine Singles
Community brauchst, empfehle ich dir mal die Datenbank von Arnulf Christl.

Ein Beispiel wie das auszusehen hat Programmier technisch kann ich dir
zukommen lassen, da ich auch eine seite habe die mit deiner seite verwand
ist :) währe das also kein Problem.

mfg
Rolf



>Hallo,

>kannst du mir sagen wie ich den dump in mySQL >bekomme? Beim mir kann ich
es
>nicht dumpen. Ich denke das ich einen timeout >bekomme.

>lg

-----Ursprüngliche Nachricht-----
Von: opengeodb-bounces-r1mDYR0DdAyzQB+pC5nmwQ@xxxxxxxxxxxxxxxx 
[mailto:opengeodb-bounces-r1mDYR0DdAyzQB+pC5nmwQ@xxxxxxxxxxxxxxxx] Im
Auftrag von mack-WMLsJPcVvUbeKaaq6wa0og@xxxxxxxxxxxxxxxx
Gesendet: Samstag, 29. Januar 2005 10:59
An: opengeodb-r1mDYR0DdAyzQB+pC5nmwQ@xxxxxxxxxxxxxxxx
Betreff: Re: AW: AW: [opengeodb] Code für die Berechnung von Entf ern ung
von zwischen 2 Orten

Hi!
>
>also das getDistance habe ich nicht gefunden. WO finde ich es?
>
Sorry, man sollte die Dinge testen, die man schreibt. Es muß
$ort1->getDistance($ort2); heißen.

Ich habe gerade mal die opengeodb.php im Schnellverfahren umgestrickt.

Bei mir funktioniert sie. Oben müssen halt die Infos noch angepaßt
werden wie bei der opengeodb.php auch. Ich habe sie laufen lassen
mit der 0.2.1* Version der opengeodb und der GeoClass 0.2.2(?)
auch von th-mack.de/opengeo.

Thomas

entf.php:
====================================================================

<html>
<head>
<title>Beispiel f&uuml;r GeoClass/OpenGeoDB</title>
</head>
<body>
<?php

/*
 ###########################################################
 #
 # Beispiel für die Verwendung der GeoClass (0.2.2* von
 # http://th-mack.de/opengeo)
 # mit den Daten der OpenGeoDB (>= 0.2.1)
 #
 # Erfordert PEAR::DB
 #
 ###########################################################
 */

/**
 * Konfiguration muß angepaßt werden:
 */

ini_set('include_path','./PEAR:.');

if (!defined('DSN')) {
  // Hier müssen die Zugangsdaten für die Datenbank eingetragen werden:
  // define(DSN,'mysql://username:password@localhost/database_name');
  define(DSN,'pgsql://tm:tm@localhost/opengeo06h');
  // define(DSN,'mysql://tm:tm@localhost/opengeo06f');
}

require_once('Geo/Geo.php');
require_once('OpengeoDefs.php');

$geodb = Geo::setupSource("DB_OpenGeoDB",DSN);

$date = getdate();
$today = '\''.$date['year'].'-'.$date['mon'].'-'.$date['mday'].'\'';


if ($_GET["id1"] && $_GET["id2"]) {
  // IDs sind übergeben. Entfernung ausrechnen und ausgeben:

  $sql = 'SELECT td.text_val AS "name", '.
                'td.loc_id AS "id", '.
                'hi.level, '.
                'lon, '.
                'lat '.
         'FROM geodb_textdata td, '.
              'geodb_hierarchies hi, '.
              'geodb_coordinates co '.
         'WHERE td.loc_id='.(int)$_GET["id1"]." and ".
               'td.text_type = '.NAME.' and '.
               'td.is_native_lang = true and '.
               'td.is_default_name = true and '.
               'hi.loc_id = td.loc_id and '.
               'hi.level >= 6 and '.
               'co.loc_id = td.loc_id and '.
               'td.valid_until >= '.$today.' and '.
               'hi.valid_until >= '.$today.' and '.
               'co.valid_until >= '.$today;
  list($ort1) = $geodb->performQuery($sql);

  $sql = 'SELECT td.text_val AS "name", '.
                'td.loc_id AS "id", '.
                'hi.level, '.
                'lon, '.
                'lat '.
         'FROM geodb_textdata td, '.
              'geodb_hierarchies hi, '.
              'geodb_coordinates co '.
         'WHERE td.loc_id='.(int)$_GET["id2"]." and ".
               'td.text_type = '.NAME.' and '.
               'td.is_native_lang = true and '.
               'td.is_default_name = true and '.
               'hi.loc_id = td.loc_id and '.
               'hi.level >= 6 and '.
               'co.loc_id = td.loc_id and '.
               'td.valid_until >= '.$today.' and '.
               'hi.valid_until >= '.$today.' and '.
               'co.valid_until >= '.$today;
  list($ort2) = $geodb->performQuery($sql);

  echo '<h2>Entfernung '.$ort1->dbValues['name']." ->
".$ort2->dbValues['name'].':</h2>';
  echo $ort1->getDistance($ort2)." km";

} else {
  // Suchformular ausgeben:

  echo '<h2>Ortsdatenbank</h2>';

  echo '<form action="'.$_SERVER['PHP_SELF'].'" method="GET">';
  echo '<input style="width:200px;" type="text" name="q1"
value="'.htmlentities($_GET["q1"]).'"><br>';
  echo '<input style="width:200px;" type="text" name="q2"
value="'.htmlentities($_GET["q2"]).'"><br>';
  echo '<input type="submit" name="" value="Suche starten">';
  echo '</form>';

  if ($_GET["q1"] && $_GET["q2"]) {
    // Suchbegriffe sind eingegeben, die Suchresultate können ausgegeben
werden:

    // Alle zutreffenden Orte heraussuchen:
    $sql = 'SELECT td.loc_id as "id", '.
                  'td.text_val as "name", '.
                  'hi.level, '.
                  'co.lon, '.
                  'co.lat '.
           'FROM geodb_coordinates co, '.
                'geodb_textdata td, '.
                'geodb_hierarchies hi '.
           'WHERE co.loc_id = td.loc_id and '.
                 'hi.loc_id = td.loc_id and '.
                 'td.text_type = '.NAME.' and '.
                 'td.is_native_lang = true and '.
                 'td.is_default_name = true and '.
                 'td.text_val LIKE \'%'.utf8_encode($_GET["q1"]).'%\' and '.
                 'td.valid_until >= '.$today.' and '.
                 'hi.valid_until >= '.$today.' and '.
                 'co.valid_until >= '.$today.' '.
           'ORDER BY id';

    $treffer1 = $geodb->performQuery($sql);
    // Anzahl Treffer
    echo 'Ihre Suche nach "'.$_GET["q1"].'" ergab '.count($treffer1).'
Treffer:<br>';

    $sql = 'SELECT td.loc_id as "id", '.
                  'td.text_val as "name", '.
                  'hi.level, '.
                  'co.lon, '.
                  'co.lat '.
           'FROM geodb_coordinates co, '.
                'geodb_textdata td, '.
                'geodb_hierarchies hi '.
           'WHERE co.loc_id = td.loc_id and '.
                 'hi.loc_id = td.loc_id and '.
                 'td.text_type = '.NAME.' and '.
                 'td.is_native_lang = true and '.
                 'td.is_default_name = true and '.
                 'td.text_val LIKE \'%'.utf8_encode($_GET["q2"]).'%\' and '.
                 'td.valid_until >= '.$today.' and '.
                 'hi.valid_until >= '.$today.' and '.
                 'co.valid_until >= '.$today.' '.
           'ORDER BY id';

    $treffer2 = $geodb->performQuery($sql);
    // Anzahl Treffer
    echo 'Ihre Suche nach "'.$_GET["q2"].'" ergab '.count($treffer2).'
Treffer:<br>';

    if (is_array($treffer1) && count($treffer1)>=1 &&
        is_array($treffer2) && count($treffer2)>=1) {
      foreach ($treffer1 AS $key1 => $ort1) {
        foreach ($treffer2 AS $key2 => $ort2) {
          echo '<a
href="'.$_SERVER['PHP_SELF'].'?id1='.$ort1->dbValues['id'].'&id2='.$ort2->db
Values['id'].'">'.utf8_decode($ort1->dbValues['name']).' =>
'.utf8_decode($ort2->dbValues['name']).'</a><br>';
        }
      }
    }
  } else {
    // Kein Suchbegriff
    echo "Bitte geben Sie als Suchbegriff zwei<br>Namensbestandteile oder
Postleitzahlen ein.";
  }
}
?>
</body>
</html>

-- 
Mailingliste OpenGeoDB
Listenadresse: opengeodb-r1mDYR0DdAyzQB+pC5nmwQ@xxxxxxxxxxxxxxxx
Informationen: http://opengeodb.de
Mit freundlicher Unterstütztung von php::bar (http://phpbar.de)



-- 
Mailingliste OpenGeoDB
Listenadresse: opengeodb-r1mDYR0DdAyzQB+pC5nmwQ@xxxxxxxxxxxxxxxx
Informationen: http://opengeodb.de
Mit freundlicher Unterstütztung von php::bar (http://phpbar.de)

-- 
Mailingliste OpenGeoDB
Listenadresse: opengeodb-r1mDYR0DdAyzQB+pC5nmwQ@xxxxxxxxxxxxxxxx
Informationen: http://opengeodb.de
Mit freundlicher Unterstütztung von php::bar (http://phpbar.de)





<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
linux.arklinux....    user-groups.lin...    kde.usability/2...    ietf.ipp/2002-0...    mail.spam.spamc...    os.netbsd.devel...    audio.cd-record...    text.unicode.de...    php.documentati...    games.fps.halfl...    window-managers...    suse.oracle.gen...    bug-tracking.gn...    video.dvdrip.us...    xfree86.cvs/200...    java.netbeans.m...    network.argus/2...    culture.sf.kill...    debian.ports.al...    freebsd.questio...    qplus.devel/200...    handhelds.palm....   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe