TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Are there any JavaScript libraries for generating maps?

49 pointsby CoreSetover 10 years ago
Specifically, I&#x27;d love to be able to pass in geocoded location boundaries and color styles to generate a map of the chosen color over the chosen area. Google maps is obviously great for showing navigational data or directions, but I&#x27;m thinking along the lines of something more graphic.<p>Does anyone have any thoughts along these lines?

16 comments

mbostockover 10 years ago
Here’s my introductory tutorial for creating a map with D3 &amp; TopoJSON using geometry from Natural Earth:<p><a href="http://bost.ocks.org/mike/map/" rel="nofollow">http:&#x2F;&#x2F;bost.ocks.org&#x2F;mike&#x2F;map&#x2F;</a><p>And here’s a subsequent tutorial for visualizing geographic data:<p><a href="http://bost.ocks.org/mike/bubble-map/" rel="nofollow">http:&#x2F;&#x2F;bost.ocks.org&#x2F;mike&#x2F;bubble-map&#x2F;</a>
评论 #8608092 未加载
评论 #8608327 未加载
azovover 10 years ago
If you want to create your own map tiles in advance and show them using JavaScript library - use TileMill [1] and Leaflet [2]. Both are excellent and very well documented.<p>To create the whole map on the fly using JavaScript - try mapbox-gl.js [3]. You should be able to pass your location boundaries via mapboxgl.GeoJSONSource (and then you probably don&#x27;t even need MapBox API key - haven&#x27;t tried it, though) and style it like this: <a href="https://www.mapbox.com/mapbox-gl-styles/styles/bright-v4.json" rel="nofollow">https:&#x2F;&#x2F;www.mapbox.com&#x2F;mapbox-gl-styles&#x2F;styles&#x2F;bright-v4.jso...</a><p>PS. If you decide to host your own tiles - remember that browsers limit the number of connections to each domain. Your map will load much faster if you serve tiles from several different domains, e.g. tiles1.example.com, tiles2.example.com, etc.<p>[1] TileMill - <a href="https://www.mapbox.com/tilemill/" rel="nofollow">https:&#x2F;&#x2F;www.mapbox.com&#x2F;tilemill&#x2F;</a><p>[2] Leaflet - <a href="http://leafletjs.com/" rel="nofollow">http:&#x2F;&#x2F;leafletjs.com&#x2F;</a><p>[3] MapboxGL - <a href="https://www.mapbox.com/mapbox-gl/" rel="nofollow">https:&#x2F;&#x2F;www.mapbox.com&#x2F;mapbox-gl&#x2F;</a>
评论 #8608476 未加载
thrwy10over 10 years ago
You might be looking for Mapbox and&#x2F;or Leaflet<p><a href="https://www.mapbox.com/developers/" rel="nofollow">https:&#x2F;&#x2F;www.mapbox.com&#x2F;developers&#x2F;</a><p><a href="http://leafletjs.com/" rel="nofollow">http:&#x2F;&#x2F;leafletjs.com&#x2F;</a>
评论 #8608241 未加载
评论 #8609834 未加载
chishakuover 10 years ago
This can help you get up and running quickly:<p><a href="http://jvectormap.com/" rel="nofollow">http:&#x2F;&#x2F;jvectormap.com&#x2F;</a>
mdhgriffithsover 10 years ago
Google Maps API does have [some limited] style options, however then you&#x27;re stuck using Google Maps API. There is even a &quot;wizard&quot; to make things easier: <a href="http://gmaps-samples-v3.googlecode.com/svn/trunk/styledmaps/wizard/index.html" rel="nofollow">http:&#x2F;&#x2F;gmaps-samples-v3.googlecode.com&#x2F;svn&#x2F;trunk&#x2F;styledmaps&#x2F;...</a><p>Mapbox is a great alternative for stylish maps. Their JS library is built off of Leaflet which allows you to change the tileset at a later date.
kaybeover 10 years ago
Might not fit your criteria, but in the scientific community GMT is popular:<p><a href="http://gmt.soest.hawaii.edu/" rel="nofollow">http:&#x2F;&#x2F;gmt.soest.hawaii.edu&#x2F;</a>
hackertoolboxover 10 years ago
Great discussion. Tools are in the box now.<p><a href="http://www.hackertoolbox.com/tags/map" rel="nofollow">http:&#x2F;&#x2F;www.hackertoolbox.com&#x2F;tags&#x2F;map</a>
cinjonover 10 years ago
Lightning by mathisonian is a solid library for generating these in python&#x2F;js. It&#x27;s an http-based data viz server with additional functionality similar to iPython notebooks. Check out the map demo on the github here:<p><a href="https://github.com/mathisonian/lightning" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mathisonian&#x2F;lightning</a>
onion2kover 10 years ago
You can style maps using <a href="https://www.mapbox.com/" rel="nofollow">https:&#x2F;&#x2F;www.mapbox.com&#x2F;</a> and embed them very easily using leaflet.js.<p>If you want to go a bit further, stamen mapstack does some cool stuff: <a href="http://mapstack.stamen.com/" rel="nofollow">http:&#x2F;&#x2F;mapstack.stamen.com&#x2F;</a>
CoreSetover 10 years ago
Thanks all for the responses! I have a lot of new tech to try out.<p>For those wanting an example:<p><a href="http://kut.org/term/google-fiber" rel="nofollow">http:&#x2F;&#x2F;kut.org&#x2F;term&#x2F;google-fiber</a><p>Basically just a grey&#x2F;white map showing important navigational details like roads and rivers, with different color sections overlaying it.
评论 #8612773 未加载
rkdaover 10 years ago
Can you post an example of what you want?<p>If you just want to produce choropleths, you can try Leaflet. Other options include d3.js and kartograph.<p><a href="http://kartograph.org/" rel="nofollow">http:&#x2F;&#x2F;kartograph.org&#x2F;</a><p><a href="http://d3js.org/" rel="nofollow">http:&#x2F;&#x2F;d3js.org&#x2F;</a>
dpeckover 10 years ago
Can you clarify on &quot;more graphic&quot;?<p>I&#x27;m a fan of datamaps, <a href="https://datamaps.github.io/" rel="nofollow">https:&#x2F;&#x2F;datamaps.github.io&#x2F;</a>, for doing some quick and getting decent output.
eloycotoover 10 years ago
You can use cartodb. It&#x27;s a service but it&#x27;s faster than use libraries like leafletjs<p><a href="http://cartodb.com/" rel="nofollow">http:&#x2F;&#x2F;cartodb.com&#x2F;</a><p>Regards.
jaybo_nomadover 10 years ago
Bleeding edge WebGL requirements, but great 3D object control: <a href="http://cesiumjs.org/" rel="nofollow">http:&#x2F;&#x2F;cesiumjs.org&#x2F;</a>
adrice727over 10 years ago
Another D3 tutorial that was helpful:<p><a href="http://www.tnoda.com/blog/2013-12-07" rel="nofollow">http:&#x2F;&#x2F;www.tnoda.com&#x2F;blog&#x2F;2013-12-07</a>
bniover 10 years ago
<a href="http://geo5.org" rel="nofollow">http:&#x2F;&#x2F;geo5.org</a>