topojson

Adding tooltip in d3.js map

痞子三分冷 提交于 2019-12-03 16:09:37
I'm trying to add a tooltip showing the name of districts when you hover over it in the map in d3.js. The input is a topojson file and I've been able to successfully generate the map with district boundaries and highlight the currently selected district. For the tooltip I tried doing something similar to this , but nothing happens at all. The code I've used is given below. The tooltip code is towards the end. var width = 960, height = 600; var projection = d3.geo.albers() .center([87, 28]) .rotate([-85, 0]) .parallels([27, 32]); var path = d3.geo.path() .projection(projection); var svg = d3

Map with d3.js and TopoJSON, Albers Siberia projection

為{幸葍}努か 提交于 2019-12-03 06:23:24
问题 I'm trying to make a Choropleth with d3.js but I got stucked just at the beginning. I found a Shapefile and generated GeoJSON and TopoJson files from it just like here. The map uses Albers-Siberia projection. What I found about this projection: Projection: Albers Equal-Area Conic Units: Meters Spheroid: Krasovsky Central meridian: 105 Standard Parallel 1: 52 Standard Parallel 2: 64 Reference Latitude: 0 False Easting: 18500000 False Northing: 0 PROJ.4: +proj=aea +lat_1=52 +lat_2=64 +lat_0=0

d3: us states in topojson format filesize is way too large

核能气质少年 提交于 2019-12-03 04:02:01
I am rendering two maps in my web page and I'm using d3 to do it. One is a world map with all the countries' borders represented. The file I'm using is a version of this: https://raw.github.com/mbostock/topojson/master/examples/world-110m.json The second map is of US states. All I need are state borders (not counties). I am using a modified version of this file: http://bl.ocks.org/mbostock/raw/4090846/us.json I've modified both files to include the name and two letter state or country code) which I use for tooltips. The world-110m.json file is about 100kb. the states.json file is well over

Map with d3.js and TopoJSON, Albers Siberia projection

怎甘沉沦 提交于 2019-12-02 19:47:34
I'm trying to make a Choropleth with d3.js but I got stucked just at the beginning. I found a Shapefile and generated GeoJSON and TopoJson files from it just like here . The map uses Albers-Siberia projection. What I found about this projection: Projection: Albers Equal-Area Conic Units: Meters Spheroid: Krasovsky Central meridian: 105 Standard Parallel 1: 52 Standard Parallel 2: 64 Reference Latitude: 0 False Easting: 18500000 False Northing: 0 PROJ.4: +proj=aea +lat_1=52 +lat_2=64 +lat_0=0 +lon_0=105 +x_0=18500000 +y_0=0 +ellps=krass +units=m +towgs84=28,-130,-95,0,0,0,0 +no_defs MapInfo:

D3 Topojson Circle with Radius Scaled in Miles

可紊 提交于 2019-12-02 15:41:01
问题 (assuming existing projection/topojson) What I'm trying to do is create a circle at a point ([long,lat]) of radius (r) in miles. I know there is a d3.geo function for this, but after some consideration I don't think it will be very compatible with my particular application. So now I'm looking for using a native svg circle solution, where cx and cy are the lat and long, and r is the radius in miles. I know the cx and cy, but I don't know how to make sure the r is say 15 miles. So the main

D3js SVG open lines display a fill artifact, how to fix it?

微笑、不失礼 提交于 2019-12-02 06:52:14
问题 I just added French rivers_lines to my D3js generated SVG. It now display a result like : I need to keep the river lines without the artifact. Data : a topojson made of arcs. CSS code: .rivers { fill: none; fill-opacity: .1; stroke-width:1px; stroke: #C6ECFF; } same result with some colors and opacity near zero: fill: #FF0000; fill-opacity: .1; D3 code: rivers = topojson.feature(fra, fra.objects.rivers), //Append rivers svg.append("path") .datum(rivers) .attr("d", path) svg.selectAll(".rivers

Leaflet: Error in geoJson overlay at Russia Finland border

橙三吉。 提交于 2019-12-02 05:59:20
问题 I'm using the 1:50m Cultural Vectors shape file from naturalearthdata.com. I use ogr2ogr to create a geoJson file with the following command: ogr2ogr -f GeoJSON geo_world_50m.json ne_50m_admin_0_countries.shp I then create a topoJson file with this command: topojson --id-property iso_n3 -p name=admin -p name -p iso_a3=iso_a3 -p iso_a3 -o topo_world_50m.json geo_world_50m.json Once I have my topoJson file, I load it in to Leaflet: $.getJSON('topo_world_50m.json', function (data) { var country

Keep D3 objects size constant on Map while zoom in/out

ぐ巨炮叔叔 提交于 2019-12-02 03:46:29
问题 I am following the example from http://bl.ocks.org/d3noob/raw/5193723/ The cirles drawn in the example increases in size when zoomed-in. I am not able to figure out a way in which the circles' size can be kept same. Any ideas? Edit1 : Any ideas on how to keep Pie arc constant in radii. I have figured out the the way to keep circles to constant radius as below: g1.append("circle") .attr("cx", 200) .attr("cy", 200) .attr("r", 10) .style("fill", "red"); var zoom = d3.behavior.zoom().on("zoom",

Invisible vectors? Combining d3.tile(), d3.zoom() and TopoJSON vectors

微笑、不失礼 提交于 2019-12-02 02:30:34
问题 I've made effective D3 maps using rasters ( d3.tile and map libraries) and vectors (TopoJSON in SVG shapes). But I hit a bug when I combine them. I followed Mike Bostock's raster-and-vector examples, especially his "Raster & Vector III", which changes the transform and stroke width to update how the vectors are displayed. My map almost works perfectly. However, upon loading, only the raster tiles are displayed; the vectors are invisible: But as soon as I trigger the d3.zoom event (by panning

Leaflet: Error in geoJson overlay at Russia Finland border

允我心安 提交于 2019-12-02 02:23:49
I'm using the 1:50m Cultural Vectors shape file from naturalearthdata.com . I use ogr2ogr to create a geoJson file with the following command: ogr2ogr -f GeoJSON geo_world_50m.json ne_50m_admin_0_countries.shp I then create a topoJson file with this command: topojson --id-property iso_n3 -p name=admin -p name -p iso_a3=iso_a3 -p iso_a3 -o topo_world_50m.json geo_world_50m.json Once I have my topoJson file, I load it in to Leaflet: $.getJSON('topo_world_50m.json', function (data) { var country_geojson = topojson.feature(data, data.objects.geo_world_50m); country_layer.addData(country_geojson);