Jump to content


Photo

Google Maps for uniGUI


  • Please log in to reply
450 replies to this topic

#421 morphine

morphine

    Member

  • uniGUI Subscriber
  • PipPip
  • 13 posts

Posted 30 January 2018 - 04:57 PM

Hi All,

 

Is there a way to install the component for Delphi XE ? I noticed there is no .dpk  file for Delphi XE.

 

Thanks.


  • 0

#422 zanona

zanona

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 114 posts

Posted 03 February 2018 - 11:10 AM

When I use HTTPS it gives the error below when using the component! If only used as normal HTTP works! What could it be?

 

Source

 

    UniGMap1.RemoveAllRoutes;
 
    with DirectionsRequest do
    begin
      origin := 'rua amadeu perin, 200 colombo, pr';
      destination := 'curitiba, pr';
      travelMode := tmDRIVING;
      draggable := True;
      waypoints := '';
    end;
 
    UniGMap1.Route(DirectionsRequest);

 

Error:

 

ajaxRequest(O6D,"resize",["w="+O6D.getWidth(),"h="+O6D.getHeight()]);if(Ext.Msg.isVisible())Ext.Msg.toFront();if (typeof directionsDisplay != "undefined") {  directionsDisplay.setMap(null);};var rendererOptions = {draggable: true};directionsDisplay = new google.maps.DirectionsRenderer(rendererOptions);var directionsService = new google.maps.DirectionsService();  var request = {   origin                   : "rua amadeu perin, 56 colombo, pr",   destination              : "curitiba, pr",   travelMode               : google.maps.DirectionsTravelMode.DRIVING,   unitSystem               : google.maps.UnitSystem.METRIC,   waypoints                : [],   avoidHighways            : false,   provideRouteAlternatives : false,   avoidTolls               : false};  directionsService.route(request, function(response, status){  if ( status == google.maps.DirectionsStatus.OK ) {    directionsDisplay.setDirections(response);    directionsDisplay.setMap(gm_O31);  } else {alert(status);}});  google.maps.event.addListener(directionsDisplay, "directions_changed", function() {  var steps = [];  var wp    = [];  var my    = directionsDisplay.getDirections();   var data  = {};  data.copyrights     = my.routes[0].copyrights;  data.distancetext   = my.routes[0].legs[0].distance.text;  data.distancevalue  = my.routes[0].legs[0].distance.value;  data.durationtext   = my.routes[0].legs[0].duration.text;  data.durationvalue  = my.routes[0].legs[0].duration.value;  data.startaddress   = my.routes[0].legs[0].start_address;  data.endaddress     = my.routes[0].legs[0].end_address;  data.startlocation  = {"lat": my.routes[0].legs[0].start_location.lat(),"lng":my.routes[0].legs[0].start_location.lng()};  data.endlocation    = {"lat": my.routes[0].legs[0].end_location.lat(),"lng":my.routes[0].legs[0].end_location.lng()};  for ( var i=0; i < my.routes[0].legs[0].steps.length; i++) {    steps.push({      "enc_lat_lngs"   : my.routes[0].legs[0].steps[i].encoded_lat_lngs,      "instructions"   : my.routes[0].legs[0].steps[i].instructions,      "distancetext"   : my.routes[0].legs[0].steps[i].distance.text,      "distancevalue"  : my.routes[0].legs[0].steps[i].distance.value,      "durationtext"   : my.routes[0].legs[0].steps[i].duration.text,      "durationvalue"  : my.routes[0].legs[0].steps[i].duration.value,      "startlocation"  : {"lat": my.routes[0].legs[0].steps[i].start_location.lat(),"lng": my.routes[0].legs[0].steps[i].start_location.lng()},      "endlocation"    : {"lat": my.routes[0].legs[0].steps[i].end_location.lat(),"lng": my.routes[0].legs[0].steps[i].end_location.lng()}    });  }  data.steps = steps;  for ( var i=0; i < my.routes[0].legs[0].via_waypoints.length; i++) {      wp.push({"location" : my.routes[0].legs[0].via_waypoints[i].lat() + "," + my.routes[0].legs[0].via_waypoints[i].lng() });  }  data.waypoints = wp;  ajaxRequest(O31, "directions_changed",     ["count=" + my.routes[0].legs[0].steps.length ,     "directionsDisplay=" + JSON.stringify(data)     ]); });if (navigator.geolocation) {   navigator.geolocation.getCurrentPosition( function(position) {     ajaxRequest(MainForm.btLocation, "CurrentPosition" ,      ["lat=" + position.coords.latitude,        "lng=" + position.coords.longitude,        "acc=" + position.coords.accuracy,        "alt=" + position.coords.altitude,        "altacc=" + position.coords.altitudeAccuracy,        "head=" + position.coords.heading,        "ts=" + position.coords.timestamp       ]);    })};


  • 0

