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

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.

Related

Get a .tmx file from its .json

I've been using Tiled to create .tmx maps for one of my projects, maps that I export to JSON before using with Phaser.js.
Problem is, a few months ago I mistakenly deleted the .tmx file for the game first map. It's still working fine but now I can't change anything on the first map layout with Tiled because I only have the JSON for it.
I've been looking for an answer with no success so far, but is there a way to convert a .json Tiled map exported from a .tmx file, back to its original format ?
You should be able to simply open the JSON exported map in Tiled, and save it again as a TMX file. To be able to select the file, you may need to change the file type in the Open File dialog.
Btw, you should consider committing your project to a version control system (Git is a popular one), so that such mistakes will not generally lead to loss of data. You don't always get lucky.

extracting data in csv or excel form from an interactive map

I'm not a programmer but i was wondering if it would be possible to extract a list of zipcodes and median income in either csv or excel form from this interactive map.
http://www.wnyc.org/story/174508-blog-census-locates-citys-wealthiest-and-poorest-neighborhoods/
Data used from the map is coming from this website:
http://factfinder.census.gov/faces/nav/jsf/pages/index.xhtml
You can find also here some data related:
http://www.census.gov/quickfacts/map/RHI225214/36
About your map, i recommend you to find another way to extract those data, like a database or a tool available on a website, or use links provided.

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.

extracting CSV data

I am trying to build a custom map in Tile Mill and am new to programming in general so I apologize is if comes off as uninformed. I've done research but I'm not sure if I'm looking in the right place.
My basic question: this is an embedded map of restaurants in the SF area. Is there a way for me to extract the data for the locations to use in building a custom map of my own?
http://www.sfgate.com/food/top100/2012/map/
It seems that if the location markers exist on a map, that meta data is somewhere, I just don't know how/where to access it....I believe the raw formats for inputting location into a map are CSV or KML and wondering if there is a way to extra these data types from embedded maps.
Thanks!!
View the source of the page in question, look for the data (it's under the variable mapLocs, copy it from the page, and write a little script to convert their format to CSV.
^ this is likely against at least 2 different copyrights (newspaper's & geocoder's), so proceed at your own risk.

Combining additional data with Shapefile using GeoJSON and Gdal

I used Mike Bostock's great tutorial to make a simple map using downloaded shapefiles and processing them with GDAL into GeoJSON files.
http://bost.ocks.org/mike/map/
I'm trying to build on this learning by taking a county-level shapefile map and marrying it with additional demographic data (CSV) so that I can load a single GeoJSON file and not have to use Javascript to merge the data at runtime. The goal is to have a county-level heatmap.
The CSV file has an ID column that looks like this: 01348. While the Shapefile has two ID columns that are 01 and 348.
Is it possible to use GeoJSON to store this kind of data? If so, what kind of terminal commands must I use to combine the two?
Little trick:
When converting from Shape file to GeoJSON, keep "id-a":"01";"id-b":"348" as neighbors in this order.
use a simple regex to delete all ";"id-b":" and thus obtain "id-a":"01348".
go ahead to inject your CSV property given the common ID, see: How to add properties to topojson file?
That's should work.