Skip to content

makepath/mapshader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

2392b6c · Sep 9, 2022
Dec 16, 2021
Aug 16, 2022
Aug 16, 2022
Feb 4, 2021
Sep 9, 2022
Apr 7, 2022
Aug 16, 2022
Jan 19, 2021
Jan 4, 2022
Mar 9, 2022
Feb 17, 2022
Aug 16, 2022
May 17, 2021
Jan 18, 2022
Aug 4, 2022

Repository files navigation

Mapshader

Test Suite Status PyPI version Downloads License

Simple Python GIS Web Services

  • Create mapshader.MapSource objects and render them as geojson, tiles, or images
  • This project should still be considered experimental
pip install mapshader

Setup Mapshader Conda Environment

conda create -n mapshader python=3.8
conda activate mapshader
git clone [email protected]:makepath/mapshader.git
cd mapshader
pip install -e .

Run Tests

conda activate mapshader
pytest mapshader/tests -sv

Run Flask Server

conda activate mapshader
mapshader serve

>>> * Serving Flask app "flask_app" (lazy loading)
>>> * Environment: production
>>>   WARNING: This is a development server. Do not use it in a production deployment.
>>>   Use a production WSGI server instead.
>>> * Debug mode: on
>>> * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
>>> * Restarting with stat

Mapshader Config (YAML)

While mapshader comes with default services to help with testing, users can create their own services via YAML.

my_services.yaml

---

metadata:
  version: 1

sources:
  - name: Global Elevation Example
    key: elevation-example
    text: Elevation
    description: Global elevation example
    geometry_type: raster
    shade_how: linear
    cmap:
      - white
      - black
    span:
      - 58
      - 248
    raster_padding: 0
    raster_interpolate: linear
    xfield: geometry
    yfield: geometry
    filepath: mapshader/tests/fixtures/elevation.tif
    transforms:
      - name: squeeze
        args:
          dim: band
      - name: cast
        args:
          dtype: float64
      - name: orient_array
      - name: flip_coords
        args:
          dim: y
      - name: reproject_raster
        args:
          epsg: 3857
    service_types:
      - tile

This configuration file can then be passed to the flask server upon startup:

conda activate mapshader
mapshader serve my_services.yaml

>>> * Serving Flask app "flask_app" (lazy loading)
>>> * Environment: production
>>>   WARNING: This is a development server. Do not use it in a production deployment.
>>>   Use a production WSGI server instead.
>>> * Debug mode: on
>>> * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
>>> * Restarting with stat