#423 zanona

zanona

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 114 posts

Posted 03 February 2018 - 11:35 AM

I found the solution! Switch HTTP to HTTPS on component!
 
url: = 'https://maps.googlea...ps/api/js?key='+ MyGoogleAPIKey + '& libraries = geometry, places, visualization & sensor = false';

  • 0

#424 DarkDudae

DarkDudae

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 15 February 2018 - 07:52 AM

Hello lema:

 

There is a bug with clusters and markersEx due to recent google maps API changes.

Now, the clusters won´t appear and a Ajax error pops: "Cannot read property 'removeChild' of null"

You can open your own online demo and click the button: "Marker Clusterer", and then, click the "Add markersEx" and the error will show up.

 

Greetings


  • 2

#425 isam

isam

    Member

  • Members
  • PipPip
  • 14 posts

Posted 22 February 2018 - 02:18 PM

hello , i use  uniGMap component V 1.4.8 it is greate job thanks ... but when i wan create marker  i get exeption Acces violation at adresse 040BE4E ...

this is my code :

 

 

procedure TF_Gmap.UniButton1Click(Sender: TObject);

var lng , lat : real;
begin
DTM.Vehicule.First;
lat := 0;
lng := 0;
while Not DTM.Vehicule.Eof do
  begin
   with MarkersEx[DTM.VehiculeRECORDID.Value] do
                begin
                  id := DTM.VehiculeRECORDID.Value;
                  Latitude := 36.733924 - lat;
                  Longitude := 3.274754 + lng;
                  labelAnchor.X := 50;
                  labelAnchor.Y := 50;
                  labelClass := 'myLabel';
                  labelContent := DTM.VehiculeALIAS.Text;
                  labelAnchor.X := 50;
                  labelAnchor.Y := 50;
                  clickable := true; /// a enlevé
                  draggable := True; /// a enlevé
                  labelInBackground := False;
                  labelVisible := True;
                  labelStyle := '{ opacity: 0.50 , color: "green" , width: "150px" }';
                  icon := '/files/images/45.png';
                end;
                UniGMap1.AddMarkerEx(MarkersEx[DTM.VehiculeRECORDID.Value], True);
                lat := 0.36271281838859;
                lng := 0.003004074096709;
    DTM.Vehicule.Next;
  end;
end;
 
 

  • 0

#426 picyka

picyka

    Active Member

  • uniGUI Subscriber
  • PipPipPip
  • 93 posts

Posted 15 March 2018 - 12:23 AM

[OFF]

 

I'm testing a kml file, no online demo works, no console demo shows show
 
http://maps.googleap...0.txt&callback=_xdc _._ pfk19i & token = 97810
 
preview /**/_xdc_._pfk19i && _xdc _._ pfk19i ([0, null, null, null, null, null, 2, [["cliente", "2"]]])
resposta /**/_xdc_._pfk19i && _xdc _._ pfk19i ([0, null, null, null, null, null, 2, [["cliente", "2"]]])
 
 
do not load, I already released the key in the google console

  • 0

#427 lema

lema

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 361 posts

Posted 17 March 2018 - 10:53 PM

 

[OFF]

 

I'm testing a kml file, no online demo works, no console demo shows show
 
http://maps.googleap...0.txt&callback=_xdc _._ pfk19i & token = 97810
 
preview /**/_xdc_._pfk19i && _xdc _._ pfk19i ([0, null, null, null, null, null, 2, [["cliente", "2"]]])
resposta /**/_xdc_._pfk19i && _xdc _._ pfk19i ([0, null, null, null, null, null, 2, [["cliente", "2"]]])
 
 
do not load, I already released the key in the google console

 

 

Hello, maybe this can help you.

http://forums.unigui...ge-3#entry11108


  • 0

#428 lema

lema

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 361 posts

Posted 17 March 2018 - 11:09 PM

Hello,

the MarkersEx is a dynamic array of TMarkerEx.

So, you have to allocate storage.

 

e.g.

You can use something like the following

 


while Not DTM.Vehicule.Eof do
  begin
  SetLength(MarkersEx, High(MarkersEx) + 2);
 
   with MarkersEx[High(MarkersEx)] do
                begin
                  id := DTM.VehiculeRECORDID.Value;

