Self Hosted Leaflet Photo

There is an excellent plugin for Leaflet called Leaflet.Photo.

The plugin was created by Bjørn Sandvik. See the full post:  http://blog.thematicmapping.org/2014/08/showing-geotagged-photos-on-leaflet-map.html

The plugin has a number of examples that show usage with image hosting platforms, like Google Photos and Instagram, which have assicaited API’s for returning information about the image in question.

I was however keen to host the sollution completely myself, so simply have a folder of images that would populate on the map if they had exif GPS information.

I have created an example available on GitHub:

https://github.com/HeikkiVesanto/Leaflet.Photo/tree/gh-pages/local_file_example

Simply download the full repo:

https://github.com/HeikkiVesanto/Leaflet.Photo

Copy the local_file_example folder. Replace the images in the Photos folder with your own photos. Load it onto any php supporting webhost.

Like: BlueHost

Or for more advanced users, the examples below are on: DigitalOcean

And link to the folder with the index.html

Example:

Link.

GIS to CAD using ogr2ogr – Part 3 – Point Annotation to Text in CAD

GIS to CAD using ogr2ogr – Part 1 – Shp to DXF with Contour Data
GIS to CAD using ogr2ogr – Part 2 – GML to DXF with OS MasterMap

MasterMap Topo Sample Data:

https://www.ordnancesurvey.co.uk/business-and-government/licensing/sample-data/discover-data.html

OS MasterMap has an annotation layer, which is simple to symbolise in a GIS program. But becomes more difficult in CAD software.

With ogr2org, when writing a DXF file, if you have an input point geometry, which has an OGR_STYLE attribute, it will be written as a text geometry when opened in CAD.

So for our MasterMap data we have one layer we want to convert to text:
CartographicText

ogrinfo os-mastermap-topography-layer-sample-data.gml CartographicText
OGRFeature(CartographicText):855
fid (String) = osgb1000000729425681
featureCode (Integer) = 10026
version (Integer) = 1
versionDate (String) = 2001-11-11
theme (StringList) = (1:Buildings)
changeDate (StringList) = (1:1999-09-08)
reasonForChange (StringList) = (1:Modified)
descriptiveGroup (StringList) = (1:Buildings Or Structure)
physicalLevel (Integer) = 50
anchorPosition (Integer) = 0
font (Integer) = 2
height (Real) = 1.5
orientation (Integer) = 2890
textString (String) = 5
descriptiveTerm (String) = (null)
make (String) = Manmade
POINT (290875.38 92635.81)

So for this we are primarily interested in “textString” and potentially “orientation”.

Lets see the layer as points first as a baseline:

ogr2ogr -f DXF CartographicText.dxf os-mastermap-topography-layer-sample-data.gml CartographicText

Screenshot[10]

Zoomed in:

Screenshot[11]

But lets try that as text. We will keep this simple and only take into account orientation and to a small extent height. Lets look at orientation:

Orientation – The orientation of text or symbol features for cartographic placement. This is measured in tenths of a degree anticlockwise from due east (0–3599).

So conversion to degree will be simple. Orientation/10

We can also take into consideration height as a multiplier.

And “textString” stores the text itself.

The command:

ogr2ogr.exe -f DXF CartographicText2.dxf os-mastermap-topography-layer-sample-data.gml CartographicText -sql "SELECT 'LABEL(f:""Arial"",s:""'||(height*800)||'"",t:""'||textString||'"",a:""'||(orientation/10)||'"",p:5)' AS OGR_STYLE, * FROM CartographicText" -dialect SQLITE

Full extent:

Screenshot[12]

Zoomed in:

Screenshot[13]

Explained:

Since this is run in windows, through the regular console, the escape character for quotes is two quotes “”‘. So a combination on ‘ ” and “”‘ we can accommodate all the required quotes.

f:””Arial””,s:””‘||(height*800)||'””,t:””‘||textString||'””,a:””‘||(orientation/10)||'””,p:5

f:””Arial””
Font: Arial

s:””‘||(height*800)||'””
Size: Multiplier of the height field, I am not sure what the units are, comments appreciated.

t:””‘||textString||'””
Text: textString column

a:””‘||(orientation/10)||'””
Align: In degrees

p:5
Position: the OS position and the ogr2ogr style position are slightly different, so better placement could be achieved with some pre-processing

GIS to CAD using ogr2ogr – Part 1 – Shp to DXF with Contour Data
GIS to CAD using ogr2ogr – Part 2 – GML to DXF with OS MasterMap