tailormap-api

Tailormap API

https://github.com/tailormap/tailormap-api

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.8%) to scientific vocabulary

Keywords

tailormap
Last synced: 6 months ago · JSON representation ·

Repository

Tailormap API

Basic Info
Statistics
  • Stars: 2
  • Watchers: 4
  • Forks: 3
  • Open Issues: 1
  • Releases: 30
Topics
tailormap
Created over 4 years ago · Last pushed 6 months ago
Metadata Files
Readme License Citation Security

README.md

Tailormap API

Tailormap API provides the webserver and backend API for the Tailormap frontend. The frontend for the Tailormap viewer and admin interfaces are written in Angular and developed in a separate repository.

If you want to run Tailormap the best starting point is the tailormap-viewer repository with the Angular frontends where you will find a Docker Compose stack which will run the frontends, backend and PostGIS configuration database.

This repository builds a tailormap-api Docker image with only the backend which is used as a base image by tailormap-viewer which adds the static Angular frontend bundle to it to create the final tailormap image with both the frontend and backend in it which only requires a PostGIS database to store configuration.

Development

To develop the backend this Spring Boot application can be run locally.

Prerequisites

To build and run the project, you need to have the following installed:

  • Java 17 JDK
  • Maven 3.9.5 or higher
  • PostGIS configuration database
  • Docker 27.x with buildx 0.17 or higher (this requirement may be skipped if you don't need to build the docker images or build release artifacts)

The quickest way to start the PostGIS database is to check out the Docker Compose stack in tailormap-viewer and start the db container. This opens a port on localhost:5432. If you already have your own database running locally, create a database, user and password all set to tailormap to use that. Beware that Tailormap is only developed and supported with the PostGIS version from the Docker Compose stack.

Running

You can run this application in various ways:

Examples: shell # Set active Maven profiles mvn -Pdeveloping,hal-explorer spring-boot:run # Set active Spring profile mvn -Pdeveloping,hal-explorer spring-boot:run -Dspring-boot.run.profiles=dev,populate-testdata # Set Spring property mvn -Pdeveloping,hal-explorer spring-boot:run -Dspring-boot.run.profiles=dev,populate-testdata -Dspring-boot.run.arguments=--spatial.dbs.connect=true - Using an IDE such as IntelliJ IDEA - Using the runnable jar - Running the docker image as a container shell # using the defaults docker run --rm -it --name tailormap-api -h tailormap-api --network host ghcr.io/tailormap/tailormap-api:snapshot # using a different database URL docker run --rm -it --name tailormap-api -h tailormap-api -e "SPRING_DATASOURCE_URL=jdbc:postgresql://127.0.0.1:5433/tailormaps" --network host ghcr.io/tailormap/tailormap-api:snapshot

You can then point your browser at http://localhost:8080/swagger-ui/index.html to see the frontend API as described by the OpenAPI specification and use the admin backend enabled by Spring Data REST at http://localhost:8080/api/admin/ if you have activated the hal-explorer Maven profile.

The easiest way to see the API in action is to run the tailormap-viewer frontends locally. These can be run with a webpack dev server which will reverse proxy a locally running tailormap-api if you start the frontends with the PROXY_USE_LOCALHOST=true environment variable. Using the frontends you can also use the login form to use the admin APIs, open http://localhost:4201/api/admin/ after logging in as admin to see the HAL explorer (run with the hal-explorer Maven profile).

Basic development procedure

  1. Write your code using the Palantir Java formatting but with 2-space indent
  2. Commit and push your branch to create a pull request
  3. Wait for continuous integration and code review to pass, possibly amend your PR and merge your PR

Make sure you have useful commit messages, any PR with WIP commits will need to be squashed before merge.

To ignore some commits (such as code style changes) in the git blame output, add commit hashes for these commits to .git-blame-ignore-revs and configure Git with: git config blame.ignoreRevsFile .git-blame-ignore-revs

See also QA.

Maven Profiles

Some Maven profiles are defined:

  • macos
    • Sets specific properties for MacOS such as skipping the docker part of the build
    • Activated automagically
  • openbsd
    • Sets specific properties for OpenBSD such as skipping the docker part of the build
    • Activated automagically
  • windows
    • Sets specific properties for Windows such as skipping the docker part of the build
    • Activated automagically
  • release
    • Release specific configuration
    • Activated automagically during Maven release procedure
  • developing
    • Sets specific properties for use in the IDE such as disabling docker build and QA
    • Activated using the flag -Pdeveloping or checking the option in your IDE
  • qa-skip
    • Will skip any "QA" Maven plugins defined with a defined skip element
    • Activated using flag -DskipQA=true
  • hal-explorer
    • Activated using the flag -Phal-explorer
    • Includes the HAL Explorer dependency, available at /api/admin/ after logging in. The HAL Explorer does not support CSRF tokens, so set the tailormap-api.security.disable-csrf property to true (or you can activate the dev Spring profile which sets this property)

Spring profiles

When the default profile is active tailormap-api behaves as deployed in production. If the database schema is empty tables will be created or the existing schema will be updated if necessary by Flyway. When an admin account is missing it is created using a random password which is logged.

See also the comments in the application-(profile).properties files in the resources directory.

Other Spring profiles are useful during development:

  • ddl
    Use manually in development to create the initial Flyway migration script using the metadata from the JPA entities. Use only once before going in production, after that use additional Flyway migration scripts. Warning: all tables in your current tailormap database will be removed!
  • ddl-update
    Use manually in development to create a SQL script to update the current database schema to match the JPA entities. Rename the generated Flyway script to the correct version and give it a meaningful name. The script may need to be modified. If you need to migrate using Java code you can use a Flyway callback (executed before the entity manager is initialized) or add code to TailormapDatabaseMigration.java if you can use the entity manager after all SQL migrations.
  • dev
    Use during development to:
    • Disable CSRF checking, so you can use the HAL explorer with PUT/POST/PATCH/DELETE HTTP requests
    • See stack traces in HTTP error responses
    • See SQL output

Check application-dev.properties for details. * populate-testdata
Activate this profile to insert some test data in the tailormap database (all current data will be removed!). This testdata can be used to test or demo Tailormap functionality and is used in integration tests. It relies on external services which may change or disappear and optionally connects to spatial databases which can be started using Docker Compose (see Spatial database stack).
The class which loads the testdata is PopulateTestData.java. The default admin username and password is tm-admin instead of randomly generated as in the default profile, but you can change it if you expose your environment publicly by specifying a property. * static-only
When this profile is active only the static Angular viewer and admin frontends are served and all other functionality is disabled. This is used for continuous deployment of frontend pull requests.

Spatial database stack

This repository comes with a spatial database Docker Compose stack. It starts the PostGIS, Oracle Spatial and MS SQL Server spatial databases and loads some spatial data. This stack creates a tailormap-data Docker network, but also exposes the databases' listening ports on the host. Note that especially the Oracle container is quite large.

Please make sure you agree to the license terms of the proprietary databases before running them.

When loading testdata with the populate-testdata Spring profile running the spatial database stack is optional and only connected to when the spatial.dbs.connect property is true. If this is not set the JDBC feature sources are still saved in the database (not attached as feature type for layers).

QA

Some quick points of attention:

  • Palantir Java formatting and pom formatting is enforced. This a modified version of the Google Java Format style, but with 2-space indent instead of 4-space (crazy, we know!). Run the following command to reformat your code (an IntelliJ plugin is also available, which unfortunately can't be configured with 2-space indent) and pom file:

mvn spotless:apply mvn sortpom:sort * PMD checks are enforced. Run mvn pmd:check to verify your code.
* The ErrorProne compiler is used * A current release of Maven is required * Java 17 * JUnit 3 and 4 are forbidden * Code is reviewed before merge to the main branch * Javadoc must be valid

To run unit tests which do not need integration with the entity manager and database, run: mvn -Pdeveloping test

Unit tests which use the PostGIS configuration database and the spatial database stack need their class name to end with PostgresIntegrationTest.

Run the following command to run the integration tests. The application is started with the populate-testdata profile automatically, so if you've modified your configuration it will be lost! mvn -Pdeveloping,postgresql verify -Dspring-boot.run.profiles=dev,populate-testdata,postgresql -Dspring-boot.run.arguments=--spatial.dbs.connect=true

Tips and Tricks

  • You can skip CI execution^1 by specifying [skip ci] as part of your commit.
  • You can use mvn -U org.codehaus.mojo:versions-maven-plugin:display-plugin-updates to search for plugin updates
  • You can use mvn -U org.codehaus.mojo:versions-maven-plugin:display-dependency-updates to search for dependency updates

Releasing

Use the regular Maven release cycle of mvn release:prepare followed by mvn release:perform. Please make sure that you use tailormap-api-<VERSION> as a tag so that the release notes are automatically created. For example:

shell mvn clean release:prepare -DreleaseVersion=0.1 -Dtag=tailormap-api-0.1 -DdevelopmentVersion=0.2-SNAPSHOT -T1 mvn release:perform -T1

Owner

  • Name: Tailormap
  • Login: Tailormap
  • Kind: organization
  • Location: Netherlands

Tailormap GIS-viewer. Publish your maps professionally, fast & interactively

Citation (CITATION.cff)

$schema: https://raw.githubusercontent.com/citation-file-format/citation-file-format/main/schema.json
cff-version: 1.2.0
title: Tailormap API
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - name: B3Partners B.V.
    address: Atoomweg 50
    city: Utrecht
    country: NL
    post-code: 3542 AB
    alias: B3Partners
    email: info@b3partners.nl
    website: 'https://www.b3partners.nl'
  - given-names: Mark
    family-names: Prins
    orcid: 'https://orcid.org/0009-0006-1942-7903'
    email: mark@b3partners.nl
    affiliation: B3Partners B.V.
  - given-names: Geert
    family-names: Plaisier
    email: geert@b3partners.nl
    affiliation: B3Partners B.V.
  - given-names: Matthijs
    family-names: Laan
    email: matthijslaan@b3partners.nl
    affiliation: B3Partners B.V.
repository-code: 'https://github.com/Tailormap/tailormap-api'
url: 'https://github.com/Tailormap'
repository: 'https://github.com/Tailormap/tailormap-viewer'
repository-artifact: >-
  https://github.com/Tailormap/tailormap-api/pkgs/container/tailormap-api
abstract: >-
  An online map, tailor-made by you. With your information.
  Published by you.

  You have your own idea of looking at maps. You are the
  professional who knows what the map should be about. Maybe
  you are interested in public space, in parks,
  environmental data or in the intricate networks of
  electricity and water. Probably you want to combine
  different features. But most of all, you are interested in
  showing the information that you need in your work. No
  more, and definitely no less. You can do this with your
  Tailormap GIS-viewer.
keywords:
  - Tailormap
  - webmapping
  - ogc-services
license: MIT

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 2
  • Total pull requests: 404
  • Average time to close issues: about 11 hours
  • Average time to close pull requests: 3 days
  • Total issue authors: 2
  • Total pull request authors: 7
  • Average comments per issue: 1.0
  • Average comments per pull request: 1.66
  • Merged pull requests: 328
  • Bot issues: 1
  • Bot pull requests: 240
Past Year
  • Issues: 2
  • Pull requests: 292
  • Average time to close issues: about 11 hours
  • Average time to close pull requests: 1 day
  • Issue authors: 2
  • Pull request authors: 5
  • Average comments per issue: 1.0
  • Average comments per pull request: 1.82
  • Merged pull requests: 223
  • Bot issues: 1
  • Bot pull requests: 176
Top Authors
Issue Authors
  • dependabot[bot] (1)
  • geertplaisier (1)
  • mprins (1)
Pull Request Authors
  • dependabot[bot] (317)
  • mprins (193)
  • matthijsln (37)
  • steinkobben (13)
  • geertplaisier (8)
  • allcontributors[bot] (5)
  • puckipedia (2)
Top Labels
Issue Labels
infrastructure (2) dependency (1)
Pull Request Labels
infrastructure (278) dependency (202) enhancement (84) bug (52) security (16) tests (10) documentation (5) breaking (5) Stale (3) duplicate (2) removed (1)

Dependencies

.github/workflows/cleanup_and_maintainance.yml actions
  • Mattraks/delete-workflow-runs v2 composite
  • actions/stale v7 composite
  • vlaurin/action-ghcr-prune v0.5.0 composite
.github/workflows/codeql-analysis.yml actions
  • actions/cache v3 composite
  • actions/checkout v3 composite
  • github/codeql-action/analyze v2 composite
  • github/codeql-action/autobuild v2 composite
  • github/codeql-action/init v2 composite
.github/workflows/macos-maven.yml actions
  • actions/cache v3 composite
  • actions/checkout v3 composite
  • actions/setup-java v3 composite
  • codecov/codecov-action v3 composite
.github/workflows/owasp-dependency-check.yml actions
  • actions/cache v3 composite
  • actions/checkout v3 composite
  • actions/setup-java v3 composite
  • github/codeql-action/upload-sarif v2 composite
.github/workflows/qa.yml actions
  • actions/cache v3 composite
  • actions/checkout v3 composite
  • actions/dependency-review-action v3 composite
  • actions/setup-java v3 composite
.github/workflows/release-drafter.yml actions
  • release-drafter/release-drafter v5 composite
.github/workflows/reuse.yml actions
  • actions/checkout v3 composite
  • fsfe/reuse-action v1 composite
.github/workflows/trivy.yml actions
  • actions/cache v3 composite
  • actions/checkout v3 composite
  • actions/setup-java v3 composite
  • aquasecurity/trivy-action 0.8.0 composite
  • github/codeql-action/upload-sarif v2 composite
.github/workflows/ubuntu-maven.yml actions
  • JamesIves/github-pages-deploy-action v4 composite
  • actions/cache v3 composite
  • actions/cache v2 composite
  • actions/checkout v3 composite
  • actions/download-artifact v3 composite
  • actions/github-script v6 composite
  • actions/setup-java v3 composite
  • actions/upload-artifact v3 composite
  • codecov/codecov-action v3 composite
  • docker/login-action v2 composite
  • postgres 14-alpine docker
.github/workflows/windows-maven.yml actions
  • actions/cache v3 composite
  • actions/checkout v3 composite
  • actions/setup-java v3 composite
  • codecov/codecov-action v3 composite
Dockerfile docker
  • eclipse-temurin 11.0.17_8-jre build
build/ci/docker-compose.yml docker
  • docker.b3p.nl/b3partners/tailormap-data_oracle snapshot
  • docker.b3p.nl/b3partners/tailormap-data_postgis snapshot
  • docker.b3p.nl/b3partners/tailormap-data_sqlserver snapshot
pom.xml maven
  • org.junit:junit-bom 5.9.2 import
  • com.microsoft.sqlserver:mssql-jdbc
  • com.oracle.database.jdbc:ojdbc11
  • io.micrometer:micrometer-registry-prometheus
  • io.sentry:sentry-jdbc 6.11.0
  • io.sentry:sentry-spring-boot-starter 6.11.0
  • io.swagger.core.v3:swagger-annotations 2.2.8
  • nl.b3p.tailormap:tailormap-persistence 10.1
  • org.apache.commons:commons-lang3
  • org.gaul:modernizer-maven-annotations 2.5.0
  • org.gaul:modernizer-maven-annotations
  • org.geotools.jdbc:gt-jdbc-oracle 28.0
  • org.geotools.jdbc:gt-jdbc-postgis 28.0
  • org.geotools.jdbc:gt-jdbc-sqlserver 28.0
  • org.geotools.xsd:gt-xsd-core 28.0
  • org.geotools.xsd:gt-xsd-gml3 28.0
  • org.geotools:gt-cql 28.0
  • org.geotools:gt-epsg-hsql 28.0
  • org.geotools:gt-geojson-core 28.0
  • org.geotools:gt-http 28.0
  • org.geotools:gt-jdbc 28.0
  • org.geotools:gt-main 28.0
  • org.geotools:gt-metadata 28.0
  • org.geotools:gt-opengis 28.0
  • org.geotools:gt-referencing 28.0
  • org.geotools:gt-wfs-ng 28.0
  • org.geotools:gt-xml 28.0
  • org.hibernate:hibernate-micrometer
  • org.hsqldb:hsqldb
  • org.locationtech.jts:jts-core 1.19.0
  • org.postgresql:postgresql
  • org.springframework.boot:spring-boot-starter-actuator
  • org.springframework.boot:spring-boot-starter-aop
  • org.springframework.boot:spring-boot-starter-data-jpa
  • org.springframework.boot:spring-boot-starter-security
  • org.springframework.boot:spring-boot-starter-validation
  • org.springframework.boot:spring-boot-starter-web
  • org.springframework.hateoas:spring-hateoas
  • org.webjars:swagger-ui 4.15.5
  • org.webjars:webjars-locator-core
  • nl.b3p.tailormap:tailormap-persistence 10.1 test
  • org.junit-pioneer:junit-pioneer 1.9.1 test
  • org.springframework.boot:spring-boot-starter-test test
  • org.springframework.security:spring-security-test test
.github/workflows/process-test-results.yml actions
  • EnricoMi/publish-unit-test-result-action v2 composite
  • dawidd6/action-download-artifact 268677152d06ba59fcec7a7f0b5d961b6ccd7e1e composite