Skip to content

Instantly share code, notes, and snippets.

Avatar
🗺️
Mapping

Jorge Sanz jsanz

🗺️
Mapping
View GitHub Profile
@jsanz
jsanz / README.md
Last active Dec 15, 2021
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 Sep 27, 2021
FOSS4G 2021 - PostGIS versioning workshop
@jsanz
jsanz / .gitignore
Last active Sep 27, 2021
FOSS4G 2021: Kart workshop
View .gitignore
workshop
.env
@jsanz
jsanz / README.md
Created Jun 4, 2021
[SPARQL] Country websites ping
View README.md

Ping sites

This is a CSV with country official websites from all the world, and a simple script that randomly access to five of them every five seconds. The objective of this is to hit as many different country IP's as possible.

The CSV is obtained from this SPARQL query to Wikidata:

SELECT 
  ?idLabel 
 (SAMPLE(?website) as ?web) 
@jsanz
jsanz / README.md
Last active Mar 23, 2022
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 / mbtiles_delete_zoom_level.sql
Created Apr 22, 2021 — forked from zhm/mbtiles_delete_zoom_level.sql
Delete zoom levels from an MBTiles file (set max zoom)
View mbtiles_delete_zoom_level.sql
-- change 18 to whatever the max zoom level you want in your MBTiles
DELETE FROM images WHERE
tile_id IN (SELECT tile_id FROM map WHERE zoom_level > 18) AND
tile_id NOT IN (SELECT tile_id FROM map WHERE zoom_level <= 18);
DELETE FROM map WHERE zoom_level > 18;
UPDATE metadata SET value = '18' WHERE name = 'maxzoom';
@jsanz
jsanz / README.md
Last active Dec 5, 2019
Docker wrapper for OGR commands
View README.md

Simple wrappers around docker and OGR commands to expose ogr2ogr and ogrinfo using the latest builds. You need to be careful to always put absolute paths to your local data so the docker image can access it.

@jsanz
jsanz / fix-geometries.py
Created Oct 30, 2019
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 Jan 17, 2022
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 / download-instagram.py
Created Jul 27, 2019
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]: