Skip to content

Instantly share code, notes, and snippets.

@geographika
geographika / nuclear-power-stations.map
Created November 1, 2022 17:17
Mapfile for Day 1 of 2022 #30DayMapChallenge: Points
MAP
NAME "Nuclear Power Map"
EXTENT -1622777.025136114 5036320.52109153 2617519.4114628565 8597992.10957372
PROJECTION
"init=epsg:3857"
END
SYMBOL
NAME "nuclear"
TYPE PIXMAP
IMAGE "nuclear-power-plant.png"
@geographika
geographika / arcobjects_python.py
Created April 17, 2011 11:31
ArcObjects and Python
def AppendPaths(paths):
"""Append all the paths with DLLs to be used by the script to the Python Path"""
import sys
for p in paths:
sys.path.append(p)
def AddReferences(refs):
"""Add references to the required DLLs"""
import clr
@geographika
geographika / ogr2ogr_ZMs.txt
Created May 21, 2020 19:14
Convert "3D Multi Line String" geoms to "Geometry: 3D Measured Multi Line String" (add measures) in a spatialite db using ogr2ogr
-- Convert "3D Multi Line String" geoms to "Geometry: 3D Measured Multi Line String" (add measures)
-- in a spatialite db using ogr2ogr
ogr2ogr -update -f "SQLite" db.sqlite db.sqlite -nln "OutputGeomsZM" -sql "SELECT ObjectId, geom FROM SourceTable" -overwrite -nlt MULTILINESTRINGZM
ogrinfo db.sqlite OutputGeomsZM -so
import re
import os
import glob
# https://stackoverflow.com/questions/53082965/how-can-i-match-a-restructuredtext-code-block-with-regex-and-python
def update_index_directive(directive):
"""
root@php-mapscript:/build/mapserver/build# sudo cmake .. -DCMAKE_BUILD_TYPE=Release \
> -DWITH_CLIENT_WFS=ON \
> -DWITH_CLIENT_WMS=ON \
> -DWITH_CURL=ON \
> -DWITH_GDAL=ON \
> -DWITH_GIF=ON \
> -DWITH_ICONV=ON \
> -DWITH_KML=ON \
> -DWITH_LIBXML2=ON \
> -DWITH_OGR=ON \
This file has been truncated, but you can view the full file.
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 4.0.0
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
* changes to this file unless you know what you are doing--modify the SWIG
* interface file instead.
* ----------------------------------------------------------------------------- */
This file has been truncated, but you can view the full file.
%includefile "/usr/share/swig/4.0.0/swig.swg" %beginfile
/* -----------------------------------------------------------------------------
* swig.swg
*
* Common macro definitions for various SWIG directives. This file is always
* included at the top of each input file.
* ----------------------------------------------------------------------------- */
/* -----------------------------------------------------------------------------
* User Directives
@geographika
geographika / wms_tester.py
Created June 23, 2012 15:03
A Python script to automatically check WMS services return images, and check images are not blank.
"""
Copyright (C) 2012 S. Girvin
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
@geographika
geographika / ows_user.py
Created August 24, 2016 21:00
Sample OWS user for Locust
"""
To run, edit layer name, host, application path and bounding boxes.
Then:
locust -f ows_user.py --host=http://ubuntu-mapserver
http://localhost:8089
"""
from locust import HttpLocust, TaskSet, task
@geographika
geographika / nosetemplate.py
Created October 10, 2012 18:35
node template sample
from nose.plugins import Plugin
class HtmlOutput(Plugin):
"""
This is the plugin class
A simple HTMLPlugin can be seen at https://github.com/nose-devs/nose/blob/master/examples/html_plugin/htmlplug.py
However this does not use templates
"""
pass