/home
mountpoint, and a dearth of space to /
, the root mountpoint. In our example, this meant about 2.1 TB available to the home mount and appx 50 GB to the root mount.
Meanwhile, our default PostGRESql 9.x install on this platform established the database instance to a location on the root mountpoint, which naturally limited it to 50 GB of consumption. While 50 GB [...]
Tuesday March 17, 2015:Socket-served Internet mapping, anyone?
I may or may not be on to something.
For awhile I’ve been growing more and more tired of the typical Internet mapping user experience. It’s basically this: open a map and zoom/pan somewhere, wait a moment while (hopefully) some “working” graphic gives you a clue that the map hasn’t forgot about you; meanwhile, some basemap tiles load, then after a moment or two, “poof!” all the interactive data (i.e. the sole reason you are using that particular map) appears all at once.
Fortunately, in most cases, the basemap tiles “sprinkle in” one by one as they become available, which does give the user an impression that something is happening. But more often than not, basemap tiles [...]
Saturday March 07, 2015:Q: What’s The best way to convert CDs to MP3s in Windows? A: VLC and the Command Line. Here I’ll show ya..
Today my friend (shout out to Nic Zamora) wanted to know if I still had a recording we made of a song he co-wrote way back in ancient history ..like 2007 or something. Gah..
Well it got me to thinking—my other buddy (shout out to Corey Nolan) had a similar request awhile back for a recording we did with his brother, Dustin, around the same time. The problem was, the only recording I had of the latter was on CD. Since then, that one simple deterrent—being on CD—was solely responsible for preventing me from ever “getting around to it”, like I said I would.
The reason I hate ripping CDs is because it’s such a ridiculous process ..first you have to open some asinine software (and God help you if it’s Windows Media Player), click around like a fool, be confused, drag files and/or locate folders, agonize over a variety of settings, many of which you, A) may not know anything about, 2) remember from the last time you did this resulting in inconsistently ripped music, and D) ..worst of all, potentially but unintentionally introduce some weak-sauce copy protection. [...]
Thursday January 22, 2015:Gabriel Weinberg’s PostgreSQL Tips and Tricks
Here’s a solid article on tuning your PostgreSQL instance and optimizing your indexes.
Also, here’s a nice primer on creating and managing indexes in PostgreSQL.
I wanted to share ’em now and save ’em for later.
/E
Tuesday November 25, 2014:ArcPy CalculateField_management Complex Python Expression to Return a String
My coworker was having some trouble implementing a CalculateField expression in Python so I wanted to document the solution for anyone with a similar issue. (Note: If you just want the answer, see the What ultimately worked.. heading, below.)
Being unfamiliar with ArcPy, I was intrigued by this idea of defining a function as a string value, then passing that string as a variable into another function. I can see how that opens a powerful door—but it also strikes me as ultra weird, and because Python has some very particular spacing/indentation rules (as compared to say, JavaScript), I figured this technique would be ultra-prone to syntax issues ..and thus could be especially difficult to troubleshoot. So in this case, I also wanted to demonstrate how I ultimately thought through the problem. [...]
Friday September 26, 2014:Create UTFGrid Tiles from PostGIS Tables
I assume you’re where I was about a week ago. That is, you’ve heard of UTFGrid, and now you want to render your own UTFGrid tiles. Perhaps you found yourself looking at this thread over at GIS.SE, but you don’t want to jump into TileStache just now. Anyway if you’ve got a working installation of GDAL/OGR and Mapnik 2+, complete with Python bindings, I’ll show you what worked for me..
Because this is merely an adaptation of Matthew Perry’s original solution, I highly recommend considering his original blog entry on the topic, complete with discussion points and caveats, before proceeding further! [...]
Wednesday September 24, 2014:OGR VRT: Connect to PostGIS DataSource
I needed an OGR VRT for something and didn’t find a clear example on the web all in one place, so here goes.
Somewhere on your system, create a new file with a .ovf
extension. Inside that file, add some XML like the following to define your PostgreSQL connection:
That name=”WKTGrid” is semantically unrelated here. I have been experimenting with including WKT geometry data in UtfGrid tiles, and that name is relative to my experiments. You can provide most any value for name. However, do note that the layer name is referenced in the ogrinfo command.
Monday September 22, 2014:MySQL Implementation of Google’s Encoded Polyline Algorithm I just noticed someone created a MySQL implementation of Google’s Encoded Polyline Algorithm incorporating some elements of my PostgreSQL/PostGIS approach, specifically, support for multi-part, multi-ring polygon geometries. And this is exciting, at the bottom of his post, Fabien says he’s working on a solution for consuming the Google encoded geometries in Leaflet. Nice! I love open source software! I thought I’d mention the MySQL approach here to help expose Fabien’s solution to English searches and drive a little more traffic to his site. If you can’t read French, Google Translate is your friend! [...] Friday June 06, 2014:Convert Google Maps Polygon (API V3) to Well Known Text (WKT) Geometry Expression There’s dozens of reasons why you might want the Well Known Text (WKT) geometry expression for a Google Maps Polygon object. Assuming you’re using the Google Maps API V3, and you’ve got a variable referencing your Polygon, I’ll suggest two approaches you can take to iterate over the paths and vertices in your Google Maps polygon and return the geometry expression as a Well Known Text string. Add a Simple Utility Method to Your Project Easy enough. Just add the following method to your project. Look below the method for an example of how you’d call it.[...] PG:host=127.0.0.1 user=postgres dbname=gis password=l00per parcels_cama_20140829_pmerc SELECT tms, owner_name, the_wkt FROM parcels_cama_20140829_pmerc
function GMapPolygonToWKT(poly)
{
// Start the Polygon Well Known Text (WKT) expression [...]
Monday January 27, 2014:PostGREsql/PostGIS Implementation of Google’s Encoded Polyline Algorithm
[Edit 30 Jan, 2014]
I added an additional PostGREsql method to perform Polygon encoding by concatenating polygon geometries (delimiter: †) and their inner rings (delimiter: ‡) together into one massive encoded block of ring features. I also provided an example JavaScript method demonstrating how to bring the amalgamated polygon feature encodings into your Google Map.
By some uncanny twist of the fates, I’ve elected to use, had to use, and/or been asked to develop applications that use Google Maps ASCII Encoded Polyline expressions. In previous encounters, I’ve used a PHP class to handle the encoding task, and most recently I wrote a [...]
Friday November 08, 2013:PostGIS: query all multipolygon parcels with at least one hole
I was writing some code to iterate over Well Known Text expressions for polygon features, and I decided I needed to test the most complex edge-case I could think of–multipolygon geometries where at least one of the bound polygons has a hole (i.e. an interior ring).
I ended up with the following query. This seems like the kind of thing I’ll want to reuse later, so I’m noting it here. For good measure, I also use a rudimentary technique to sort the output with the most complicated geometries in the table at the top of the list. Basically, the more “text” it takes to describe the geometry using Well Known Text, the larger and more complex I figure it must be! [...]
Monday August 05, 2013:Install httplib2 to your Preferred Python Runtime after ArcGIS Unceremoniously Hijacks the First Attempt
We’re going to use Google Maps Engine for some stuff, and so I thought I’d throw my first codes at it using Python. Well.. Google’s Python example requires the httplib2 library, so I needed to install that. When I did—following the library’s download/instructions—for some reason, the library went into service against ArcGIS’s embedded Python runtime, rather than my favored 2.7 instance, which I use for every single thing.
::grimaces::
To fix this, I just ensured the new library’s setup.py script was called from my preferred Python runtime rather than let Windows, or some black magic, decide which instance it should integrate with httplib2. [...]
Friday December 28, 2012:osm2pgsql help and usage
I wanted a more convenient place to read the osm2pgsql help output, so this seemed as good a place as any for it. /E
-----------------------------------------------------------------
osm2pgsql -h osm2pgsql SVN version 0.80.0 (32bit id space)
Usage: osm2pgsql [options] planet.osm osm2pgsql [options] planet.osm.{gz,bz2} osm2pgsql [options] file1.osm file2.osm file3.osm
This will import the data from the OSM file(s) into a PostgreSQL database suitable for use by the Mapnik renderer
Options: -a|--append Add the OSM file into the database without removing existing data. -b|--bbox Apply a bounding box filter on the imported data Must be specified as: minlon,minlat,maxlon,maxlat e.g. --bbox -0.5,51.25,0.5,51.75 -c|--create Remove existing data from the database. This is the default if --append is not specified. -d|--database The name of the PostgreSQL database to connect to (default: gis). -i|--tablespace-i [...]Friday December 21, 2012:Resident “lunatic” of LinkedIn Just updated my LinkedIn profile.. This is just TOO FUNNY right now! [image] I totally had to save this for posterity. Unfortunately it will probably disappear before you can say “Jack Robinson”. 8) Tuesday December 18, 2012:mapnik rundemo.exe error: run from within the demo/c++ folder? So I just installed the mapnik 2.0.1 binaries for Windows, and I ran into a “gotcha.” I couldn’t figure this out by Googling, so hopefully this post will help someone. (Be sure to note the embarrassing conclusion.) Specifically, following a fresh mapnik install, rundemo.exe told me this:
C:\mapnik-2.0.1rc0\demo\c++>rundemo.exe usage: ./rundemoNote the first bit: usage: ./rundemoUsually /usr/local/lib/mapnik Warning: ./rundemo looks for data in ../data/,Therefore must be run from within the demo/c++ folder.
ogr2ogr -f “CSV” “E:\4_GIS\NorthArkCartoData\UnitedStates\MO_wkt” “E:\4_GIS\NorthArkCartoData\UnitedStates\USStates.shp” -sql ” SELECT * FROM usstates WHERE STATE_NAME = ‘Missouri’ ” -lco “GEOMETRY=AS_WKT ” -lco “LINEFORMAT=CRLF” -lco “SEPARATOR=SEMICOLON”My buddy at work needed a way to get the WKT geometry definition for a single feature in a shapefile. I thought, “surely this is something we can do with OGR?” Lo’ and behold, yes it was. [image] The script above uses OGR SQL to interrogate a shapefile for one lone feature and, when it’s found, exports the record to a comma separated values (CSV) file (or in this case, a semicolon delimited file). Here’s a quick break down: [...] Sunday November 06, 2011:OpenScales: Coordinate Transformation from Uncommon Projections ———— UPDATE 2.19.2013: It turns out you don’t have to rebuild OpenScales to apply uncommon projections, you can just assign the projection directly to ProjProjection.defs. (See Simon L.’s answer here in the OpenScales user group.) So if I modify my example toward the bottom of the post (at #5), here is how I would apply the alternate, and arguably better, approach. (Fair warning, I haven’t compiled this and tested it yet, the only difference is the first line), but this is how I expect it should be. If it doesn’t work like this, it’s likely ‘cos an instance of ProjProjection needs to be created first, and the defs property of the instance needs to be appended. In other words, if this doesn’t work, follow the line instantiating moNADProj with moNADProj.defs[‘EPSG:102697’] = “+title…. blah blah”; One of these days I’ll make super-sure this is correct. But I didn’t want to forget where I found this, hence updating the post.) [...] Saturday November 05, 2011:Nikon Coolpix 3100 Near Infrared Hack While this post is not in-theme with the stated goals of the blog, I wanted to save my notes somewhere as well as make a URL to show-off for my friends. On the other hand, I’m opimistic my experiment will enable some “eco-minded research”, so perhaps there’s still a loose tether linking this back to the GIS community.. Basically, I hacked my old, 3 megapixel Nikon Coolpix 3100 today so that I could take NIR (near infrared) pictures. The following images serve as a storyboard for the process. 0: The tools and materials involved include (clockwise from bottom-left) —-> small round-nose pliers (my wife uses these for beading) [...] Monday October 17, 2011:Install GDAL on Windows Later posts on this blog will assume a working install of GDAL/OGR, so it’s prudent that I first demonstrate how to get a fresh cut of GDAL/OGR up-and-running on a Windows system. Windows users have a few options for installing GDAL (see this question at gis.stackexchange,which will point you to Christoph Gohlke’s binaries –scroll down to GDAL, and the OSGeo4W Installer, among other approaches). However, I’ll guide you through what works for me, which can be summarized as follows: 1) Install Python 2) Install the GDAL binaries published by Tamas Szekeres 3) Append your environment Path variable [...] Sunday October 16, 2011:Google Maps for Flash/Flex: Dead Man Walking “When life gives you lemons..” Let’s just review the signs: