This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @tag0 nvarchar(25) = ##tag0:string?r## | |
DECLARE @start datetime = ##start:string?2014-01-01## | |
DECLARE @end datetime = ##end:string?2014-12-31## | |
DECLARE @minscore int = ##minscore?10## | |
SELECT a.Id AS [Post Link], u.DisplayName AS "Asker", au.DisplayName AS "Answerer", | |
a.Score, p.CreationDate AS "Q_Date", a.CreationDate AS "A_Date" | |
FROM Tags t | |
JOIN PostTags pt ON pt.TagId = t.Id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(googleAuthR) | |
library(RCurl) | |
library(stringi) | |
# Google AuthR Credentials | |
options('googleAuthR.client_id' = '[your client id]') | |
options('googleAuthR.client_secret' = '[your client secret]') | |
# Input | |
img_url <- '[Image URL]' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(httr) | |
key <- '[your apikey]' | |
img_url <- '[your image url]' | |
# Submit an OCR job | |
request <- POST(url='https://api.havenondemand.com/1/api/async/ocrdocument/v1', | |
body = list(apikey = key, | |
url = img_url, | |
mode = 'document_photo')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#plot the first layer | |
plot(poly.data[[1]]) | |
#plot the other layers | |
for (i in 2:length(layers)) { | |
plot(poly.data[[i]], add=T) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get the layers from .kml file | |
layers <- ogrListLayers('bbmp.kml') | |
# Import layers to a list | |
timer_all <- Sys.time() | |
pb <- txtProgressBar(max=length(layers), style = 3) | |
options(warn=-1) # disable warnings | |
poly.data <- list() | |
for (i in 1:length(layers)) { | |
poly.data[i] <- readOGR(dsn="bbmp.kml", layer=layers[i], encoding="utf-8", verbose = F) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get the layers from .kml file | |
layers <- ogrListLayers('bbmp.kml')[2:198] | |
i<-1 | |
# Get polygon from first layer | |
poly.data <- readOGR(dsn="bbmp.kml", layer=layers[1], encoding="utf-8", verbose = F) | |
n <- length(slot(poly.data, "polygons")) | |
poly.data <- spChFIDs(poly.data, as.character(i:(i+n-1))) | |
i <- i + n | |
# Combine remaining polygons with first polygon | |
timer_all <- Sys.time() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> ogrDrivers()$name | |
[1] "AeronavFAA" "AmigoCloud" "ARCGEN" "AVCBin" | |
[5] "AVCE00" "BNA" "Carto" "Cloudant" | |
[9] "CouchDB" "CSV" "CSW" "DGN" | |
[13] "DXF" "EDIGEO" "ElasticSearch" "ESRI Shapefile" | |
[17] "Geoconcept" "GeoJSON" "GeoRSS" "GFT" | |
[21] "GML" "GPKG" "GPSBabel" "GPSTrackMaker" | |
[25] "GPX" "HTF" "HTTP" "Idrisi" | |
[29] "Interlis 1" "Interlis 2" "JML" "JP2OpenJPEG" | |
[33] "JPEG2000" "KML" "LIBKML" "MapInfo File" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Convert from .shp to .geojson files | |
$ ogr2ogr -skipfailures -f GeoJSON -t_srs crs:84 [filename].geojson [filename].shp | |
# Convert from .kml to .geojson files | |
$ ogr2ogr -skipfailures -f GeoJSON -t_srs crs:84 [filename].geojson [filename].kml | |
# Convert from .kml to .shp files | |
$ ogr2ogr -skipfailures -f 'ESRI SHAPEFILE' [filename].shp [filename].kml | |
# Convert from .shp to .kml files | |
$ ogr2ogr -skipfailures -f KML [filename].kml [filename].shp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rgdal) | |
library(rgeos) | |
library(maptools) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo 'export PATH=/Library/Frameworks/GDAL.framework/Programs:$PATH' >> ~/.bash_profile | |
source ~/.bash_profile |
NewerOlder