Skip to content

Instantly share code, notes, and snippets.

View chingchai's full-sized avatar
:octocat:
Focusing

Chingchai Humhong chingchai

:octocat:
Focusing
View GitHub Profile
@justinlewis
justinlewis / postgis2shp.py
Last active October 10, 2022 09:02
A simple script for converting PostGIS tables to shapefiles with ogr2ogr.
#### Author: Justin Lewis
#### This script can be used to export a single pg table to shapefile.
####
#### Developed in a linux environment but should require minimal modification to run on other platforms.
####
#### Dependancies:
###### fwtools (gdal > ogr2ogr), PostGIS database, Python, PyGreSQL
import os, _pg
@nclarkjudd
nclarkjudd / gist:4590681
Created January 21, 2013 23:51
Basic leaflet + tilemill + wax howto
<!DOCTYPE html>
<html>
<head>
<title>HOW TO PUBLISH A SLIPPY MAP</title>
</head>
<body>
This tutorial assumes:
<ul>
<li>You know how to use TileMill</li>
@colemanm
colemanm / qgis_open_photo_action.md
Last active February 3, 2020 20:45
Custom action to link to photos within a GIS feature class.

QGIS Open Image Custom Action

Use this guide to link a path name to a feature's photo in the attribute table.

This assumes you have a column in your data containing the full path to the image you'd like to open (in this example, a field called photo_path).

Create Action

  1. Right click feature class → Properties
  2. On Actions tab:
@kidpixo
kidpixo / PostGIS 2.0 Cheatsheet.md
Last active February 3, 2024 23:56
PostGIS 2.0 Cheatsheet
@thejeshgn
thejeshgn / gis_database_install.md
Last active June 22, 2023 13:58
Postgres9 and PostGIS 2.0 on Ubuntu 12.04 LTS

###STEP0: Ubuntu Ubuntu 12.04 LTS

###STEP1: Install postgresSQL 9.1

apt-get install postgresql-9.1
@mittenchops
mittenchops / loadshp2mongo.py
Last active April 9, 2019 06:13
Loading shapefiles into mongodb. This all actually comes from here: http://geospatialpython.com/ But this is wrapped up a little nicer.
# http://geospatialpython.com/
import json, pymongo, shapefile
from json import dumps
database = 'geo'
connection = pymongo.MongoClient()
db = getattr(connection,database)
def renamesh2json(x):
d = x.split(".")
@rclark
rclark / Issues.md
Last active January 28, 2024 01:18
Leaflet WMS + GetFeatureInfo

There are a bunch of reasons why this is convoluted, mostly in building the URL to make the request:

  1. You have to rely on an AJAX request, this example uses jQuery
  2. To make a GetFeatureInfo request, you must provide a BBOX for a image, and the pixel coordinates for the part of the image that you want info from. A couple of squirrely lines of Leaflet code can give you that.
  3. Output formats. The info_format parameter in the request. We don't know a priori which will be supported by a WMS that we might make a request to. See Geoserver's docs for what formats are available from Geoserver. That won't be the same from WMS to WMS, however.
  4. WMS services return XML docs when there's a mistake in the request or in processing. This sends an HTTP 200, which jQuery doesn't think is an error.
@mdiener21
mdiener21 / geoserver_sld_variable_sub
Created July 3, 2014 21:23
Geoserver SLD variable substitution attribute based color assignment in wms call URL . Simpley add &env=a:000066;b:6666ff to the end of your wms call and you will have dynamically changed the zone "a" color to 000066 and zone "b" color to 6666ff
<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:sld="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" version="1.0.0">
<NamedLayer>
<Name>Study Zones</Name>
<UserStyle>
<Name>Study Zones</Name>
<Title>Default zone style</Title>
<Abstract>Study Zone style</Abstract>
<FeatureTypeStyle>
<Name>Study Zones</Name>
@clhenrick
clhenrick / README.md
Last active April 1, 2024 14:55
PostgreSQL & PostGIS cheatsheet (a work in progress)
@alexgleith
alexgleith / index.html
Last active March 29, 2023 17:24
Simple Leaflet GeoServer Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="initial-scale=1,user-scalable=no,maximum-scale=1,width=device-width">
<title>Example Leaflet</title>
<link rel="stylesheet" href="https://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css">
</head>