Skip to content

Instantly share code, notes, and snippets.

Avatar
🗺️
Mapping

Jorge Sanz jsanz

🗺️
Mapping
View GitHub Profile
@jsanz
jsanz / README.md
Last active March 24, 2023 20:08
Python: get FOSS4G 2022 abstracts into a JSON file
View README.md

This simple scripts scraps the FOSS4G Community Review pages to convert the abstracts into a JSON file that will contain for each abstract:

  • Page number
  • Title
  • Abstract in HTML
  • Your score if it exists

Requirements: Python 3, [BeautifulSoup][bs], and [Requests][req]

It expects a FOSS4G_ID environment variable that is the variable part of the URL that you get when you sign in for the community review: https://talks.osgeo.org/foss4g-2022/p/voting/talks/{FOSS4G_ID}?.

@jsanz
jsanz / download-instagram.py
Created July 27, 2019 15:49
Python: Download Instagram pictures
View download-instagram.py
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
get_ipython().system('pip3 install -U InstagramApi')
# In[37]:
@jsanz
jsanz / fix-geometries.py
Created October 30, 2019 16:40
Python - QGIS - Fix geometries
View fix-geometries.py
"""
Small script to fix geometries of the first file argument
using the native QGIS processing algorithm. You may need
to adjust the path to you installation.
"""
import sys
sys.path.append('/usr/share/qgis/python/plugins')
from processing.core.Processing import Processing
@jsanz
jsanz / docker-compose.yml
Last active January 17, 2022 13:03
Docker Compose: Elastic Search/Kibana 7.4 cluster
View docker-compose.yml
# Minimal Docker Compose cluster for ElasticSearch and Kibana 7.4
# Put this file any folder creating "logs" and "esdata" folders
# to persist the cluster indices and kibana state
version: "3"
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.4.0
container_name: elasticsearch
ports:
@jsanz
jsanz / README.md
Last active January 9, 2022 23:57
Analysis example: Voronoi on CartoDB
View README.md

This example loads a CartoDB layer using a crazy SQL from a small variation of this awesome Stack Overflow response. Note the use of CSS style tags for the CartoCSS to allow easy editing.

The uncompressed (and not perfect!) version of the SQL to draw the Voronoi diagram is:

WITH 
    Sample AS (
      SELECT st_setsrid(st_union(the_geom),0) as geom 
      FROM registro_centros_nz WHERE spanish = 1
    ),
@jsanz
jsanz / README.md
Last active December 15, 2021 15:43
FOSS4G 2021: pg_tileserv and pg_featureserv workshop
View README.md

Building a cartographic web application with pg_tileserv and pg_featureserv

  • Workshop materials.
  • Reused the postgis Docker Compose template from previous workshop
  • Reused also the osgeo/gdal container to use ogr2ogr on the downloaded shapefiles.
  • Added pg_featureserv and pg_tileserv Docker images passing the .toml configurations as part of the command setting.
  • Added an nginx service to the compose file for the HTML files.
  • Played with different HTML pages that load tiles from pg_tileserv and displays them using OpenLayers.
  • Created a view that returns random points.
@jsanz
jsanz / .gitignore
Last active September 27, 2021 18:00
FOSS4G 2021: Kart workshop
View .gitignore
workshop
.env
@jsanz
jsanz / .gitignore
Last active September 27, 2021 17:59
FOSS4G 2021 - PostGIS versioning workshop
@jsanz
jsanz / README.md
Last active August 25, 2021 06:18
CARTO VL + Airship + Vue component
View README.md

Minimal example on how to wrap Airship components as a Vue ones and then use them on a CARTO VL visualization. This just outlines the procedure explained in the Airship + Vue guide.

On this minimal example a layer switcher component is used to handle the UI so it only knows about its state, and then emits input methods to the parent Vue instance to allow mapping the boolean property of the sweitcher and then react to changes on it on the layer.

A range slider is used twice (to show component reusability) to allow filtering the visualization by a couple of fields.

Check also how the isLayerVisible computed variable is used for conditional rendering of several classes and widgets disable.