Jump to content

Google Map Panel


patmap

Recommended Posts

I use the 'Static Map' API to display a map whilst browsing through a table/query containing postcode data.

A TuniUrlFrame (urlMap below) takes care of the drawing.

2 checkboxes (chkRoad, chkSat) allow the user to select the type of view

 

 

procedure TfrmCustBrow.drawmap(centre,zoom : string);

var

imgW,imgH, MapType : string;

begin

imgW := inttostr(urlMap.width);

imgH := inttostr(urlMap.height);

if (chkRoad.Checked) and (chkSat.Checked) then

MapType := 'hybrid'

else

if chkRoad.Checked then MapType := 'roadmap'

else

if chkSat.Checked then Maptype := 'satellite'

else

Maptype := 'terrain';

 

urlMap.URL := 'http://maps.google.co.uk/maps/api/staticmap?center=' + Custpcode +

'&zoom=' + zoom + '&size=' + imgW +'x'+ imgH +'&maptype=' + MapType + '&sensor=false&markers=color:Red|' + Custpcode;

end;

 

Zoom is controlled by a TUniTrackBar

 

procedure TfrmCustBrow.trckZoomChange(Sender: TObject);

begin

drawmap(custPcode,inttostr(trckZoom.position));

end;

 

 

For more functionality - like routeing I use a full URLwindow (frmMap1 in the example) display

with a start address (sStartAdd) and destination address (custPcode) defined

 

Procedure TfrmCustBrow.btnMapClick(Sender: TObject);

begin

with frmMap1 do

begin

urlframe.URL := 'http://maps.google.com/maps?saddr=' + sStartAdd + '&daddr=' + custPcode;

show;

end;

end;

 

 

I expect lots of clever stuff is possible using the full mapping API but these 2 methods provide some useful stuff and are very easy to implement.

- Google do impose a 'fair usage' limit on the Static API calls. If you have 10000 postcodes and browse up and down the list plotting each in turn you will find they stop providing data for a bit.

 

Hope this helps

Link to comment
Share on other sites

Hi,

 

Thank you HarryG for your answer,

 

This is good for putting Google Map in Frame, very good idea.

 

But how can i use Google Maps futures!?

 

Such as: Add Marker, Add Line, Get Zoomed Event, ...

 

Thank you very much again for answering.

 

Best Regards

 

Babak Yaghoobi

Link to comment
Share on other sites

I next build I will add a Google maps demo based on TUniHTMLFrame.

 

Very Very Thank you Mr. Farshad.

 

Please add DrawLine and AddMarker with Marker ID for moving markers on map.

 

Thank again.

 

Best Regards

Babak Yaghoobi

Link to comment
Share on other sites

Hi, Mr. Farshad

 

This is the best Class for display Google Map with many futures:

addMarker, addMarkers, addPolyline, createInfoWindow, clearMarkers, showMarkers, hideMarkers, addMapControls, getCenter

 

and Events: onMapReady, onResize

 

https://github.com/V...JS.ux.GMapPanel

 

This project have a two file Ext.ux.GMapPanel.js and Ext.ux.GMapPanel3.js that

Ext.ux.GMapPanel3.js file work with Ext.3.3

 

Thank you

 

Best Regards

Link to comment
Share on other sites

  • Administrators

Well, I will not add a full featured Google Maps component. It is beyond our scope. In future we may add such components but for now we need to take care of more important tasks.

Google maps is one of hundreds of things that can be done on client side using Ext JS and client events. I will try to create a demo and leave the rest of exercise to the developers.

Link to comment
Share on other sites

Hi,

 

If you will give us a base class for develope uniGUI components we help you for develope meny components and add in uniGUI and share with other developers.( Such as Delphi )

 

Thank you,

Best Regards

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...