Startseite
  • » Home
  • » Handbuch & FAQ
  • » Forum
  • » Übersetzungsserver
  • » Suche
Startseite › Forum › Drupalcenter.de › Module ›

(gelöst) Nach Update auf GMap 6.x-2.0-beta1 klappt die Umkreissuche nicht mehr?

Eingetragen von beaschmitz (469)
am 07.04.2013 - 09:26 Uhr in
  • Module
  • Drupal 6.x

Hallo,
ich habe gerade das Modul GMap upgedatet, da die 1er Version keinen Support mehr hatte. Ich habe auf GMap 6.x-2.0-beta1 erneuert...
Zuerst musste ich mir dann einen neuen API Key machen, hat geklappt....die Karten funktionierten dann auch wieder und meine User wurden darauf angezeigt....
Aber nun ist mir etwas aufgefallen:

- ich hatte vorher in einem View mit der Filtereinstellung "Ort: Distance / Proximity" User in meiner Nähe in einem bestimmten Radius
anzeigen lassen...das hat super geklappt und ist sehr schick....
- Nur wenn sich jetzt ein neuer User anmeldet, dann klappt es nicht mehr?! Er bekommt immer 5-6 User angezeigt, wo anscheinend irgendetwas mit der Location nicht
stimmt....
- bei den alten Usern stimmt noch alles in dem View

Ich habe irgendwie keine Idee, wo ich noch nachjustieren muss?!
Hat jemand einen Tipp?

‹ IMCE-File Upload gelingt einfach nicht (gelöst) Nach Update auf GMap 6.x-2.0-beta1 klappt die Umkreissuche nicht mehr? ›
  • Anmelden oder Registrieren um Kommentare zu schreiben

Ich habe gerade einmal den

Eingetragen von beaschmitz (469)
am 07.04.2013 - 09:41 Uhr

Ich habe gerade einmal den View dupliziert und nochmals bei einem neuen User nachgesehen: es werden anscheinend nur die User aufgelistet, wo tatsächlich die Bestimmung des Ortes nicht funkioniert hat?!
Bzw. ich muss mal schauen, vielleicht ist der Ort des neuen Users nicht korrekt bestimmt....hmm

  • Anmelden oder Registrieren um Kommentare zu schreiben

aaach, tatsächlich die

Eingetragen von beaschmitz (469)
am 07.04.2013 - 09:43 Uhr

aaach, tatsächlich die Koordinaten, also
Breitengrad und Längengrad werden bei einem NEUEN User nicht automatisch bestimmt, wieso??

  • Anmelden oder Registrieren um Kommentare zu schreiben

hmmm, wenn ich mir diese

Eingetragen von beaschmitz (469)
am 07.04.2013 - 11:03 Uhr

