Jump to content

Google Maps for uniGUI


lema

Recommended Posts

I'm trying to add a function to heatmap, but I can only put them and do not pull them. Anybody have any suggestions?

    procedure TUniGMap.AddHeatMap(aHeatMap: array of THeatMap);
    var
      i: Integer;
      lat, lng: string;
      Script: string;
    begin
      Script :=
        'HeatMap = new google.maps.visualization.HeatmapLayer({' +
        'radius: ' + StringReplace(Format('%2.2f', [aHeatMap[0].Radius]), ',', '.', [rfReplaceAll]) + ',' +
        'data: getPoints(),' +
        'map: @googleMap@' +
        '});' +
        'function getPoints() {' +
        'return [';

        for i := 0 to Length(aHeatMap) -1 do
          if i <> Length(aHeatMap) -1 then
          begin
            lat := StringReplace(Format('%2.6f', [aHeatMap[i].Latitude]), ',', '.', [rfReplaceAll]);
            lng := StringReplace(Format('%2.6f', [aHeatMap[i].Longitude]), ',', '.', [rfReplaceAll]);

            Script := Script + 'new google.maps.LatLng(' + lat + ', ' + lng + '),'
          end
          else
          begin
            lat := StringReplace(Format('%2.6f', [aHeatMap[i].Latitude]), ',', '.', [rfReplaceAll]);
            lng := StringReplace(Format('%2.6f', [aHeatMap[i].Longitude]), ',', '.', [rfReplaceAll]);

            Script := Script + 'new google.maps.LatLng(' + lat + ', ' + lng + ')' +
            '];' +
            '}';
          end;

      ExecJScript(Script);
    end;


    procedure TUniGMap.RemoveHeatmap;
    begin
        ExecJScript(
        'google.maps.event.clearInstanceListeners(HeatMap);' +
        'HeatMap.setMap(null);');
    end;



 

 

Hello,

I will try to implement it.

Stay tuned.

Link to comment
Share on other sites

Hi Lema,

 

I'm try debugging Places API Demo. uniGMap last version.

 
I'm setting my API Key in MyGoogleAPIKey constant but the map does not show, error occurs (see attached image).
I have already Rebuild in the package and the API Key is correct, because testing on the URL directly from the browse shows the results.
 
If i do not inform an API Key, the map is shown, but when performing the search of the places, an Access Denied occurs because an API Key was not informed.
 
Any idea?
 
Thanks!
 
Cristiano

 

post-17-0-52318500-1486515337_thumb.png

Link to comment
Share on other sites

 

Hi Lema,

 

I'm try debugging Places API Demo. uniGMap last version.

 
I'm setting my API Key in MyGoogleAPIKey constant but the map does not show, error occurs (see attached image).
I have already Rebuild in the package and the API Key is correct, because testing on the URL directly from the browse shows the results.
 
If i do not inform an API Key, the map is shown, but when performing the search of the places, an Access Denied occurs because an API Key was not informed.
 
Any idea?
 
Thanks!
 
Cristiano

 

 

Did you enable the "Google Places API Web Service" in your Google console?

 

Also , what is the state of your API Key restriction ?

For debug purposes you can use an unrestricted key to see what happens.

Link to comment
Share on other sites

Did you enable the "Google Places API Web Service" in your Google console?

 

Also , what is the state of your API Key restriction ?

For debug purposes you can use an unrestricted key to see what happens.

 

Yes, API Enabled in Console and my API Key is unretricted Key.

 

Testing on the URL directly from the browse shows the results. The key is active and valid.

Link to comment
Share on other sites

Yes, API Enabled in Console and my API Key is unretricted Key.

 

Testing on the URL directly from the browse shows the results. The key is active and valid.

 

Hello,

It should be working.

 

Try create and use another unrestricted Key (it will need some minutes in order to apply the changes).

Double check that the libraries are enabled (you will need at least Google Maps JavaScript API and Google Places API Web Service ).

 

In the constructor of TUniGMap.Create there is a url defintion, something like :

