displaying .json files in leaflet - json

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

Related

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.

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.

Cities displayed in topojson visualization, but not in file itself?

I am looking at this json file: https://gist.github.com/d3noob/5193723#file-world-110m2-json. In the visualization done by github, the file seems to encode data about cities and towns. However when I look at the json file itself, this data does not seem to be in there (the only objects are land and countries, no cities), and I am not sure how to get this data into my d3 visualization. Am I misunderstanding something about this file/how topojson is encoded?
The github visualisation displays the data in the JSON (orange) overlaid on Google Maps. What's in the JSON are just the orange outlines. If you want cities etc in your map, you'll have to create a separate TopoJSON file, see this tutorial for more information.

How to add json data to geojson map, without going 'back' to shape files?

I'm trying to add data in json format to a geojson file. I realise that one way of doing this, is to transform the geojson file into a shape file, the data in an R object, and merge the two, as attempted here. However, I was wondering whether this is possible without switching 'back' to a shape file. Here's the code to obtain the geojson file and data file:
library(leafletR)
library(jsonlite)
# obtaining map
download.file("http://node-128.dev.socialhistoryservices.org/api/maps?year=1937",
destfile = paste0("testmap", ".json"))
map <- leaflet("./testmap.json")
map # displays map in browser
# obtaining data
testdata <-
fromJSON("http://node-128.dev.socialhistoryservices.org/api/data?code=TXCU")
Note: the 'key' in both files is 'amsterdam_code'
In case you are using node.js try extend-geojson-properties and if want to use on client side download index.js file from github project. See how to use in README of the project.
You can convert topojson to geojson features using topojson api. Then create a join map between geojson and json with common id.

how to create a vector map of some locations

I want to mark some locations in a vector map. And would like to save the map in pdf format with separate layers.I tried arcgis but the map is online cannot export it to a file. can i know what is the common and standerd way of representing data using a vecotr map
Try this vector maps first, they have free versions, it can be useful:[http://vectormap.info/free-maps-for-all-designers-and-mappers][1] it could be easier for you too