Download the PHP package janpieterk/gemeentekaart-core without Composer

On this page you can find all versions of the php package janpieterk/gemeentekaart-core. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package gemeentekaart-core

GemeenteKaart

Deze documentatie in het Nederlands.


PHP library to create choropleth maps of the municipalities of the Netherlands (default: borders as of 2007, 443 municipalities). Areas can be assigned colors, typically to denote the relative frequency of some phenomenon.

Additional available data: the municipalities of Flanders (308 municipalities), the forty COROP regions of the Netherlands, the twelve provinces of the Netherlands, or the twenty-eight dialect areas of Daan/Blok (1969) mapped on municipality borders.

New in version 1.1

The historical municipality and province borders from the data set NLGis shapefiles by Dr. O.W.A. Boonstra are incorporated in the project. Borders from 1812-1997 are available and can be used via an optional year parameter. Note that no year parameter results in the borders from 2007 from version 1.0. Maps created from the NLGis data set use Amsterdam codes for municipalities (see Van der Meer & Boonstra 2011) while the version 1.0 maps use CBS codes.

Output formats are: SVG (default), PNG, GIF, JPEG, KML, GeoJSON.

Getting Started

To install as a library from github, use this in your composer.json:

To install as a library from packagist.org, leave out the repositories:

To install as a project from github using composer:

To install as a project from packagist.org, leave out the --repository:

Running the PHPUnit tests for gemeentekaart-core:

Basic usage

To color the municipality areas of Amsterdam and Rotterdam from 2007 with red and green, respectively, and create an SVG image:

The code numbers for the municipalities are the official Dutch municipality codes, available at www.cbs.nl, prefixed by g_ so that they can be used as values of HTML or XMD id attributes. Possible codes can be requested by calling the getPossibleMunicipalities() method on a Kaart object created without a year parameter.

To color the areas from 1821 of what are today the four "big cities" of the Randstad area:

The code numbers are Amsterdam codes from Van der Meer & Boonstra 2011, prefixed by a_ so that they can be used as values of HTML or XMD id attributes. Possible codes for a particular year can be requested by calling the getPossibleMunicipalities() method on a Kaart object created with a year parameter.

API

__construct(string $type = 'municipalities', integer $year = NULL)

Default map type is municipalities. Possible map types are: 'municipalities', 'gemeentes', 'corop','provincies', 'provinces', 'municipalities_nl_flanders', 'municipalities_flanders', 'dialectareas'. municipalities is a synonym for gemeentes. provincies is a synonym for provinces. When $year is omitted, the default map for version 1.0 is used, which means the municipality borders of 2007. Use Kaart::getAllowedYears(string $maptype) to find the available years for the given map type.

Examples


setPathsFile(string $paths_file)

Path files are geoJSON files (specification 2008) containing coordinates and names for the features of the map. See the contents of the coords directory for examples. Note that the coordinate system should be EPSG:28992. Only needed if the default paths file for the given map type does not suffice. Warning: file should not be user-submitted as it is used as-is.

Examples


setAdditionalPathsFiles(array $paths_files )

Adds more layers on top of the base map. Typical use case: combining different choropleth types in one map, e.g. municipalities as the base with borders of larger areas drawn on top of them. Restricted to files in the coords directory.

Examples


setIniFile(string $ini_file)

If alternative styling for features of the map is needed. Can be from the ini directory (no full path needed) or from elsewhere. See the ini directory for examples. Warning: file should not be user-submitted as it is used as-is.

Examples


setData(array $data)

$data should be an array containing areas to be highlighted. Area codes are keys, colors are values. See the geoJSON files in the coords directory for area codes or call getPossibleAreas() on a Kaart object. Colors can be either HTML color names, #RRGGBB hex strings, or AABBGGRR hex strings. The AA (opacity) part only has an effect on KML maps.

Examples


setTitle(string $title)

Sets the title of the map. Is shown in-picture, above the map.

Examples


setInteractive(bool $value = true)

Adds JavaScript or title attributes to show area names when hovering. In SVG maps embedded in the map itself and shown using Javascript. A list of <area> tags with title attributes is used to achieve the same effect in bitmap maps. Request this with the getImagemap() method after calling setInteractive().

Examples


setPixelWidth(int $width)

Sets the width of the map in pixels. If not used, width is the default value, defined in the .ini file for the current map type. Default height is defined in the .ini file as a factor. For the default map showing the Netherlands height is e.g. 1.1 times the width.

Examples


setPixelHeight(int $height)

