Skip to content

Instantly share code, notes, and snippets.

View iamtekson's full-sized avatar
:bowtie:
Focusing on Master's Thesis

Tek Kshetri iamtekson

:bowtie:
Focusing on Master's Thesis
View GitHub Profile
@iamtekson
iamtekson / geoserver-install.sh
Created February 2, 2020 10:36 — forked from iacovlev-pavel/geoserver-install.sh
Install GeoServer on Ubuntu 18.04
#
apt-get install openjdk-8-jre
# PostgreSQL and PostGIS
apt-get install postgresql postgresql-contrib postgis postgresql-10-postgis-2.4
# Create "geoserver" database
sudo -u postgres createuser -P geoserver
sudo -u postgres createdb -O geoserver geoserver
sudo -u postgres psql -c "CREATE EXTENSION postgis; CREATE EXTENSION postgis_topology;" geoserver
{% load static %}
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>List of all Buildings</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css"
integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ=="
# If you want to import the database using earth.sql file, try this command
psql -U postgres -h localhost -p 5432 < earth.sql
# If you want to import the database using earthquake.gz file, try this command
gzip -d -c earthquake.gz| sed -e '/AS integer/d' | psql -U postgres -h localhost -p 5432 -W earthquake
@iamtekson
iamtekson / GeoserverWFSFull.html
Created November 1, 2019 12:02
This is the full reference of the WFS request in leaflet
<html>
<head>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css">
<style>
#map {
width: 100%;
height: 500px;
}
</style>
</head>
@iamtekson
iamtekson / GeoserverWFS-Full-code.html
Last active November 1, 2019 12:05
This is the ajax-request of wfs layer in leaflet
//Geoserver Web Feature Service
$.ajax('http://localhost:8080/geoserver/wfs',{
type: 'GET',
data: {
service: 'WFS',
version: '1.1.0',
request: 'GetFeature',
typename: 'workspace:layer_name',
srsname: 'EPSG:4326',
outputFormat: 'text/javascript',
//var region defined
var region = $('#inputGroupSelect01').val()
region = $('#inputGroupSelect01').change(function() {
$(this).val()
});
//button click events
$('#load').click(function () {
//hazardLayer
var hazardLayer = L.tileLayer.wms("http://localhost:8080/geoserver/tajikistan/wms", {
@iamtekson
iamtekson / GeoserverWFS.js
Last active October 30, 2019 17:24
This is the geoserver WFS.
//Geoserver Web Feature Service
$.ajax('http://localhost:8080/geoserver/wfs',{
type: 'GET',
data: {
service: 'WFS',
version: '1.1.0',
request: 'GetFeature',
typename: 'tajikistan:country',
CQL_FILTER: `name_rg='Centre'`,
srsname: 'EPSG:4326',
@iamtekson
iamtekson / wms.js
Created October 24, 2019 16:06
WMS code
//load wms form geoserver
const mywms = L.tileLayer.wms("http://localhost:8080/geoserver/tajikistan/wms", {
layers: 'tajikistan:country1',
format: 'image/png',
transparent: true,
version: '1.1.0',
attribution: "country layer"
});
mywms.addTo(map);
@iamtekson
iamtekson / simpleLeafletMap.html
Created October 24, 2019 15:35
This page will output the simple leaflet map.
<html>
<head>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css">
<script src="https://unpkg.com/leaflet@1.5.1/dist/leaflet.js"></script>
<style>
#map {
width: 100%;
height: 500px;
}
</style>
@iamtekson
iamtekson / geoserverLeaflet.html
Last active October 24, 2019 16:19
Geoserver WMS feature with leaflet.js
<html>
<head>
<!-- leaflet css -->
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css">
<style>
#map {
width: 100%;
height: 500px;
}