1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
| unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
IdHTTP, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
IdHTTP1: TIdHTTP;
procedure Button1Click(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form1: TForm1;
implementation
uses JPEG;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var UnFluxMemoire:TMemoryStream;
s:string;
UnJPEG:TJPEGImage;
begin
//
//http://wms.jpl.nasa.gov/wms.cgi <ServerGetMapUrl>
//?request=GetMap obligatoire, pas de paramètre
//&layers=global_ Nom du layer demandé :global_mosaic_base,modis
//&srs=EPSG:4326 no tag World Wind only supports EPSG:4326
//&width=600 Largeur en Pixels de l'image
//&height=600 Hauteur en Pixels de l'image
//&bbox=-5,45,5,55 Fenêtre de visualisation (Longitude Mini,Latitude Mini, Longitude Maxi, Latitude Maxi)
//&format=image/jpeg Format d'image demandé
//&version=1.1.0 Version demandée
//&styles=
UnFluxMemoire := TMemoryStream.Create;
UnJPEG:=TJPEGImage.create;
try
UnFluxMemoire.Clear;
s:='http://wms.jpl.nasa.gov/wms.cgi?request=GetMap&layers=modis&srs=EPSG:4326&width=512&height=512&bbox=-5,45,5,55&format=image/jpeg&version=1.1.0&styles';
IdHTTP1.Get(s,UnFluxMemoire );
UnFluxMemoire.Seek(0, soFromBeginning);
UnJPEG.LoadFromStream(UnFluxMemoire);
UnJPEG.SaveToFile('C:\temp\France_UK1.jpeg');
UnFluxMemoire.Clear; //Important ! Sinon, l'image suivante n'est pas téléchargée
s:='http://wms.jpl.nasa.gov/wms.cgi?request=GetMap&layers=global_mosaic_base&srs=EPSG:4326&width=512&height=512&bbox=-5,45,5,55&format=image/jpeg&version=1.1.0&styles';
IdHTTP1.Get(s,UnFluxMemoire );
UnFluxMemoire.Seek(0, soFromBeginning);
UnJPEG.LoadFromStream(UnFluxMemoire);
UnJPEG.SaveToFile('C:\temp\France_UK2.jpeg');
UnFluxMemoire.Clear;
s:='http://wms.jpl.nasa.gov/wms.cgi?request=GetMap&layers=global_mosaic_base&srs=EPSG:4326&width=512&height=512&bbox=2.3,48.7,2.4,48.9&format=image/jpeg&version=1.1.0&styles';
IdHTTP1.Get(s,UnFluxMemoire );
UnFluxMemoire.Seek(0, soFromBeginning);
UnJPEG.LoadFromStream(UnFluxMemoire);
UnJPEG.SaveToFile('C:\temp\Paris.jpeg');
finally
UnFluxMemoire.Free;
UnJPEG.Free;
end;
end;
end. |
Partager