Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works

Random project

geopackageViewer

Lazarus program to view and draw geopackages.

View on GitHub

Anyone may press Interesting, signed in or not. It helps others find this project.

Member rating

No ratings yet.

Sign in to rate this project.

README

This project is a Lazarus program for view geopackage files and drawing maps.

uses BGRABITMAP package

Tested on windows only.

In windows requires sqlite3.dll in the program folder and in the lazarus.exe folder. By default maps are drawed using the web mercator projection. EPSG:3857.

Requires library proj8 (versions 6 and 7 also works) installed in the computer and you can draw maps in other projections.

May require changing the path in the call of procedure ProjInit; in the FormCreate event of frmMain.pas unit. and the dll name in proj.pas unit

if you comment {$DEFINE USE_PROJ7} in frmMain.pas then only depends on sqlite3.dll.

Homepage: [www.github.com/DomingoGP/geopackageViewer](https://github.com/DomingoGP/geopackageViewer)

Sites for download free geopackages

[www.naturalearthdata.com](https://www.naturalearthdata.com/downloads/)

BlueMarble tiles

gadm.org

Sample code for drawing a map.

pascal
uses
   
   SQLiteWrap, geopackagewkb, geopackagedrawer, BGRABitmap, BGRABitmapTypes;

{
Data used in this test downloaded from.
https://biogeo.ucdavis.edu/data/gadm3.6/gpkg/gadm36_ESP_gpkg.zip
}

procedure TForm1.btnHighLevelClick(Sender: TObject);
var
  wGeoPackage: TGeoPackage;
  wDrawer: TGeoPackageDrawer;
  //BitmapMapa: TBGRABitmap;
begin
  //BitmapMapa:=TBGRABitmap.Create(1000,1000);
  BitmapMapa.Fill(clWhite);
  wDrawer := nil;
  wGeoPackage := nil;
  try
//wGeoPackage := TGeoPackage.Create('gadm36_ESP.gpkg');
wGeoPackage := TGeoPackage.Create(edGeoPackage.Text);
wDrawer := TGeoPackageDrawer.Create(BitmapMapa, 6, 43.80, -10.00);
wDrawer.DrawFeatures(wGeoPackage, 'gadm36_ESP_1', '', '');  // draw all records in the table.
wDrawer.FillColor := BGRA($255, 200, 200);
wDrawer.DrawFeatures(wGeoPackage, 'gadm36_ESP_1', 'NAME_1', 'fid=11 or fid=13'); //draw items 11 and 13 with label.
wDrawer.DrawLabels;//draw labels at end.
BitmapMapa.Draw(Canvas, 380, 10);
  finally
wGeoPackage.Free;
wDrawer.Free;
    //BitmapMapa.Free;
  end;
end;

screenshoots Test-Project1.png

Geo-Package-Viewer1.png

Geo-Package-Viewer3.png

Geo-Package-Viewer2.png

Geo-Package-Viewer.png