Online conversion between geometric formats

Here is a simple conversion tool between different text representations for 2D geometry objects. Supported formats are: WKB, a.k.a. Well-Known Binary, in hexadecimal format WKT, a.k.a. Well-Known Text GeoJSON A few sample geometries (taken from Wikipedia) are available: POINT LINESTRING POLYGON MULTIPOINT MULTILINESTRING MULTIPOLYGON GEOMETRYCOLLECTION This tool uses the wkx javascript library for parsing. Have … Read more

Conversion between “CamelCase” and “snake_case” strings with Python

camel+snake

In some programs, it might be needed to convert strings between CamelCase, camelBack and snake_case notations. Here are a few function to perform these operations: import re     def snake2camel(name): return re.sub(r'(?:^|_)([a-z])’, lambda x: x.group(1).upper(), name)   def snake2camelback(name): return re.sub(r’_([a-z])’, lambda x: x.group(1).upper(), name)   def camel2snake(name): return name[0].lower() + re.sub(r'(?!^)[A-Z]’, lambda x: … Read more

Convert an object to an array in PHP

PHP_Logo

What? The function introduced below alows you to recursively convert an object to an array. See also: Convert an array to an object in PHP The code function object_to_array($variable){ if (is_object($variable)){ $array = array(); foreach ($variable as $key=>$value){ $array[$key] = object_to_array($value); } return $array; } else{ return $variable; } }

Convert an array to an object in PHP

PHP_Logo

What? The function introduced below alows you to recursively convert an array to an object. See also: Convert an object to an array in PHP The code function array_to_object($variable){ if (is_array($variable)){ $object = new StdClass(); foreach ($variable as $key=>$value){ $object->$key = array_to_object($value); } return $object; } else{ return $variable; } }


Warning: Unknown: open(/var/lib/php5/sessions/sess_dnm7d4t1glcn7129b2sipccu61, O_RDWR) failed: Permission denied (13) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php5/sessions) in Unknown on line 0