url := 'http://maps.googleapis.com/maps/api/js?key=' + MyGoogleAPIKey + '&libraries=geometry,places&sensor=false';)

try to remove the 'places' to see what will happen.

 

 

Please see the compiler directive DEBUG and make sure that you place the correct API Key into the correct section.

In most cases you will use the same API Key in DEBUG and RELEASE

{$IFDEF DEBUG}
  MyGoogleAPIKey = 'xxxxxxx';
{$ELSE}
  MyGoogleAPIKey = 'xxxxxxx';
{$ENDIF}

Link to comment
Share on other sites

Hello,

I uploaded a new version which adds some of Heatmap functionality.

 

2017-02-11  v1.4.4

--Added   Heatmap functionality

 

Tested with uniGUI ver.0.99.96.1335

 

Online demo:

http://79.143.178.31/lema/uniGMapDemo.dll

 

post-281-0-75060500-1486774176_thumb.png

 

 

Although it is not a requirement,
I would ask you to send a postcard from your hometown so that you help me grow my collection!
If also you write 2-3 words, it would be perfect!

So, lick your stamp and send your postcard to:

Lefteris Maronikolakis,
Bohali 92,
11524 Athens,
Greece.
 

Link to comment
Share on other sites

 

Hello,

It should be working.

 

Try create and use another unrestricted Key (it will need some minutes in order to apply the changes).

Double check that the libraries are enabled (you will need at least Google Maps JavaScript API and Google Places API Web Service ).

 

In the constructor of TUniGMap.Create there is a url defintion, something like :

url := 'http://maps.googleapis.com/maps/api/js?key=' + MyGoogleAPIKey + '&libraries=geometry,places&sensor=false';)

try to remove the 'places' to see what will happen.

 

 

Please see the compiler directive DEBUG and make sure that you place the correct API Key into the correct section.

In most cases you will use the same API Key in DEBUG and RELEASE

{$IFDEF DEBUG}
  MyGoogleAPIKey = 'xxxxxxx';
{$ELSE}
  MyGoogleAPIKey = 'xxxxxxx';
{$ENDIF}

 

 Hello Lema!

 

Now all work! What happened is that i had activated the Google WebServices API, to be used via REST, but for uniGMap, which uses Javascript must be enabled the Google Places JavaScript API, as you said in your answer.

 
Thanks again for your great work.
 
Best Regards,
 
Cristiano
Link to comment
Share on other sites

  • 1 month later...

Hi to all.

 

I share the uniGMap component.

[Desktop and Mobile versions]

It is based on code I have used in several projects and actually developed to fulfill my needs.

 

It can add , edit , remove , locate markers , lines , polylines , circles , polygons ,

rectangles , directions , KML, infoWindows ,

change several map properties like zoom , type , control visibility etc ,

notify about map events through AjaxEvent like zoom , click , markerclick and

get some object properties like Length , Area etc.

 

 

It is absolutely free and you can use it freely in your own software.

If you make any changes that you believe can help other developers too,

please send them to me to integrate them into uniGMap.

 

You can see it in action here :

http://79.143.178.31/lema/uniGMapDemo.dll

 

 

Although it is not a requirement,

I would ask you to send a postcard from your hometown so that you help me grow my collection!

If also you write 2-3 words, it would be perfect!

 

So, lick your stamp and send your postcard to:

Lefteris Maronikolakis,

Bohali 92,

11524 Athens,

Greece.

 

 

 

latest version: 2017-02-11  v1.4.4

 

This version also for Berlin?

This version also for Berlin?

Link to comment
Share on other sites

  • 2 weeks later...

Hi All

I am getting a error when trying to install on my version of XE4.  [dcc32 Error] UniGMap.pas(1430): E2003 Undeclared identifier: 'MyGoogleAPIKey'

 

Any ideas please.

 

PS

Postcard on its way.

 

Russell

 

 

Hello !

In UniGMap.pas , uncomment the following and set your API key.

//  MyGoogleAPIKey = '';
Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...