hmmm, wenn ich mir diese anleitung (http://drupal.org/node/1038034) durchlese, dann müsste ich den neuen usern erst einmal das recht erteilen, dass sie überhaupt latitude/longitude eingeben dürfen...
klappt aber nicht, wenn ich den haken setze bei
BERECHTIGUNGEN:
location-Modul
submit latitude/longitude für den gast, dann speichert drupal nicht???

  • Anmelden oder Registrieren um Kommentare zu schreiben

Google geocoding returned

Eingetragen von beaschmitz (469)
am 07.04.2013 - 12:33 Uhr

Google geocoding returned status code: 610
hmm, dies scheint ein größeres Problem zu sein, wenn man sich das hier so ansieht:
http://drupal.org/node/1940474
uff, ich muss noch weiter suchen

  • Anmelden oder Registrieren um Kommentare zu schreiben

hää, google beendet den

Eingetragen von beaschmitz (469)
am 07.04.2013 - 12:35 Uhr

hää, google beendet den support für die alte version und die neue startet erst im september 2013???
ich glaube ich installiere wieder das alte modul
https://developers.google.com/maps/documentation/geocoding/v2/

  • Anmelden oder Registrieren um Kommentare zu schreiben

oh shit, probiert und jetzt

Eingetragen von beaschmitz (469)
am 07.04.2013 - 12:56 Uhr

oh shit, probiert und jetzt geht natürlich der alte api code nicht mehr.....
mann eye

  • Anmelden oder Registrieren um Kommentare zu schreiben

so, wieder auf die neuere

Eingetragen von beaschmitz (469)
am 07.04.2013 - 13:22 Uhr

so, wieder auf die neuere version umgestellt und immer noch auf der suche nach der lösung:
http://drupal.org/node/1940474
die comments hier verstehe ich irgendwie noch nicht... wo muss welcher hack in welchen quellcode?
Hilfe ist denn niemand da, der auch solche probleme hat?

  • Anmelden oder Registrieren um Kommentare zu schreiben

ich werde nachher mal diesen

Eingetragen von beaschmitz (469)
am 07.04.2013 - 19:33 Uhr

ich werde nachher mal diesen hack ausprobieren...und berichten...es hat ja anscheinend niemand einen tipp?!

  • Anmelden oder Registrieren um Kommentare zu schreiben

so...habe die datei

Eingetragen von beaschmitz (469)
am 07.04.2013 - 21:31 Uhr

so...habe die datei google.inc angepasst und nun sieht sie so aus:

<?php

/**
* @file
* Google geocoder.
*/

/**
* Returns an XML document containing the list of countries supported by the
* Google geocoder.
* A cached version is stored in the Drupal cache in case Google is unreachable.
*/
function google_geocode_country_list_xml() {
  // Get the google data from the feed.
  $source = drupal_http_request('http://spreadsheets.google.com/feeds/list/p9pdwsai2hDMsLkXsoM05KQ/default/public/values');

  if (!$source->data) {
    // Use the cache.
    $data = cache_get('location_google');
    if (!defined('LIBXML_VERSION') || (version_compare(phpversion(), '5.1.0', '<'))) {
      $xml = simplexml_load_string($data->data, NULL);
    }
    else {
      $xml = simplexml_load_string($data->data, NULL, LIBXML_NOERROR | LIBXML_NOWARNING);
    }
  }
  else {
    if (!defined('LIBXML_VERSION') || (version_compare(phpversion(), '5.1.0', '<'))) {
      $xml = simplexml_load_string($source->data, NULL);
      // Stores the XML in the cache to eventually use it later.
      cache_set('location_google', $xml->asXML());
    }
    else {
      $xml = simplexml_load_string($source->data, NULL, LIBXML_NOERROR | LIBXML_NOWARNING);
      // Store the XML in the cache to eventually use it later.
      cache_set('location_google', $xml->asXML());
    }
  }

  return $xml;
}

/**
* Return the list of ISO3166 codes supported by this geocoder.
* Coverage list: http://gmaps-samples.googlecode.com/svn/trunk/mapcoverage_filtered.html
* Coverage list feed: http://spreadsheets.google.com/feeds/list/p9pdwsai2hDMsLkXsoM05KQ/defaul...
*/
function google_geocode_country_list() {
  // Get the google data from the feed.
  $xml = google_geocode_country_list_xml();

  // Loop through google data and find all valid entries.
  $regionclean = array();
  foreach($xml->entry as $region) {
    $pos = strpos($region->content, 'geocoding:') + 11;
    $geocoding = substr($region->content, $pos, strpos($region->content, ',', $pos) - $pos);
    if (strpos($geocoding, "Yes") !== FALSE) {
     $regionclean[] = t(htmlentities($region->title));
    }
  }

  // Get the countries list and clean it up so that names will match to google.
  // The regex removes parenthetical items so that both of the "Congo" entries
  // and the "Coco Islands" work.
  // The $countriesfixes overwrites values in the Drupal API countries list
  // with values that will match to google's entries.
  // "Sao Tome and Principe" are non-accented in the Drupal API so the entry
  // here is to match the htmlentities() fix in the foreach loop below.
  // Note: it may be neccessary to adjust/add to the fixes list in the future
  // if google adds countries that don't match the Drupal API list for whatever
  // reason.
  $countries = location_get_iso3166_list();
  $regex = "#[ (].*[)]#e";
  $cntryclean = preg_replace($regex, "", $countries);
  $countriesfixes = array_merge($cntryclean, array(
    "hk" => t("China"),
    "mo" => t("China"),
    "pn" => t("Pitcairn Islands"),
    "wf" => t("Wallis Futuna"),
    "st" => t("S&Atilde;&pound;o Tom&Atilde;&copy; and Pr&Atilde;&shy;ncipe"),
  ));

  // Compare new google data found to fixed country name values and return
  // matches with abbreviations as keys.
  $googlematched = array_intersect($countriesfixes, $regionclean);

  // Compare new keys to original Drupal API and return the array with the
  // original name values.
  $fixedkeys = array_intersect_key($countries, $googlematched);
  return array_keys($fixedkeys);
}

/**
* Return general information about this geocoder.
*/
function google_geocode_info() {
  return array(
    'name' => 'Google Maps',
    'url' => 'http://maps.google.com',
    'tos' => 'http://www.google.com/help/terms_local.html',
    'general' => TRUE,
  );
}

/**
* Perform a geocode on a location array.
* @param $location
*   The location array to process.
* @return
*   an associative array with keys 'lat' and 'lon' containing the coordinates.
*/
function google_geocode_location($location = array()) {

  if (function_exists('gmap_get_key')) {
    $key = gmap_get_key();
  }
  else {
    $key = variable_get('location_geocode_google_apikey', '');
  }

$query = array(
'key' => $key,
'sensor' => 'false', // Required by TOS.
'output' => 'xml',
  //'ll' => 0,
//'spn' => 0,
'gl' => $location['country'],
'q' => _google_geocode_flatten($location),
'address' => _google_geocode_flatten($location),
'sensor' => 'false', // Required by TOS
);

$url = url('http://maps.google.com/maps/geo', array(
$url = url('http://maps.googleapis.com/maps/api/geocode/json', array(
     'query' => $query,
     'external' => TRUE,
   ));

   $http_reply = drupal_http_request($url);
   $delay_trigger = TRUE;

   $status_code_match = array();
   preg_match('/<code>(.*)<\/code>/', $http_reply->data, $status_code_match);
   $status_code = $data->status;
  if ($status_code != 'OK') {
    watchdog('location', 'Google geocoding returned status code: %status_code', array('%status_code' => $data->status));
     return NULL;
   }
  $location = $data->results[0]->geometry->location;


   $status_code = $data->status;
   if ($status_code != 'OK') {
    watchdog('location', 'Google geocoding returned status code: %status_code', array('%status_code' => $data->status));
     return NULL;
   }
 
  $accuracy_code_match = array();
  preg_match('/Accuracy="([0-9])"/', $http_reply->data, $accuracy_code_match);
  $accuracy_code = $accuracy_code_match[1];
  $min_accuracy = variable_get('location_geocode_' . $location['country'] . 'google_accuracy_code', variable_get('location_geocode_google_minimum_accuracy', '3'));
  if ($accuracy_code < $min_accuracy) {
   watchdog('location', 'Google geocoding result for %country did not meet the minimum accuracy level of %min_accuracy. Result accuracy: %accuracy_code', array('%country' => $location['country'], '%min_accuracy' => $min_accuracy, '%accuracy_code' => $accuracy_code));
   return NULL;
   }

   $latlon_match = array();
   preg_match('/<coordinates>(.*)<\/coordinates>/', $http_reply->data, $latlon_match);

  $latlon_exploded = explode(',', $latlon_match[1]);

   return array('lat' => $latlon_exploded[1], 'lon' => $latlon_exploded[0]);
   return array('lat' => $location->lat, 'lon' => $location->lng);
}

/**
* General settings for this geocoder.
*/
function google_geocode_settings() {
  $form = array();
  $key = '';
  if (function_exists('gmap_get_key')) {
    $key = gmap_get_key();
  }

  if (!empty($key)) {
    $form['location_geocode_google_apikey'] = array(
      '#type' => 'item',
      '#title' => t('Google Maps API Key'),
      '#value' => $key,
      '#description' => t('The key in use was automatically provided by GMap.'),
    );
  }
  else {
    $form['location_geocode_google_apikey'] = array(
      '#type' => 'textfield',
      '#title' => t('Google Maps API Key'),
      '#size' => 64,
      '#maxlength' => 128,
      '#default_value' => variable_get('location_geocode_google_apikey', ''),
      '#description' => t('In order to use the Google Maps API geocoding web-service, you will need a Google Maps API Key.  You can obtain one at the !sign_up_link for the !google_maps_api.  PLEASE NOTE: You will <em>not</em> have to re-enter your API key for each country for which you have selected Google Maps for geocoding.  This setting is global.', array('!sign_up_link' => '<a href="http://www.google.com/apis/maps/signup.html">sign-up page</a>', '!google_maps_api' => '<a href="http://www.google.com/apis/maps/">Google Maps API</a>'))
    );
  }

  $country = arg(4);
  if ($country) {
    $form['location_geocode_' . $country . '_google_accuracy_code'] = array(
      '#type' => 'select',
      '#title' => t('Google Maps Geocoding Accuracy for %country', array('%country' => $country ) ),
      '#default_value' => variable_get('location_geocode_' . $country . '_google_accuracy_code', variable_get('location_geocode_google_minimum_accuracy', '3')),
      '#options' => location_google_geocode_accuracy_codes(),
      '#description' => t('The minimum required accuracy for the geolocation data to be saved.'),
    );
  }
  return $form;
}

function _google_geocode_flatten($location = array()) {
  // Check if its a valid address
  if (empty($location)) {
    return '';
  }

  $address = '';
  if (!empty($location['street'])) {
    $address .= $location['street'];
  }

  if (!empty($location['city'])) {
     if (!empty($address)) {
      $address .= ', ';
      $address .= ' ';
     }

     $address .= $location['city'];
  }

  if (!empty($location['province'])) {
     if (!empty($address)) {
      $address .= ', ';
      $address .= ' ';
     }

     // @@@ Fix this!
    if (substr($location['province'], 0, 3) == $location['country'] . '-') {
      $address .= substr($location['province'], 3);
      watchdog('Location', 'BUG: Country found in province attribute.');
    }
    else {
      $address .= $location['province'];
    }
  }

  if (!empty($location['postal_code'])) {
    if (!empty($address)) {
      $address .= ' ';
    }
    $address .= $location['postal_code'];
  }

  if (!empty($location['country'])) {
     if (!empty($address)) {
      $address .= ', ';
      $address .= ' ';
     }
     $address .= $location['country'];
   }

  return $address;
}

leider klappt es immer noch nicht....
nun habe ich gesehen, dass es schon location 6.x-3.3-beta2 gibt....mal ausprobieren :))

  • Anmelden oder Registrieren um Kommentare zu schreiben

so, nun musste ich

Eingetragen von beaschmitz (469)
am 07.04.2013 - 21:41 Uhr

so, nun musste ich feststellen, es gibt schon location 6.x-3.3-beta3 und nochmal...

  • Anmelden oder Registrieren um Kommentare zu schreiben

soooooo, nachdem ich ja hier

Eingetragen von beaschmitz (469)
am 07.04.2013 - 21:59 Uhr

soooooo,
nachdem ich ja hier leider gar keine antwort bzw. kommentar erhalten habe, bin ich stolz auf mich!
es hat nach dieser irrfahrt dann doch noch geklappt!
mit der installation von location 6.x-3.3-beta3
erzeugt drupal nun endlich mit der anmeldung eines neuen users auch automatisch das GEOCODING!
es wird wieder automatisch bei der anmeldung der user breitengrad und längengrad erzeugt und nun klappt natürlich auch die umkreissuche bzw. die userssuche!
juhu, ich hab mal was gelöst!

  • Anmelden oder Registrieren um Kommentare zu schreiben

Benutzeranmeldung

  • Registrieren
  • Neues Passwort anfordern

Aktive Forenthemen

  • für drupal11 ein Slider Modul
  • [gelöst] W3CSS Paragraphs Views
  • Drupal 11 neu aufsetzen und Bereiche aus 10 importieren
  • Wie erlaubt man neuen Benutzern auf die Resetseite zugreifen zu dürfen.
  • [gelöst] Anzeigeformat Text mit Bild in einem Artikel, Drupal 11
  • Social Media Buttons um Insteragram erweitern
  • Nach Installation der neuesten D10-Version kein Zugriff auf Website
  • Composer nach Umzug
  • [gelöst] Taxonomie Begriffe zeigt nicht alle Nodes an
  • Drupal 11 + Experience Builder (Canvas) + Layout Builder
  • Welche KI verwendet ihr?
  • Update Manger läst sich nicht Installieren
Weiter

Neue Kommentare

  • melde mich mal wieder, da ich
    vor 2 Tagen 21 Stunden
  • Hey danke
    vor 3 Tagen 16 Stunden
  • Update: jetzt gibt's ein
    vor 4 Tagen 10 Stunden
  • Hallo, im Prinzip habe ich
    vor 1 Woche 1 Tag
  • Da scheint die Terminologie
    vor 1 Woche 1 Tag
  • Kannst doch auch alles direkt
    vor 1 Woche 6 Tagen
  • In der entsprechenden View
    vor 1 Woche 6 Tagen
  • Dazu müsstest Du vermutlich
    vor 1 Woche 6 Tagen
  • gelöst
    vor 4 Wochen 2 Tagen
  • Ja natürlich. Dass ist etwas,
    vor 4 Wochen 3 Tagen

Statistik

Beiträge im Forum: 250233
Registrierte User: 20449

Neue User:

  • Mroppoofpaync
  • 4aficiona2
  • AppBuilder

» Alle User anzeigen

User nach Punkten sortiert:
wla9461
stBorchert6003
quiptime4972
Tobias Bähr4019
bv3924
ronald3857
md3717
Thoor3678
Alexander Langer3416
Exterior2903
» User nach Punkten
Zur Zeit sind 0 User und 8 Gäste online.

Hauptmenü

  • » Home
  • » Handbuch & FAQ
  • » Forum
  • » Übersetzungsserver
  • » Suche

Quicklinks I

  • Infos
  • Drupal Showcase
  • Installation
  • Update
  • Forum
  • Team
  • Verhaltensregeln

Quicklinks II

  • Drupal Jobs
  • FAQ
  • Drupal-Kochbuch
  • Best Practice - Drupal Sites - Guidelines
  • Drupal How To's

Quicklinks III

  • Tipps & Tricks
  • Drupal Theme System
  • Theme Handbuch
  • Leitfaden zur Entwicklung von Modulen

RSS & Twitter

  • Drupal Planet deutsch
  • RSS Feed News
  • RSS Feed Planet
  • Twitter Drupalcenter
Drupalcenter Team | Impressum & Datenschutz | Kontakt
Angetrieben von Drupal | Drupal is a registered trademark of Dries Buytaert.
Drupal Initiative - Drupal Association