Jump to content

Google Maps for uniGUI


lema

Recommended Posts

Hello! The problem only occurs only when I use bookmark with label of type TMarkerEX, when replaced by TMarker, the problem does not appear.

 

Hello.

Please check that you have latest markerwithlabel_packed.js in the corresponding /files directory.

(You can find this library in the uniGMap package)

Link to comment
Share on other sites

 

Hello, I created this new procedure, so that there is no waypoint limit, google limits it by 25 points.
Only I can not remove after I have created. can you help me?? To remove all created routes. With the procedure "RemoveAllRoutes" deletes only the last route created ..
 
procedure TUniGMap.RouteUnlimitedWaypoints(DirectionsRequest: TDirectionsRequest);
...

end;

 

 

Hello,

can you please upload a working sample in order to look at it ?

Link to comment
Share on other sites

  • 2 weeks later...
Good Night, I'm trying to make UnigMap work to get the location. I did exactly as in the DEMO example, however Firefox has the following error "ReferenceError: GeolocationAPIForm is not defined", and I can not figure out what is missing. Because in the DEMO being compiled in my machine it works perfectly, however in my APP it does not work appearing the informed message.
 
Can anyone help me if I can?
 
 
Unigui v1.0.0.1397 is used.

 

Link to comment
Share on other sites

 

Good Night, I'm trying to make UnigMap work to get the location. I did exactly as in the DEMO example, however Firefox has the following error "ReferenceError: GeolocationAPIForm is not defined", and I can not figure out what is missing. Because in the DEMO being compiled in my machine it works perfectly, however in my APP it does not work appearing the informed message.
 
Can anyone help me if I can?

 

 

Do you create the GeolocationAPIForm as a Free or as Application Form?

How do you call the GeolocationAPIForm ?

Can you provide a working example ?

Link to comment
Share on other sites

Do you create the GeolocationAPIForm as a Free or as Application Form?

How do you call the GeolocationAPIForm ?

Can you provide a working example ?

 
1. I am using the Application Form;
2. I call the form like this:
Procedure TMainForm.aclFormatExecute (Sender: TObject);
Var frmPainel_Fornecedor: TfrmPainel_Fornecedor;
Begin
   FrmPainel_Fornecedor: = TfrmPainel_Fornecedor.Create (UniApplication);
   FrmPainel_Fornecedor.ShowModal;
End;
 
3. I used the same way, the same DEMO code, I included a UniGMap, and a button to load the code.
Button Code:
 
Procedure TfrmPainel_Fornecedor.UniButton1AjaxEvent (Sender: TComponent; EventName: string; Params: TUniStrings);
Var
  AMarker: TMarker;
Begin
  If EventName = 'CurrentPosition' then
  Begin
    //UniMemo1.Text: = (EventName + # 13 # 10 + Params.Text);


    UniGMap1.RemoveAllMarkers;


    With aMarker
    Begin
      Id: = 1;
      Latitude: = StrToFloat (Params.Values ​​['lat'], MainForm.fs);
      Longitude: = StrToFloat (Params.Values ​​['lng'], MainForm.fs);
      Title: = 'Here I am!';
      Animation: = maNone;
      Clickable: = True;
      Draggable: = False;
      RaiseOnDrag: = False;
    End;
    UniGMap1.AddMarker (aMarker, True);
  End;
End;


