Skip to content

Instantly share code, notes, and snippets.

View iamgeoknight's full-sized avatar

Spatial Dev Guru iamgeoknight

View GitHub Profile
@iamgeoknight
iamgeoknight / get_coords.ipynb
Last active January 20, 2024 14:23
Get the geographical coordinates from NetCDF file using Python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@iamgeoknight
iamgeoknight / sentiment-analysis.csv
Created September 23, 2023 13:43
sentiment-analysis.csv data taken from kaggle for BITS assignment
We can make this file beautiful and searchable if this error is corrected: It looks like row 10 should actually have 7 columns, instead of 6 in line 9.
Text, Sentiment, Source, Date/Time, User ID, Location, Confidence Score
I love this product!, Positive, Twitter, 2023-06-15 09:23:14, @user123, New York, 0.85
The service was terrible., Negative, Yelp Reviews, 2023-06-15 11:45:32, user456, Los Angeles, 0.65
This movie is amazing!, Positive, IMDb, 2023-06-15 14:10:22, moviefan789, London, 0.92
I'm so disappointed with their customer support., Negative, Online Forum, 2023-06-15 17:35:11, forumuser1, Toronto, 0.78
Just had the best meal of my life!, Positive, TripAdvisor, 2023-06-16 08:50:59, foodie22, Paris, 0.88
The quality of this product is subpar., Negative, Amazon Reviews, 2023-06-16 10:15:27, shopper123, San Francisco, 0.72
I can't stop listening to this song. It's incredible!, Positive, Spotify, 2023-06-16 13:40:18, musiclover456, Berlin, 0.91
Their website is so user-friendly. Love it!, Positive, Website Testimonial, 2023-06-16 16:05:36, testimonialuser1, Sydney, 0.87
I loved the movie! It was fantastic!, Positive, IMDb, 2023-07-02 09:12:34, user123, Ne
@iamgeoknight
iamgeoknight / USA High Quality Made - Backpacks.csv
Created February 23, 2023 17:12
USA High Quality Made - Backpacks.csv
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 12 columns, instead of 1 in line 4.
Product,Brand,Country of Origin,Type,Image URL,Laptop Compartment,Capacity (Volume in Liter),Material,Average Weight (Kg),Waterproof,Water-repellent,Price (USD)
Surge Backpack,The North Face,USA,Daypack,"https://images.thenorthface.com/is/image/TheNorthFace/NF0A52SG_7S5_hero?hei=650&wid=555&qlt=50&resMode=sharp2&op_sum=0.9,1.0,8,0",Yes,31,210D recycled nylon ripstop with non-PFC durable water-repellent (non-PFC DWR) finish,1.2,No,Yes,129
Borealis Backpack,The North Face,USA,Daypack,"https://images.thenorthface.com/is/image/TheNorthFace/NF0A52SE_2KQ_hero?wid=780&hei=906&fmt=jpeg&qlt=50&resMode=sharp2&op_usm=0.9,1.0,8,0",Yes,28,210D recycled nylon ripstop with non-PFC durable water-repellent (non-PFC DWR) finish,1,No,Yes,99
Router Backpack,The North Face,USA,Daypack,"https://images.thenorthface.com/is/image/TheNorthFace/NF0A52SF_R81_hero?hei=650&wid=555&qlt=50&resMode=sharp2&op_sum=0.9,1.0,8,0",Yes,40,210D recycled nylon ripstop with non-PFC durable water-repellent (non-PFC DWR) finish,1.3,No,Yes,159
Commuter R
@iamgeoknight
iamgeoknight / uk_accidents_hexs.json
Created December 3, 2022 07:18
uk_accidents_hexs.json
[
{"hex": "867b02497ffffff", "count": 28},
{"hex": "867b024b7ffffff", "count": 53},
{"hex": "867b02507ffffff", "count": 34},
{"hex": "867b02517ffffff", "count": 42},
{"hex": "867b0251fffffff", "count": 13},
{"hex": "867b02537ffffff", "count": 36},
{"hex": "867b02587ffffff", "count": 392},
{"hex": "867b02597ffffff", "count": 48},
{"hex": "867b025a7ffffff", "count": 24},
import geopandas as gpd
from shapely import geometry
# Create a fishnet
if __name__ == '__main__':
# Read the shapefile
gdf = gpd.read_file('abbottstown_pa_union.shp')
# Reproject to projected coordinate system
gdf = gdf.to_crs('EPSG:3857')
@iamgeoknight
iamgeoknight / import_shapefile.py
Created March 19, 2022 12:25
Import shapefiles using GeoPandas and PsycoPG2
import geopandas as gpd
import psycopg2
import psycopg2.extras as extras
from pygeos import to_wkb, set_srid
# Create connection
def create_connection(credentials):
conn = psycopg2.connect(**credentials)
cur = conn.cursor()
return [conn, cur]
@iamgeoknight
iamgeoknight / polygon_holes.js
Last active January 22, 2022 13:10
Draw Holes in OpenLayers Polygon
/*
Create a Draw interaction for LineString and Polygon
*/
class Draw {
//Constructor accepts geometry type, map object and vector layer
constructor(type, map, vector_layer, hole) {
this.map = map;
this.vector_layer = vector_layer;
this.features = [];
@iamgeoknight
iamgeoknight / dynamicstyle.js
Last active January 8, 2022 13:26
Dynamic Style
// Defining Dynamic Styles
let dynamicStyle = {
'point': new ol.style.Style({
image: new ol.style.Circle({
radius: 10,
fill: new ol.style.Fill({
color: [247, 5, 25, 1],
}),
stroke: new ol.style.Stroke({
color: [5, 74, 247, 1],
@iamgeoknight
iamgeoknight / staticstyle.js
Last active January 9, 2022 05:37
Static Style
// Defining Static Style
let staticStyle = new ol.style.Style({
// Line and Polygon Style
stroke: new ol.style.Stroke({
color: '#0e97fa',
width: 4
}),
fill: new ol.style.Fill({
color: 'rgba(0, 153, 255, 0.2)'
}),
/*
Create a Draw interaction for LineString and Polygon
*/
class Draw {
//Constructor accepts geometry type, map object and vector layer
constructor(type, map, vector_layer) {
this.map = map;
this.vector_layer = vector_layer;
this.features = [];