Showing posts from October, 2018

Find a string in a Postgresql text array of strings

The problem:   You want to find or match a string that is located in a Postgresql text string array. The text array of stings could look like this {Restroom, Locker, Entrance} . In this example the table called " places "  has a column called " tags " that is our Postgresql text arrray. The query you would want to use to find all Restrooms without having to have an exact match but use a like statement could look like this: Select array_to_string(tags,';') from places where array_to_string(tags,';') like '%Rest%'; This will find all entries that match only the first for characters in Restroom If you want to do this in Django as a raw query your query statement would look like: Places.objects.raw("""Select id, array_to_string(tags,';') from appName_places where array_to_string(tags,';') like %s',['%Rest%']"""):

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 **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