Sets the height of the map in pixels. If you don't want the default height from the .ini file (for the default map of the Netherlands height is e.g. 1.1 times the width), you can overrule it with an absolute value using this method. You probably shouldn't, though. Note that this method should always be called after setPixelWidth().

Examples


setLink(string $link, mixed $target = NULL)

Adds the same link to all areas. %s placeholder will be replaced with the area code. For bitmap maps the links are in <area> elements, which can be obtained by calling the getImagemap() method, for other (textual) formats the links are embedded in the map. The optional parameter $target can be used to create e.g. target="_blank" attributes for the links.

Examples


setLinkHighlighted(string $link, mixed $target = NULL)

Adds the same link to all highlighted areas. %s placeholder will be replaced with the area code. For bitmap maps the links are in <area> elements, which can be obtained by calling the getImagemap() method, for other (textual) formats the links are embedded in the map. The optional parameter $target can be used to create e.g. target="_blank" attributes for the links.

Examples


setLinks(array $data, mixed $target = NULL)

Adds links to areas (potentially a different link for each area). $data should be an array with area codes as keys and links as values.

Examples


setToolTips(array $data)

Adds tooltips to areas. These become 'title' attributes in HTML <area> elements or SVG <path> elements, <description> elements in KML, and 'name' properties in GeoJSON. $data should be an array with area codes as keys and strings as values. Note that if $kaart->setInteractive() was set to TRUE previously, the tooltips overwrite the default area names for the given areas.

Examples


setJavaScript(array $data, string $event = 'onclick')

Adds JavaScript code to areas. Possible values of the $event parameter: onclick, onmouseover, onmouseout. Note (SVG maps only): if $kaart->setInteractive() was set to TRUE previously, any onmouseover or onmouseout events added with this method overwrite the default onmouseover and onmouseout events. $data should be an array with area codes as keys and Javascript code as values.

Examples


array getData()

Returns the current associative array with map data (highlighted areas).

Examples


int getPixelWidth()

Returns the width of the map in pixels.


int getPixelHeight()

Returns the height of the map in pixels.


string getTitle()

Returns the title of the map. Empty string if no title has been set.


string | boolean getImagemap()

For bitmap maps only: returns a string of <area> elements for features of the map, for use in a <map> HTML element. Can only be called after generating a map with the show(), fetch() or saveAsFile() method! Returns FALSE if no bitmap has been generated.


array getPossibleAreas()

Returns an associative array (area codes as keys, area names as values) for the current map object.


array getPossibleMunicipalities()

Synonym for getPossibleAreas() on a map object of type 'municipalities'/'gemeentes'.


void show(string $format = 'svg')

Hands the map over to a web browser for further handling. Depending on the capabilities and settings of the browser, the map will be shown on a page, handed to another application, or downloaded. Possible formats are: 'svg', 'png', 'gif','jpeg', 'jpg', 'kml', 'json'.


string|blob fetch(string $format = 'svg')

Returns the map as a string (SVG, JSON, KML) or binary blob (bitmap image). See show() for possible formats.


bool saveAsFile(string $filename, string $format = 'svg')

Saves the map as a file. See show() for possible formats. Returns TRUE if succeeded, FALSE if failed.


array Kaart::getAllowedMaptypes()

Returns an array of possible map types to be used in the constructor.

Examples


array Kaart::getAllowedFormats()

Returns an array of possible map formats to be used in show(), fetch() or saveAsFile() calls.

Examples


array Kaart::getAllowedYears(string $maptype)

Returns an array of possible years to be used in the constructor for the given maptype.

Examples


References

J. Daan and D.P. Blok (1969). Van randstad tot landrand. Toelichting bij de kaart: dialecten en naamkunde. Bijdragen en mededelingen der Dialectencommissie van de Koninklijke Nederlandse Akademie van Wetenschappen te Amsterdam 37, Amsterdam, N.V. Noord-Hollandsche uitgevers maatschappij.

Meer, Ad van der and Onno Boonstra (2011). Repertorium van Nederlandse gemeenten vanaf 1812, waaraan toegevoegd: de Amsterdamse code. 2de editie. [Den Haag: DANS.] (DANS Data Guides, 2). https://dans.knaw.nl/nl/over/organisatie-beleid/publicaties/DANSrepertoriumnederlandsegemeenten2011.pdf

Acknowledgments


All versions of gemeentekaart-core with dependencies

PHP Build Version
Package Version
Requires pear/xml_util Version >=1.3
worthwhileindustries/geojson-rewind Version *
ext-json Version *
ext-gd Version *
ext-simplexml Version *
ext-dom Version *
ext-imagick Version *
php Version >=8.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package janpieterk/gemeentekaart-core contains the following files

Loading the files please wait ....