Skip to content

Instantly share code, notes, and snippets.

View springmeyer's full-sized avatar

Dane Springmeyer springmeyer

View GitHub Profile
d:~ dane$ ogrinfo filejson
OGR: OGROpen(filejson) failed using driver 'ESRI Shapefile'
OGR: OGROpen(filejson) failed using driver 'MapInfo File'
OGR: OGROpen(filejson) failed using driver 'UK .NTF'
OGR: OGROpen(filejson) failed using driver 'SDTS'
OGR: OGROpen(filejson) failed using driver 'TIGER'
OGR: OGROpen(filejson) failed using driver 'S57'
OGR: OGROpen(filejson) failed using driver 'DGN'
OGR: OGROpen(filejson) failed using driver 'VRT'
OGR: OGROpen(filejson) failed using driver 'REC'
@springmeyer
springmeyer / ahistoryofgisformats.sh
Created October 27, 2011 23:47
ogr file type detection in debug mode `export CPL_DEBUG=ON`
d:~ dane$ echo '{ "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": {"type": "Point", "coordinates": [102.0, 0.5]}, "properties": {"prop0": "value0"} } ]}' > file.json
d:~ dane$ export CPL_DEBUG=ON
d:~ dane$ ogrinfo file.json
ERROR 4: GeoJSON Driver doesn't support update.
OGR: OGROpen(file.json/0x101d114b0) succeeded as GeoJSON.
Had to open data source read-only.
INFO: Open of `file.json'
@springmeyer
springmeyer / test-cxx.sh
Created October 27, 2011 22:03
test if c++ compiler and linker is working
echo '#include <string>' > lib.hpp
echo 'std::string hello();' >> lib.hpp
echo '#include "lib.hpp"' > lib.cpp
echo 'std::string hello() { return "hello world\n"; }' >> lib.cpp
echo '#include <iostream>' > test.cpp
echo '#include "lib.hpp"' >> test.cpp
echo 'int main(void) { std::cout << hello();return 0; }' >> test.cpp
g++ -o test test.cpp lib.cpp
./test
d:~ dane$ wget "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Hydrography/Watershed173811/FeatureServer/0/query?where=objectid+%3D+objectid&outfields=*&f=json"
--2011-10-27 14:30:18-- http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Hydrography/Watershed173811/FeatureServer/0/query?where=objectid+%3D+objectid&outfields=*&f=json
Resolving sampleserver3.arcgisonline.com... 50.16.216.1
Connecting to sampleserver3.arcgisonline.com|50.16.216.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 365118 (357K) [text/plain]
Saving to: `query?where=objectid+=+objectid&outfields=*&f=json'
100%[====================================================================================>] 365,118 352K/s in 1.0s
diff --git a/plugins/input/ogr/ogr_datasource.cpp b/plugins/input/ogr/ogr_datasource.cpp
index 1580455..7186f13 100644
--- a/plugins/input/ogr/ogr_datasource.cpp
+++ b/plugins/input/ogr/ogr_datasource.cpp
@@ -56,7 +56,7 @@ ogr_datasource::ogr_datasource(parameters const& params, bool bind)
: datasource(params),
extent_(),
type_(datasource::Vector),
- desc_(*params.get<std::string>("type"), *params.get<std::string>("encoding", "utf-8")),
+ desc_(*params_.get<std::string>("type"), *params_.get<std::string>("encoding", "utf-8")),
Index: apps/gdal_rasterize.cpp
===================================================================
--- apps/gdal_rasterize.cpp (revision 23283)
+++ apps/gdal_rasterize.cpp (working copy)
@@ -281,7 +281,7 @@
/* -------------------------------------------------------------------- */
/* If we are in inverse mode, we add one extra ring around the */
/* whole dataset to invert the concept of insideness and then */
-/* merge everything into one geomtry collection. */
+/* merge everything into one geometry collection. */
@springmeyer
springmeyer / ogr_test.sh
Created October 27, 2011 20:54
ogrinfo detecting geojson
$ ogrinfo --version
GDAL 1.8.1, released 2011/07/09
# create a normal json file with an ext
$ echo '{ "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": {"type": "Point", "coordinates": [102.0, 0.5]}, "properties": {"prop0": "value0"} } ]}' > file.json
# this works as expected
$ ogrinfo file.json
ERROR 4: GeoJSON Driver doesn't support update.
Had to open data source read-only.
ubuntu@ubuntu-VirtualBox:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 11.04
Release: 11.04
Codename: natty
ubuntu@ubuntu-VirtualBox:~$ sudo apt-get update
[sudo] password for ubuntu:
Ign http://extras.ubuntu.com natty InRelease
clang++ -o src/datasource_cache.os -c -arch x86_64 -arch i386 -mmacosx-version-min=10.6 -isysroot /Developer/SDKs/MacOSX10.6.sdk -isystem osx/sources/include -DU_HIDE_DRAFT_API -DUDISABLE_RENAMING -DHAVE_JPEG -ansi -Wall -ftemplate-depth-300 -DDARWIN -DBOOST_SPIRIT_THREADSAFE -DMAPNIK_THREADSAFE -O3 -finline-functions -Wno-inline -Wno-parentheses -Wno-char-subscripts -DNDEBUG -DHAVE_CAIRO -DLIBTOOL_SUPPORTS_ADVISE -fPIC -I./osx/sources/include/cairomm-1.0 -I./osx/sources/lib/cairomm-1.0/include -I./osx/sources/include/cairo -I./osx/sources/include/sigc++-2.0 -I./osx/sources/lib/sigc++-2.0/include -I./osx/sources/include/pixman-1 -I./osx/sources/include/libpng15 -Ideps/agg/include -I. -Iinclude -Iosx/sources/include -I/Users/dane/projects/mapnik-dev/macbinary/osx/sources/include/freetype2 -I/Users/dane/projects/mapnik-dev/macbinary/osx/sources/include -Isrc/osx/sources/include -I/usr/include/libxml2 -I/usr/include src/datasource_cache.cpp
@springmeyer
springmeyer / test-llvm-gold.sh
Created October 13, 2011 01:38
test clang++ and gold ld with LTO
echo '#include <string>' > lib.hpp
echo 'std::string hello();' >> lib.hpp
echo '#include "lib.hpp"' > lib.cpp
echo 'std::string hello() { return "hello world\n"; }' >> lib.cpp
echo '#include <iostream>' > test.cpp
echo '#include "lib.hpp"' >> test.cpp
echo 'int main(void) { std::cout << hello();return 0; }' >> test.cpp
clang++ -o test -O4 test.cpp lib.cpp -use-gold-plugin
./test