How to convert OSM file ot PNG tiles on MacOS? - gis

Im trying to create an offline map with Leaflet. So I got this package from https://download.geofabrik.de/africa.html
Is there any way to convert osm.pbf to PNG tiles on MacOS?

Related

Incorrect image size when generating raster png images from vector data

I am writing a python API (WMS format) to fetch the gridded weather data(rainfall) and convert it into png images. I am using GDAL for this and involves below steps:
Fetching data from database using the BBOX from WMS
Rasterizing the data using gdal.Rasterize and converting the data into tiff files
Then applying style to the tiff using gdal.DEMProcessing and converting the tiff into png and returning the PNG images as output from the API.
Consuming this WMS API from openlayers to overlay the data on map.
Problem:
The problem I am facing is I am unable to get proper image size of the generated images because of which the data is shown as below in the image. Need help to know what is the correct set of options to be used in rasterize or demprocessing to get correct output. Sample code:
options = gdal.RasterizeOptions(
format='GTiff', attribute='value', noData=NoData_value,
width=w, height=h,
outputType=gdalconst.GDT_Float32,
outputBounds=[x_min,y_min,x_max,y_max],
outputSRS=crs)

How to create terrain files with points in Cesium?

I have a DEM file with XYZ points (file sample image), and I want to use it to create terrain in Cesium with it. I tried to translate it to GeoTiff by ArcMap, but it is not supported by cesium terrain builder.
How could I create terrain files with points in Cesium?
Cesium is able to consume Quantized Mesh tiles but not GTIFF or XYZ directly.
First, you will have to convert your XYZ file to e.g. GTIFF and transform it to WGS84 coordinate reference system. Both can be done using gdal.
Second, convert your transformed GTIFF files to quantized-mesh format.
I created a Docker image for that purpose. Check out the Github page of tumgis/cesium-terrain-builder-docker for a detailed documentation of the entire process.
Finally, you will need a service like CesiumTerrainServer to serve the tiles to a Cesium application.

Is There Anyway to conver dwg file in three.js acceptable format?

I an trying to use .dwg file in web app. I have recently find this (https://github.com/aalavandhaann/blueprint-js) works base on three.js file. while dwg is not compatible with three.js is there anyway to convert dwg file to json nad use it in threejs?

How to embed a map into Netlogo using GIS extension?

The format of the map imported should be preferably ".shp" file.Also please tell how to create such a file. I have tried KML but it didn't work.
Yes, vectors need to be .shp to be imported. You can create vector files in most GIS programs (ArcGIS, QGIS, etc) and export to .shp. Or there's online tools for converting KML to .shp (eg http://www.zonums.com/online/kml2shp.php)
Raster files need to be saved as .ASC or .GRD for use as a dataset in Netlogo.

displaying .json files in leaflet

I have 5 .shp files from http://websoilsurvey.sc.egov.usda.gov/App/WebSoilSurvey.aspx
I would like to overlay these .shp files onto my existing tile photos in leaflet.
I have converted the 5 .shp files to .json using ogr2ogr, but I do not know how add all of these .json files as overlay to my existing tilings. Any help would be appreciated, thanks.
Leaflet has a L.GeoJSON layer which you can use to overlay GeoJSON collections on the map. You would need to load your JSON files using your favorite XHR/AJAX library of choice and instanciate the GeoJSON layer with the retrieved object:
// Fetch the geojson file
$.getJSON('data.geo.json', function (data) {
// Define the geojson layer and add it to the map
L.geoJson(data).addTo(map);
});
It's as simple as that. Here's a working example on Plunker: http://plnkr.co/edit/0eP6zm?p=info
There is a very nice tutorial on L.GeoJSON on the Leaflet site itself: http://leafletjs.com/examples/geojson.html and here is the API reference: http://leafletjs.com/reference.html#geojson