Procedure TfrmPainel_Fornecedor.UniButton1Click (Sender: TObject);
Begin
  UniSession.AddJS (
    'If (navigator.geolocation) {' +
    'Navigator.geolocation.getCurrentPosition (function (position) {' +
    'AjaxRequest (GeolocationAPIForm.UniButton2, "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' +
    ']);' +
    (I.e.
    ');

End;
UniGMap, I did exactly the same settings as DEMO, copied and pasted.
It loads the map, but when doing the GeoLocation, the error that I pointed out above in the original message appears.
Link to comment
Share on other sites

 

 
1. I am using the Application Form;
2. I call the form like this:
Procedure TMainForm.aclFormatExecute (Sender: TObject);
Var frmPainel_Fornecedor: TfrmPainel_Fornecedor;
Begin
   FrmPainel_Fornecedor: = TfrmPainel_Fornecedor.Create (UniApplication);
   FrmPainel_Fornecedor.ShowModal;
End;
 
3. I used the same way, the same DEMO code, I included a UniGMap, and a button to load the code.
Button Code:
 
Procedure TfrmPainel_Fornecedor.UniButton1AjaxEvent (Sender: TComponent; EventName: string; Params: TUniStrings);
Var
  AMarker: TMarker;
Begin
  If EventName = 'CurrentPosition' then
  Begin
    //UniMemo1.Text: = (EventName + # 13 # 10 + Params.Text);


    UniGMap1.RemoveAllMarkers;


    With aMarker
    Begin
      Id: = 1;
      Latitude: = StrToFloat (Params.Values ​​['lat'], MainForm.fs);
      Longitude: = StrToFloat (Params.Values ​​['lng'], MainForm.fs);
      Title: = 'Here I am!';
      Animation: = maNone;
      Clickable: = True;
      Draggable: = False;
      RaiseOnDrag: = False;
    End;
    UniGMap1.AddMarker (aMarker, True);
  End;
End;


Procedure TfrmPainel_Fornecedor.UniButton1Click (Sender: TObject);
Begin
  UniSession.AddJS (
    'If (navigator.geolocation) {' +
    'Navigator.geolocation.getCurrentPosition (function (position) {' +
    'AjaxRequest (GeolocationAPIForm.UniButton2, "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' +
    ']);' +
    (I.e.
    ');

End;
UniGMap, I did exactly the same settings as DEMO, copied and pasted.
It loads the map, but when doing the GeoLocation, the error that I pointed out above in the original message appears.

 

 

 
The error was because I did not change the name of the form and the name of the button in the code:
Procedure TfrmPainel_Fornecedor.UniButton1Click (Sender: TObject);
Begin
   UniSession.AddJS (
     'If (navigator.geolocation) {' +
     'Navigator.geolocation.getCurrentPosition (function (position) {' +
     'AjaxRequest (GeolocationAPIForm.UniButton2, "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' +
     ']);' +
     (I.E.
     ');


End;

I changed GeolocationAPIForm.UniButton2 by frmPainel_Fornecedor.UniButton1 and it worked correctly.

 

Tanks

Link to comment
Share on other sites

Hi Lema, great component, thank you for the work.

Can i ask you afew question?

 

1) How can i pan to show all the items on the map? I believe panto polyline do that but only pan to the latest point. I test on your sampel and do the same. by Example if the zoom selected put some point soff the view and apply 

 

  UniGMap1.PanToPolyline(1);

 

It only pans to the last point of the polyline, Same for a polygon, Theres no way to show all the points in the map autoadjusting the zoom?

 

2) AddmarkerEX do nothing here, cant find why.

 

Best regards.

Link to comment
Share on other sites

Hi Lema, great component, thank you for the work.

Can i ask you afew question?

 

1) How can i pan to show all the items on the map? I believe panto polyline do that but only pan to the latest point. I test on your sampel and do the same. by Example if the zoom selected put some point soff the view and apply 

 

  UniGMap1.PanToPolyline(1);

 

It only pans to the last point of the polyline, Same for a polygon, Theres no way to show all the points in the map autoadjusting the zoom?

 

2) AddmarkerEX do nothing here, cant find why.

 

Best regards.

 

Hello,

 

1. You can use the procedure fitBounds (this has been implemented in the latest version 1.4.7).

 

2. Check the existence of the file markerwithlabel_packed.js. It must be located into /files directory.

Link to comment
Share on other sites

Hello,

I uploaded a new version which implements the API method fitBounds.

The fitBounds sets the viewport to contain the given bounds.

procedure TUniGMap.fitBounds(sw, ne: TPoints2D);
//sw : South-West corner (Bottom-Left)
//ne : North-East corner (Top-Right)

There is also a new form in the demo , showing the usage of the new procedure.

 

 

 

2017-08-13  v1.4.7
Tested with uniGUI ver.1.0.0.1404


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

Link to comment
Share on other sites

Captura%20de%20pantalla%202017-08-11%20aTheres any way to do some like this? markers with numbers inside? The image is from devexpress library.

 

 

 

Best regards.

 

You can try to customize your marker with CSS.

See at the demo->Markers with Label

Link to comment
Share on other sites

Dear Lema, First of all thank you very much for your help!!! I have a KML file loaded ok, with several polygons, my question is it possible to search for a particular polygon, can it be searched for by some characteristic? Thank you so much

 

mmurgas

Link to comment
Share on other sites

Hi 

 

What causes this error ?

In a existing project my gmap works, in new one

i got this message

 

regards Peter

 

Hello, is the problem solved ?

 

 

 

In general :

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.

 

Also, please make sure that you have the required JS files in the /files directory

markerclusterer.js

markerwithlabel_packed.js

 

Link to comment
Share on other sites

Dear Lema, First of all thank you very much for your help!!! I have a KML file loaded ok, with several polygons, my question is it possible to search for a particular polygon, can it be searched for by some characteristic? Thank you so much

 

mmurgas

 

Hello

- please correct me if I am mistaken -

but I don’t have see any Google Maps API call for searching in KML Layers.

 

Why don't you parse and traverse the KML file like any other XML?

Link to comment
Share on other sites

Dear Lema,

 

Is there any function to know if a point is contained in a kml polygon?

 

Thank's

 

Hello.

AFAIK, there is no any Google Maps API function to solve the Point-In-Polygon problem.

You have to find a suitable algorithm via searching the internet.

 

You can try:

https://www.google.gr/search?q=Point-In-Polygon

https://gis.stackexchange.com/search?q=Point-In-Polygon

 

Personally, I have used the spatial functions of MySQL.

Link to comment
Share on other sites

  • 3 weeks later...

Hey Friends,

 

I have the following problem: 'MarkerWithLabel is not defined'. I've already taken a look at your post and I've already taken the following steps:

- I created the files folder in the project and put the javascript files there.

- I put the path of these files in the custom files inside the ServerModule.

- I put an instance of TUniGMap inside the Main Form

- I uninstalled and reinstalled the component and deleted all of its requirements

Despite everything I've done, the problem persists. I currently have the latest version of the installed component. Is there any other idea about what might be causing the problem? My Unigui version is the v.1.0.0.1383.

Link to comment
Share on other sites

Hello everyone.

 

I need to get the upper left point (Lat, Long) and the lower right point of the map that is being displayed, any idea how to do it.

 

regards

 

You can use the procedure getBounds (implemented in the latest v1.4.8).

Link to comment
Share on other sites

Hello,

I uploaded a new version which implements the API method getBounds.

The getBounds returns the lat/lng bounds of the current viewport.

// swlat,swlng : south-west coordinates (Bottom-Left)
// nelat,nelng : north-east coordinates (Top-Right)

2017-09-15  v1.4.8
Tested with uniGUI ver.1.0.0.1410


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

Link to comment
Share on other sites

  • 2 weeks later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...