Convert a Google Doc to Markdown or HTML with “Docs to Markdown”

Now this comes in handy:

Docs to Markdown (GD2md-html) converts Google Docs to simple, readable Markdown or HTML.

This add-on allows you to create documents using the excellent editing and collaborative features of Google Docs, but publish as Markdown or HTML that you can store as text files using a version-control system.

Docs to Markdown on GSuite Marketplace →
Docs to Markdown Docs (GitHub Wiki) →

Hat tip, Katie!

Convert MrSID to an image (PNG, JPG, TIFF, …)


Conversion result, using data of my hometown Deinze, Belgium

To convert a MrSID (Multiresolution Seamless Image Database) from LizardTech you’ll need GDAL (Geospatial Data Abstraction Library) — Mac Users: download here — along with its MrSID Plugin — Mac Users: scroll down at link above.

Once both are installed you can use gdal_translate to do the actual conversion. Beware that converting will give you a gigantic file and will take a while. Best is to resize the output, to not end up with images of 500MB.

Convert MrSID to PNG and resize

/Library/Frameworks/GDAL.framework/Programs/gdal_translate -of PNG -outsize 10% 10% input.sid output.png

More info on the parameters can be found on the GDAL site.

Tip: if you can determine the NE and SW coordinates of the image, you can project it on top of Google Maps as a Ground Overlay (example)

Did this help you out? Like what you see?
Consider donating.

I don’t run ads on my blog nor do I do this for profit. A donation however would always put a smile on my face though. Thanks!

☕️ Buy me a Coffee ($3)

Convert ESRI Shapefile (.shp) to geoJSON (.json)


Conversion result implemented in Google Maps, using data of my hometown Deinze, Belgium

To convert ESRI shapefiles to geoJSON (which you can perfectly use JavaScript and thus pass on to Google Maps, see screenshot above) you will need GDAL (Geospatial Data Abstraction Library) — Mac Users: download here. I have installed GDAL 1.9 Complete but perhaps the framework itself might also do.

After installation, you can use ogr2ogr to do the actual conversion.

Convert ESRI Shapefile to geoJSON:

/Library/Frameworks/GDAL.framework/Programs/ogr2ogr -f "GeoJSON" output.json input.shp

Convert ESRI Shapefile to geoJSON with Coordinates Conversion (here LAMBERT 1972 (EPSG:31370) to WGS84):

/Library/Frameworks/GDAL.framework/Programs/ogr2ogr -f "GeoJSON" -s_srs "EPSG:31370" -t_srs "WGS84" output.json input.shp

The latter is the command you’ll be looking for when working with gisoost.be buurtwegen data.

Did this help you out? Like what you see?
Thank me with a coffee.

I don't do this for profit but a small one-time donation would surely put a smile on my face. Thanks!

☕️ Buy me a Coffee (€3)

To stay in the loop you can follow @bramus or follow @bramusblog on Twitter.

Convert LAMBERT 1972 to WGS84

Needed to convert LAMBERT 1972 (EPSG:31370) coordinates to WGS84 (EPSG:4326) for a project I’m working on in order to use the coordinates with Google Maps (which uses a SphericalMercator (EPSG:900913) projection).

Took me quite a while to find the needed algorithm, so hereby I’m listing them (and am providing the JavaScript implementation):

JavaScript:

var lambert72toWGS84 = function(x, y){

	var newLongitude, newLatitude;

	var n = 0.77164219,
	    F = 1.81329763,
		thetaFudge = 0.00014204,
		e = 0.08199189,
		a = 6378388,
		xDiff = 149910,
		yDiff = 5400150,
		theta0 = 0.07604294;

	var xReal = xDiff - x,
	    yReal = yDiff - y;

	var rho = Math.sqrt(xReal * xReal + yReal * yReal),
	    theta = Math.atan(xReal / -yReal);

	newLongitude = (theta0 + (theta + thetaFudge) / n) * 180 / Math.PI;
	newLatitude = 0;

	for (var i = 0; i < 5 ; ++i) {
		newLatitude = (2 * Math.atan(Math.pow(F * a / rho, 1 / n) * Math.pow((1 + e * Math.sin(newLatitude)) / (1 - e * Math.sin(newLatitude)), e / 2))) - Math.PI / 2;
	}
	newLatitude *= 180 / Math.PI;
	return [newLatitude, newLongitude];

}

Java:

public static Point lambert72toWGS84(double x, double y) {

	double newLongitude;
	double newLatitude;

	double n = 0.77164219;
	double F = 1.81329763;
	double thetaFudge = 0.00014204;
	double e = 0.08199189;
	double a = 6378388;
	double xDiff = 149910;
	double yDiff = 5400150;

	double theta0 = 0.07604294;

	double xReal = xDiff - x;
	double yReal = yDiff - y;

	double rho = Math.sqrt(xReal * xReal + yReal * yReal);
	double theta = Math.atan(xReal / -yReal);

	newLongitude = (theta0 + (theta + thetaFudge) / n) * 180 / Math.PI;
	newLatitude = 0;

	for (int i = 0; i < 5 ; ++i) {
		newLatitude = (2 * Math.atan(Math.pow(F * a / rho, 1 / n) * Math.pow((1 + e * Math.sin(newLatitude)) / (1 - e * Math.sin(newLatitude)), e / 2))) - Math.PI / 2;
	}
	newLatitude *= 180 / Math.PI;
	return new Point(newLatitude, newLongitude);
}

C/C++:

void LambertToLongLat(double x,double y, double& longt, double& lat){
    double n = 0.77164219;
    double F = 1.81329763;
    double thetaFudge = 0.00014204;
    double e= 0.08199189;
    double a= 6378388;
    double xDiff= 150000;
    double yDiff = 5400088.44;
    double theta0 = 0.07604294;

    double xReal = xDiff-x;
    double yReal = yDiff-y;

    double rho = sqrt(xReal*xReal + yReal * yReal);
    double theta = atan(xReal/-yReal);

    longt = (theta0 + (theta+thetaFudge) /n)*180/PI;
    lat =0;
    for(size_t i=0; i<5; ++i){
        lat =(2*atan(pow(F*a/rho,1/n)* pow((1+ e*sin(lat))/(1-e*sin(lat)),e/2)))-PI/2;
    }
    lat *=180/PI;
}

Hope this helps!

Related: if you want to do other transforms (or flip the transorm), check out Transformation between datum’s in JavaScript. Thanks for the tip, Ibrahim (via e-mail)!

Did this help you out? Like what you see?
Consider donating.

I don't run ads on my blog nor do I do this for profit. A donation however would always put a smile on my face though. Thanks!

☕️ Buy me a Coffee ($3)