geojson

How does one represent MongoDB GeoJSON fields in a Mongoose Schema?

瘦欲@ 提交于 2019-11-28 15:48:58
MongoDB 2.4 allows the use of GeoJSON objects and a slew of neat functions and indexes that I'd like to use. It expects GeoJSON objects to be stored in the format like: loc: { type: 'Polygon', coordinates: [[[-180.0, 10.0], [20.0, 90.0], [180.0, -5.0], [-30.0, -90.0]]] } So in Mongoose one would think the schema would be defined like: loc: { type: 'string', coordinates: [[['number']]] } But this present two problems: having a field called "type" screws up Mongoose's schema parsing because it allows defining fields in the form field: { type: , index: } etc. Mongoose does not like nested arrays.

jqGrid from USGS geojson data

旧巷老猫 提交于 2019-11-28 14:14:25
I'm trying to read and post in a jqGrid a set of earthquakes GeoJSON data extracted from USGS repository. The request is accepted, but displays "Uncaught SyntaxError: Unexpected token" when probably meets the header metadata. $(function () { 'use strict'; $.extend($.jgrid.search, {multipleSearch: true, multipleGroup: true, overlay: 0}); $('#grid').jqGrid({ url: 'http://earthquake.usgs.gov/earthquakes/feed/geojson/2.5/week?callback=?', datatype: 'json', colModel: [ {name: 'mag', label: 'MAGNITUDO', width: 150, jsonmap: 'properties.mag', sorttype: 'number', formatter: 'number', formatoptions:

Difference between GeoJSON and TopoJSON

匆匆过客 提交于 2019-11-28 14:03:06
问题 What is the difference between GeoJSON and TopoJSON and when would I use one over the other? The description of TopoJSON on GitHub implies the TopoJSON files are 80% smaller. So why not just use TopoJSON all the time? 回答1: If you care about file size or topology, then use TopoJSON. If you don’t care about either, then use GeoJSON for simplicity’s sake. The primary advantage of TopoJSON is size. By eliminating redundancy and using a more efficent fixed-precision integer encoding of coordinates

D3.js + osm geojson = black rectangle

坚强是说给别人听的谎言 提交于 2019-11-28 11:13:38
问题 I am trying to visualize russians regions. I got data from here, validate here and all was well - picture. But when I try to draw it, I receive only one big black rectangle. var width = 700, height = 400; var svg = d3.select(".graph").append("svg") .attr("viewBox", "0 0 " + (width) + " " + (height)) .style("max-width", "700px") .style("margin", "10px auto"); d3.json("83.json", function (error, mapData) { var features = mapData.features; var path = d3.geoPath().projection(d3.geoMercator());

Venue/Indoor Map using D3.js and Geojson

拜拜、爱过 提交于 2019-11-28 10:38:00
I have created geojson file which contains all the features of 1st floor of a shopping mall. I got that venue map projected using d3.js with different colors but only some parts not the complete map. Below is the script code and link to the geojson file. Also please note that i have not converted this geojson into topojson and used Qgis to draw the maps and c#.net to convert the geometry data to geojson objects. Can anyone please check my json and my d3.js code? Do I need to use any other projections? https://www.dropbox.com/s/8pu2s0yamfkd89p/JSONfromDB_8Feb2014.json $(document).ready(function

How to divide a map into zipcodes using d3, javascript, and a json file?

心不动则不痛 提交于 2019-11-28 10:29:28
I'm trying to create a nyc map with zipcode areas I can color in based on census data (like color an area red if majority white or blue if majority nonwhite). I am simply using one of the shape files I found online from here ( https://data.cityofnewyork.us/Business/Zip-Code-Boundaries/i8iw-xf4u/data ). I converted the shp file to a geojson and then a topojson file. I'd appreciate it if someone could look at my code below, and let me know how I can go about doing this. Code: <!DOCTYPE html> <meta charset="utf-8"> <style> </style> <body> <script src="//d3js.org/d3.v3.min.js" charset="utf-8"><

Geojson map with D3 only rendering a single path in a feature collection

穿精又带淫゛_ 提交于 2019-11-28 09:21:09
问题 I'm trying to draw a geojson map of some regions of Colombia. Currently it only shows a single path:, My feature collection has 52 features, but I can only draw this one feature. I do not know what I'm doing wrong, I'm based my code on other tutorials. How can I do to show all the paths? var features = mapData.features; console.log(features); // Update color scale domain based on data // Draw each province as a path mapLayer.selectAll('path') .data(features) .enter().append('path') .attr('d',

D3 filtering data points

牧云@^-^@ 提交于 2019-11-28 06:15:23
问题 I'm implementing the classic mercator example (https://github.com/mbostock/d3/blob/master/examples/mercator/mercator.html), which I've changed to zoom into Afghanistan and to use only one custom slider. I'm reading in GeoJSON data of places where explosions have happened and the graph maps them all at load. I want to use the slider to view only a month of explosion points at a time but am having trouble filtering the results. I've tried several things based on posts in the Google group but

D3.geo : responsive frame given a geojson object?

こ雲淡風輕ζ 提交于 2019-11-28 01:58:40
问题 I use Mike Bostock's code to Center a map in d3 given a geoJSON object. The important part of the code is this: var width = 960, height = 500; var svg = d3.select("body").append("svg") .attr("width", width) .attr("height", height); d3.json("/d/4090846/us.json", function(error, us) { var states = topojson.feature(us, us.objects.states), state = states.features.filter(function(d) { return d.id === 34; })[0]; /* ******************* AUTOCENTERING ************************* */ // Create a unit

Python Script to Convert CSV to GeoJSON

让人想犯罪 __ 提交于 2019-11-28 01:36:20
问题 I am needing a Python script to convert CSV data to GeoJSON output. The output should match the format, below: { "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": { "type": "Point", "coordinates": [ -85.362709,40.466442 ] }, "properties": { "weather":"Overcast", "temp":"30.2 F" } } ] } I am using this script to run the process, but it does not produce the desired output: import csv, json li = [] with open('CurrentObs.csv', newline='') as csvfile: reader = csv.reader