This file contains hidden or 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
onGeomChange = (e) => { | |
/* | |
This function will dynamically split the polygon into two parts by a line and will follow geometry change event. | |
*/ | |
//Create jsts parser to read openlayers geometry | |
let parser = new jsts.io.OL3Parser(); | |
//Creating line geometry from draw intraction | |
let linestring = new ol.Feature({ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
from sqlalchemy import create_engine | |
import geopandas as gpd | |
user = "postgres" | |
password = "admin" | |
host = "localhost" | |
port = 5432 | |
database = "postgis_in_action" | |
conn = f"postgresql://{user}:{password}@{host}:{port}/{database}" |
This file contains hidden or 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
let map = new ol.Map({ | |
target: map_div, | |
layers: [ | |
new ol.layer.Tile({ | |
source: new ol.source.OSM() | |
}) | |
], | |
view: new ol.View({ | |
center: ol.proj.fromLonLat(center), | |
zoom: zoom |
This file contains hidden or 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
let draw = new ol.interaction.Draw({ | |
type: "LineString" | |
}); | |
//Create interaction listener for draw | |
draw.on('drawstart', function (e) { | |
//Perform Task on when interaction starts | |
}); | |
draw.on('drawend', function (e) { |
This file contains hidden or 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
let map = new ol.Map({ | |
target: map_div, | |
layers: [ | |
new ol.layer.Tile({ | |
source: new ol.source.OSM() | |
}), | |
wmsLayer | |
], | |
view: new ol.View({ | |
center: ol.proj.fromLonLat(center), |
This file contains hidden or 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
//Create map and vector layer | |
let map = new OLMap('map', 1, [-96.6345990807462, 32.81890764151014]).map; | |
//Feature Information on Map Click | |
map.on('singleclick', function (e) { | |
let url = wmsLayer.getSource().getFeatureInfoUrl( | |
e.coordinate, | |
map.getView().getResolution(), |
This file contains hidden or 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
//Create a wms layer | |
let wmsLayer = new ol.layer.Tile({ | |
source: new ol.source.TileWMS({ | |
url: 'https://ahocevar.com/geoserver/wms', | |
params: {'LAYERS': 'ne:ne', 'TILED': true} | |
}) | |
}); | |
/* | |
Create and Render map on div with zoom and center |
This file contains hidden or 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
let mergePolygon = (e) => { | |
/* | |
This function is applicable to merge only two polygons | |
This function will merge or perform union on two adjacent polygons. For the merge function to work, the polygons should atleast intersect each other. | |
*/ | |
//Create jsts parser to read openlayers geometry | |
let parser = new jsts.io.OL3Parser(); | |
//Parse Polygons geometry to jsts type |
This file contains hidden or 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
onGeomChange = (e) => { | |
/* | |
This function will dynamically split the polygon into two parts by a line and will follow geometry change event. | |
*/ | |
//Create jsts parser to read openlayers geometry | |
let parser = new jsts.io.OL3Parser(); | |
//Creating line geometry from draw intraction | |
let linestring = new ol.Feature({ |