................

                 icon := '/files/images/45.png';

                end;
                UniGMap1.AddMarkerEx(High(MarkersEx)], True);
    DTM.Vehicule.Next;
  end;
end;

 


  • 0

#429 lema

lema

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 361 posts

Posted 17 March 2018 - 11:13 PM

Hello lema:

 

There is a bug with clusters and markersEx due to recent google maps API changes.

Now, the clusters won´t appear and a Ajax error pops: "Cannot read property 'removeChild' of null"

You can open your own online demo and click the button: "Marker Clusterer", and then, click the "Add markersEx" and the error will show up.

 

Greetings

 

 

Confirmed.

I will check it out when I have time.


  • 0

#430 lema

lema

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 361 posts

Posted 17 March 2018 - 11:19 PM

 

I found the solution! Switch HTTP to HTTPS on component!
 
url: = 'https://maps.googlea...ps/api/js?key='+ MyGoogleAPIKey + '& libraries = geometry, places, visualization & sensor = false';

 

 

I've been absent from the forum for a long time!
Glad to see that you sorted out the problem.


  • 0

#431 M477H13U

M477H13U

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 144 posts
  • LocationAix-en-Provence

Posted 21 March 2018 - 05:05 PM

Hello Lema !! Hello UniGUI users !!  :)

 

First of all, thank you very much for this work, I haven't tested it entirely yet, but I am just starting ;D

 

It seems that I encounter this same problem...

 

Hi!

 

I use component in my web application. But Gmap sometime show but mostly don't. When I get blank Gmap I try to see what heaped with Firefox page debuger and I see error : "Uncaught ReferenceError: google is not defined "

 

What I can do to get Gmap any time when open form...

 

Any idea?

 I am basically just doing this in my OnFormShow:

  UniGMap.InitializeMap;

EDIT: This is apparently resolved if you put a uniGMap component on your Main form and disable it + invisible.. but I always have to close my project session and re-log in order to properly load google component .. :/

 

Ps: Is your address still good ? (For your post card collection ^^)


  • 0

M477h13U,

 

UniGUIVersion: 1.10.0.1458.


#432 lema

lema

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 361 posts

Posted 22 March 2018 - 04:33 PM

Hello Lema !! Hello UniGUI users !!  :)

 

First of all, thank you very much for this work, I haven't tested it entirely yet, but I am just starting ;D

 

It seems that I encounter this same problem...

 

 I am basically just doing this in my OnFormShow:

  UniGMap.InitializeMap;

EDIT: I don't know why but this error is not always fired..what am I missing ?  :wacko:

EDIT2: Firefox seems to have less problem to load google object !

 

Thank you again for your time !  -_-

 

Ps: Is your address still good ? (For your post card collection ^^)

 

 

Hello.

Please make sure that you have a uniGmap component on your MainForm or LoginForm if you use it.

