103 Posts
Osep45
4 years ago
8
Topic

Hello,

I installed this extension : https://www.pulsar-agency.com/telechargements-gratuits/carte-openstreet-map

it is a wonderful solution to replace googlemap.

But the plugin doesn't calculate the latitude and longitude, I don't understand how it works. 

thanks for your help !

Here is my configuration :




and the result in my content :


Get a Book for SEBLOD
57 Posts
KKAAZZOO
4 years ago
0
Level 1

Ask pulsarinformatique, he is the developer this plugin.

548 Posts
joomleb
4 years ago
6
Level 1

Hi guys, 

here I also made some questions to Cyril (pulsarinformatique)...

151 Posts
jimenaes
2 years ago
5
Level 2

Hello everyone, I just found this fantastic news about the plugin that pulsarinformatique made. I installed it on my site and changed the template of my content list that previously used the google one, but the map is not displayed, it does not display anything. Does anyone know what I may be doing wrong? I am using the latest versions of both Joomla(3) and Seblod.

Thanks

60 Posts
SemaphoreOxalis
2 years ago
0
Level 3

Sorry for not be very usfull for now but this plug work : https://ressources.terredeliens.org/recolte

We used the plug-in from Pulsar too for geocoding the address. The OSM Map template is used for a list. We set the long and lat field (fro mthe geocoding). the list is loaded in a Seblod Module "et voila !"

33 Posts
claudioalfonso
1 year ago
3
Level 3

Dear 

Plugin not work only template works fine. Configuration of template OSM is similar template seb map

60 Posts
SemaphoreOxalis
3 days ago
2
Level 4

Our client report to us an issue in the creation form.

We quickly identify the issue : the geocoding call an obsolete service. But you can easyli solve the issue :

Go to plugins/cck_field/address_to_coordinates_osm/address_to_coordinates_osm.php

Search and replace komoot.de by komoot.io (2 changes) : it solved !

33 Posts
claudioalfonso
3 days ago
1
Level 5

no nosso caso nao funciona pq tem a questao da lang que nao tem suporte ao pt_br entao mudie o código e coloquei uma css para melhorar a exibição dos dados alguns campos estao de acordo com o formulario que a gente usa

<?php defined('_JEXEC') or die; class plgCCK_FieldAddress_To_Coordinates_Osm extends JCckPluginField { protected static $type = 'address_to_coordinates_osm'; public function onCCK_FieldConstruct($type, &$data = array()) { if (self::$type != $type) { return; } parent::g_onCCK_FieldConstruct($data); } public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false) { if (self::$type != $field->type) { return; } parent::g_onCCK_FieldPrepareForm($field, $config); $id = $field->name; $field->form = '<input type="text" id="' . $id . '" name="' . $field->name . '" value="' . htmlspecialchars($value) . '" autocomplete="off" />'; if (!parent::g_isStaticVariation($field, $field->variation)) { if ($field->bool == 1) { $options2 = new JRegistry($field->options2); if ($field->state) { parent::g_addProcess('beforeRenderForm', self::$type, $config, array( 'name' => $field->name, 'id' => $id )); } } } $field->value = $value; if ($return === true) { return $field; } } public static function onCCK_FieldRenderForm($field, &$config = array()) { return parent::g_onCCK_FieldRenderForm($field); } public static function onCCK_FieldBeforeRenderForm($process, &$fields, &$storages, &$config = array()) { if (!$fields[$process['name']]->state) { return; } self::_addScripts($process['id']); } protected static function _addScripts($id) { static $loaded = 0; if ($loaded) return; $loaded = 1; $doc = JFactory::getDocument(); $doc->addScript('https://code.jquery.com/jquery-3.6.0.min.js'); $doc->addScript('https://cdn.jsdelivr.net/npm/devbridge-autocomplete@1.4.11/dist/jquery.autocomplete.min.js'); // CSS customizado $osm_css = " .autocomplete-suggestions { border: 1px solid #ccc; background: #fff; overflow: auto; max-height: 200px; font-size: 14px; z-index: 9999 !important; box-shadow: 0 2px 4px rgba(0,0,0,0.15); } .autocomplete-suggestion { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid #eee; } .autocomplete-suggestion:last-child { border-bottom: none; } .autocomplete-selected { background-color: #f0f0f0; } .autocomplete-suggestion strong { font-weight: bold; color: #333; }"; $doc->addStyleDeclaration($osm_css); // JavaScript para autocompletar $osm_js = " jQuery(document).ready(function($){ var \$field = $('#{$id}'); var \$lat = $('#lat'); var \$lng = $('#lng'); var \$cidade = $('#cd_cidade'); var \$cep = $('#cd_cep'); var currentPhotonRequest = null; \$field.devbridgeAutocomplete({ minChars: 3, lookup: function (query, done) { if(currentPhotonRequest !== null) { currentPhotonRequest.abort(); } currentPhotonRequest = $.ajax({ url: 'https://photon.komoot.io/api/?q=' + encodeURIComponent(query) + '&limit=5', method: 'GET', dataType: 'json', success: function(data) { var results = []; $.each(data.features, function(i, feature) { var prop = feature.properties; if (prop.country && prop.country.toLowerCase() !== 'brazil') return; var name = prop.name || ''; var street = prop.street || ''; var housenumber = prop.housenumber || ''; var city = prop.city || ''; var state = prop.state || ''; var country = prop.country || ''; var postcode = prop.postcode || ''; var fullAddress = [ name, housenumber, street, city, state, country, postcode ].filter(Boolean).join(', '); results.push({ value: fullAddress, data: { lat: feature.geometry.coordinates[1], lng: feature.geometry.coordinates[0], city: city, cep: postcode } }); }); done({ suggestions: results }); } }); }, onSelect: function (suggestion) { if (\$lat.length) \$lat.val(suggestion.data.lat); if (\$lng.length) \$lng.val(suggestion.data.lng); if (\$cidade.length) \$cidade.val(suggestion.data.city); if (\$cep.length) \$cep.val(suggestion.data.cep); } }); }); "; $doc->addScriptDeclaration($osm_js); } public static function onCCK_FieldBeforeStore($process, &$fields, &$storages, &$config = array()) { // Opcional: armazenamento das coordenadas } } ?>

33 Posts
claudioalfonso
3 days ago
0
Level 6

o codigo acima é do arquivo
address_to_coordinates_osm.php

Get a Book for SEBLOD