Thursday, November 10, 2016

takes a directory full of images, export Lat, Long data and makes a file (i.e. GeoJSON/HTML or spreadsheet or .kml) with all of the found GPS points. 2016 standard specification of the GeoJSON format: RFC 7946


directory full of images---> GeoJson or spreadsheet file (or kml)

-->GeoJson

GeoJSON is a format for encoding a variety of geographic data structures for example:
{
  "type": "Feature",
  "geometry": {
    "type": "Point",
    "coordinates": [125.6, 10.1]
  },
  "properties": {
    "name": "Dinagat Islands"
  }
}

GeoJSON supports the following geometry types: Point, LineString, Polygon, MultiPoint, MultiLineString, and MultiPolygon. Geometric objects with additional properties are Feature objects. Sets of features are contained by FeatureCollection objects.

In 2015, the Internet Engineering Task Force (IETF), in conjunction with the original specification authors, formed a GeoJSON WG to standardize GeoJSON. RFC 7946 was published in August 2016 and is the new standard specification of the GeoJSON format, replacing the 2008 GeoJSON specification.

Remember that GeoJSON stores coordinates in "reversed order" (longitude, latitude)

Some javascript codes:

1/exif-to-geojson
https://github.com/hallahan/exif-to-geojson
This javascript takes a directory full of images and makes a GeoJSON file with all of the found GPS points. Put the images you want to create a corresponding GeoJSON file with in the img directory.
node exif-to-geojson.js . The output will be written to exif.geojson
Demo: http://hallahan.github.io/exif-to-geojson

After you run the script, you can see the geojson with pop-ups that link to the corresponding images in index.html.
See also: https://github.com/hallahan/LeafletPlayback
This is a Leaflet plug-in that plays back points that have a time stamp synchronized to a clock. http://leafletplayback.theoutpost.io

2/exif-gps-to-json-example (quite complex)
https://github.com/omichelsen/exif-gps-to-json-example
Example code on how to save EXIF data from photos to a JSON file. http://ole.michelsen.dk/blog/showing-photo-gps-location-on-google-maps-with-gulp.html

This is the example code for the article Showing photo GPS location on Google Maps with gulp.
In this tutorial I will go through how to read the EXIF data from a folder of photots, and show the GPS location where each photo was taken in Google Maps. This article is based on the code I wrote to make my personal World Travel Map,
https://ole.michelsen.dk/photos/travel-map.html
(see this interesting "story map" with text!!!)
which shows where I've been based on my vacation shots.
https://ole.michelsen.dk/blog/showing-photo-gps-location-on-google-maps-with-gulp.html

We'll use the gulp build system to read the image files and output the data we need to a JSON file, which we can then read into Google Maps.

First we install gulp and a couple of packages, gulp-data, gulp-exif and gulp-extend:
npm install --save-dev gulp gulp-data gulp-exif gulp-extend
This will allow us to read the EXIF data from the image files, extract the part we need (GPS coordinates), and save it all into a single JSON file.

https://github.com/gulpjs/gulp/blob/master/docs/getting-started.md

Now we create a task called "exif", which does three things:

  • Reads the EXIF data from the images in the photos folder
  • Plucks out the GPS data and puts it in a JSON format with the filename as the key
  • Joins the JSON data into a single gps.json file

3/exif-geo
https://github.com/annejan/exif-geo
Show distance between image EXIF GPS data and Location API.

  • Use client side parser
  • Store results for statistical analysis
  • Auto positioning and scaling of map
Try it out at http://geo.printf.nl/

Some tools:
Convert GPS degrees, minutes, seconds coordinates to decimal value. Useful for parsing GPS exif tags in geotagged images, Google Maps, and Open Street Map (SOM).

https://github.com/Turistforeningen/dms2dec.js

Remember that GeoJSON stores coordinates in reversed order (longitude, latitude) which means you have to reverse the order of the coordinates returned from dms2dec():
var geojson = {
  type: 'Point',
  coordinates: dms2dec(lat, latRef, lon, lonRef).reverse()
};

4/GPSeitor (code date: 2014)
https://github.com/eltuza/GPSeitor
A Python application that processes a pictures directory and generates a static web page positioning the images that have GPS Exif data in a Google Map in a gallery-like fashion.

5/gps detect (firefox add-on)
https://github.com/allanlw/gps-detect
Firefox addon for detecting GPS EXIF info in JPEGs automatically.
GPSDetect is a simple Firefox addon that monitors Firefox network traffic and automatically alerts the user whenever a JPEG file loads that contains embedded EXIF GPS coordinates.
When an image is detected that contains GPS data, the user is alerted, and given a link to the offending image as well as the GPS information and a link to the location on a map.

Note that most major social networking sites strip EXIF information (including GPS locations). This includes Facebook, Twitter and imgur.

GPSDetect uses the Firefox Add-on SDK, which is required to build and install it, for now. To build a copy of GPSDetect, see the Add-on SDK installation instructions to activate the SDK's virtualenv, and then simply run cfx xpi in the GPSDetect root directory. You will get an unsigned XPI that can be installed into Firefox as usual.
https://developer.mozilla.org/en-US/Add-ons/SDK
https://developer.mozilla.org/en-US/Add-ons/SDK/Tools/jpm#Installation

6/jpeg-exif-data
https://github.com/BelfordZ/jpeg-exif-data
command line interface (cli) tool for pulling exif gps data from images

7/photo-saver
https://github.com/montanaflynn/photo-saver
Organize your photos based on exif date and GPS coordinates.
Usage:
This simple tool takes two arguments, an input directory and an output directory. The input directory should be a folder with photos that have exif data. The output directory is where you want the organized files to end up. Of course your original files are left alone.

Rem:
MongoDB is a free and open-source cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with schemas. MongoDB is developed by MongoDB Inc. and is free and open-source:
https://www.mongodb.com/
https://en.wikipedia.org/wiki/MongoDB

http://anonfunction.com/2014/10/exporting-mongodb-to-csv/

-->Spreadsheet file

The goal for this post is to extract Longitude and Latitude data from a folder of images and export the data in a CSV so it can be easily imported into a Fusion Table or other spreadsheet.

1/ use exifTool:

2/Once the installation is finished, open up Terminal or open up your Command Line on Windows or the stand-alone Windows executable.

Here is the line that you need to enter:

“exiftool -csv -filename -imagesize -gps:GPSLatitude -gps:GPSLongitude ./ > long.csv”

This command will go to the folder that you input and read through all of the images and pull out the filename, the image size, the GPS Latitude and the GPS Longitude and export everything to a CSV.

Here is the finished CSV that is opened in Excel:





No comments:

Post a Comment