(It doesn't need to be visible.)


  • 0

#433 M477H13U

M477H13U

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 144 posts
  • LocationAix-en-Provence

Posted 23 March 2018 - 02:02 PM

Hello Lema!

 

Thank you for you answer!

 

Yes, I did put a uniGMap on my mainForm, but still with that it happens sometime that I need to close session and re-open in order to properly load google object.

So I also add a uniGMap on my loginFrm: then I don't have the issue..  ^_^


  • 0

M477h13U,

 

UniGUIVersion: 1.10.0.1458.


#434 lema

lema

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 361 posts

Posted 23 March 2018 - 05:28 PM

Hello Lema!
 
Thank you for you answer!
 
Yes, I did put a uniGMap on my mainForm, but still with that it happens sometime that I need to close session and re-open in order to properly load google object.
So I also add a uniGMap on my loginFrm: then I don't have the issue..  ^_^

When the component is being created, it adds the necessary paths in ServerModule.CustomFiles.
So, there must be an instance of uniGmap on your FIRST form.
I always suggest to place an invisible uniGmap on your MainForm or LoginForm.
  • 0

#435 jrp

jrp

    Member

  • Members
  • PipPip
  • 22 posts

Posted 04 April 2018 - 12:11 PM

Hello,

I have successfuly display a map and load a KML file (made with Google Earth) which contains some placemarks.

Now I have 2 questions:

1. How to display the name of the placemarks? Like we see in Google Earth

2. When we click on one of the placemarks, how do we know which placemark we have just clicked? I know that in the OnAjaxEvent event we can examine Params. But the difference between one placemark and another is only the lat & lng. Can we identify the placemark by its name? Or maybe some other identification?   

I am using Delphi 10.2.2 Starter + UniGUI Trial Edition 1.0.0 Build 1424 + uniGMap.v.1.4.8

Thank you!


  • 0

#436 Alberto vesx

Alberto vesx

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 495 posts

Posted 12 April 2018 - 04:39 PM

Hi

 

Is it compatible with new beta unigui?

 

Best regards


  • 0

#437 Ruslan

Ruslan

    Active Member

  • uniGUI Subscriber
  • PipPipPip
  • 74 posts

Posted 12 April 2018 - 08:44 PM

Create Open Street map... Google Maps is too expensive for commercial use


  • 0

#438 DonaldShimoda

DonaldShimoda

    Member

  • uniGUI Subscriber
  • PipPip
  • 40 posts

Posted 23 April 2018 - 12:04 AM

Have problems to make that work with mobile. Cant find why... Your mobile sample just work, i just add a unimgmap cmponent to main mobile form and dont.

 

I check the source of the web site and is clear is not adding the google map code.

 

Mine looks like 

 

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="content-type" content="charset=utf-8" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="pragma" content="no-cache" />
<link REL="SHORTCUT ICON" HREF="/m/cache/peopletrackerwebserver_exe/sM7rw1pc26101918E33/favicon.ico">
<title>PeopleTracker Web Client</title>


<link rel=stylesheet href="/m/touch-2.4.2-complete/resources/css/sencha-touch.css" />
<link rel=stylesheet href="/m/unim-1.0.0.1425/css/uni-ext.css" />
<script src="/m/touch-2.4.2-complete/sencha-touch-all.js"></script>
<script src="/m/uni-1.0.0.1425/ext-unicommon-min.js"></script>
<script src="/m/uni-1.0.0.1425/ext-sync-min.js"></script>
<script src="/m/unim-1.0.0.1425/locale/ext-lang-es.js"></script>




<script src="/m/uni-1.0.0.1425/jQuery/jquery-1.11.2.min.js"></script>
<script src="/m/unim-1.0.0.1425/touch-unigui-min.js"></script>


 

An the source of your sample like:

<!DOCTYPE HTML><html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="content-type" content="charset=utf-8" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="pragma" content="no-cache" />
<title>New Application</title>


<link rel=stylesheet href="/m/touch-2.4.2-complete/resources/css/sencha-touch.css" />
<link rel=stylesheet href="/m/unim-1.0.0.1425/css/uni-ext.css" />
<script src="/m/touch-2.4.2-complete/sencha-touch-all.js"></script>
<script src="/m/uni-1.0.0.1425/ext-unicommon-min.js"></script>
<script src="/m/uni-1.0.0.1425/ext-sync-min.js"></script>
<script src="/m/unim-1.0.0.1425/locale/ext-lang-es.js"></script>




<script src="/m/uni-1.0.0.1425/jQuery/jquery-1.11.2.min.js"></script>
<script src="/m/unim-1.0.0.1425/touch-unigui-min.js"></script>
<script src="http://maps.googleapis.com/maps/api/js?key=&libraries=geometry,places,visualization&sensor=false"></script>
<link rel=stylesheet href="/../files/uniGmap.css" />
<script src="/../files/markerwithlabel_packed.js"></script>
<script src="/../files/markerclusterer.js"></script>

Cant find WHY. The only details is mine app have both, mobile and desktop forms. Desktop works perfect, the only problem ios mobile.

 

Im testing calling with m at end 

 

http://localhost:8077/m

 

Hope somebod can help.


  • 0

#439 joseroberto

joseroberto

    Member

  • uniGUI Subscriber
  • PipPip
  • 44 posts

Posted 04 July 2018 - 07:48 PM

Hello,

I uploaded a new version which implements the API function getElevationForLocation.

 

 

2017-07-04  v1.4.6
Tested with uniGUI ver.1.0.0.1399


Online demo:
http://79.143.178.31...uniGMapDemo.dll
 

 
Hello, Lema
 
I'm having problems with uniGUI version 1.10.0.1466
The problem is only displayed when published.
 
"Cannot read property 'getElevationForLocations' of undefined"
 
Could you help me, please?
 
Thank you!
 

  • 0

#440 nannoc

nannoc

    Newbie

  • uniGUI Subscriber
  • Pip
  • 9 posts

Posted 04 July 2018 - 09:38 PM

Hi everyone

 

This component worked fine in 10.2.2, but since I updated to 10.2.3 it gives me an error.

 

The map comes up briefly, but then it gives me an error as per attached image.

 

Attached File  Map.png   14.71KB   4 downloads

 

Thank you,

Donald


  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users