Oct 3, 2018

Stack font awesome icons with openlayers

I'm using fontawesome 4.7 and openlayers 5.2 in my project and wanted to create the stacked icon effect.  Basically I want to have two font icons on top of each other.  My code example is using a red circle for the background and a black flag for the foreground.


My first codepen attempt worked out not so bad:
NOTE this is broken for openlayers versions 4.4.+ to 4.6.5:
OL BUG fix https://github.com/openlayers/openlayers/issues/7675
**CLICK RERUN**  bottom right inside codepen
if you cannot see a red circle with a flag

See the Pen stack font-awesome fonts openlayers by Michael Diener (@mdiener21) on CodePen.
If you just want to see the javascript part I also created a github gist
CODE

Apr 19, 2018

My Geo Web Application Development Tech Stack

I thought that it would be interesting to post a list of technologies that I use in my so called "technology stack".  The day to day work happens in Ubuntu, PyCharm, Visual Studio Code, Postgresql (PgAdmin 4) all from my Dell XPS 15 9560. My old Dell Precision m4500 lasted 7 years until the harddrive failed.  It is still alive with a new 512 GB SSD and running Ubuntu, sorry Windows.



Apr 10, 2018

How to backup Postgresql DB to an FTP site using Python

Using the standard tools of Postgresql pg_dump and Python's subprocess module we can call the command line tool via Python and have the dump file uploaded to an FTP site.  This is of course a very simple way to backup.

An alternative would be to use Pgbarman https://www.pgbarman.org/ which is a higly effective way to minimize data loss.

Here you go:


Feb 11, 2018

How to create a regular survey grid with PostGIS

A fishnet grid is also commonly called a: survey grid, raster sample, sample grid, grid, landscape grid, grid reference and of course fishnet.



It all depends on your field of expertise as to what you call it, I know some times in biology they use the term "landscape grid".

If you are the data analyst, gis analyst or even coop student who is assigned the job of creating such a sample grid as a set of polygons using Postgresql with PostGIS here is the function you could create in the database.

As you see in the GIST here there is also sample sql select query that would generate the data for you using the default start location of x= 0.0 and y=0.0.

The input parameters are as follows:

  1. number of rows of the grid
  2. number of columns of the grid
  3. start x coordinate (optional, default is 0.0)
  4. start y coordinate (optional, default is 0.0)
  5. row width in meters (if coordinates are a meter based system)
  6. column width in meters (if coordinates are in a meter based system)
You could run this query in in QGIS and visualize the result immediately and save as a Shapefile using the QGIS "save as" functionality.

have fun generating your fishnet :)

source: https://trac.osgeo.org/postgis/wiki/UsersWikiCreateFishnet

Michael

Jan 30, 2018

AGEO 2018 Presentation

I am invited to present indrz at the annual AGEO 2018 http://www.ageo.at Österreichischer Dachverband für Geographische Information (Austrian Umbrella Organization for Geographic Information).  Presentation 28.02.2018 is now available for download and viewing:   https://goo.gl/4mchWX



Dec 21, 2016

How to create Django translations for django-rosetta from a model field

How to create Django translations from a model field for django-rosetta?



I am using Django-Rosetta to handle all of my project translations.  Unfortunately I have only one model and one field of data that needs translation, the name of the POI.  To get around this I have created a little script to query my Django Database directly to deliver the list of names to be translated.  The output is a new html file with "trans" tags.  This html file is then placed in my templates folder so that "makemessages" can find the file and mark them for translation.

Anytime I want to update this I can run this script and bingo, new template file and new translations.

Note to self:  When adding msgid and msgstr  by hand the command "makemessages" will remove them in the .po file every time the command is called.


Sep 13, 2016

CORS with Geoserver 2.9.0 and Tomcat


How to enable CORS on your Geoserver 2.9.0 running on Tomcat.


This is taken directly from the tomcat homepage https://tomcat.apache.org/tomcat-7.0-doc/config/filter.html#CORS_Filter


add the following code to your  web.xml  file then stop/start the tomcat process

service tomcat stop
service tomcat start

<filter>
  <filter-name>CorsFilter</filter-name>
  <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
  <init-param>
    <param-name>cors.allowed.origins</param-name>
    <param-value>*</param-value>
  </init-param>
  <init-param>
    <param-name>cors.allowed.methods</param-name>
    <param-value>GET,POST,HEAD,OPTIONS,PUT</param-value>
  </init-param>
  <init-param>
    <param-name>cors.allowed.headers</param-name>
    <param-value>Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers</param-value>
  </init-param>
  <init-param>
    <param-name>cors.exposed.headers</param-name>
    <param-value>Access-Control-Allow-Origin,Access-Control-Allow-Credentials</param-value>
  </init-param>
  <init-param>
    <param-name>cors.support.credentials</param-name>
    <param-value>true</param-value>
  </init-param>
  <init-param>
    <param-name>cors.preflight.maxage</param-name>
    <param-value>10</param-value>
  </init-param>
</filter>
<filter-mapping>
  <filter-name>CorsFilter</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>