geojson

How to create GeometryCollection from geojson with python shapely?

我们两清 提交于 2019-12-10 13:12:16
问题 I want to calculate areas of geometries and some of these geometries can be geometry collections. But I can't do this because shapely doesn't create geometry collection from geojson. Here is the sample code: import sys import shapely from shapely.geometry import shape print sys.version print shapely.__version__ shp = shape({ "type" : "GeometryCollection", "geometries" : [ { "type" : "MultiPolygon", "coordinates" : [ [ [ [ -176.392059198913, -44.2871679740063 ], [ -176.392051742896, -44

Rendering Polygons and MultiPolygons From GeoJSON and/or Dynamically in different Fill Colors, Labels Etc

限于喜欢 提交于 2019-12-10 11:55:45
问题 I am trying to render polygons with different fill colours but from geoJson and am also open to doing so after rendering, dynamically. I would actually like to see both approaches. My current code has colour set in the geojson but it is only rendering as the default (black). <!DOCTYPE html> <html> <head> <script src="http://maps.googleapis.com/maps/api/js"></script> <script> var x=new google.maps.LatLng(40.75597,-73.974228); function initialize() { var data = { "type": "FeatureCollection",

Shiny renders a responsive rCharts leaflet map once, but is blank if you change the input variable

 ̄綄美尐妖づ 提交于 2019-12-09 23:47:50
问题 I am producing a Shiny App that produces a leaflet (rCharts) map depending on which bus route you pick. Everything renders perfectly at first glimpse, but if you change the route number, an empty map appears (not even a tilelayer). This isn't specific to the route number. For example, I can pick any route number to produce the first plot successfully, whereas the second plot, regardless of route number, is blank. Has anyone come across this before? Is there a workaround? Here is a simple

Contour plot data (lat,lon,value) within boundaries and export GeoJSON

你离开我真会死。 提交于 2019-12-09 07:18:32
问题 I'm trying to interpolate data within boundaries and plot contour lines (polygons) based on Latitude, longitude, value data from csv files. Results I want print as geojson. I'm stuck on the basic contour plot from csv. I really appreciate help here. This is what I got in this moment but can't make it work. import numpy as np import matplotlib.pyplot as plt data = np.genfromtxt('temp.csv', delimiter=',') x = data[:1] y = data[:2] [x,y] = meshgrid(x,y); z = data[:3]; plt.contour(x,y,z) plt.show

Display GeoJSON with leaflet that spans the 180th meridian

对着背影说爱祢 提交于 2019-12-09 05:22:01
问题 I am trying to display a geoJSON object (outline of Russia, in this case) that spans the 180th meridian. Currently this displays with part of the country on the left side of the map and part on the right: Looking at leaflet, it seems there is a fix for this but that doesn't seem to work: https://github.com/Leaflet/Leaflet/issues/82. I have also tried adding a coordsToLatLng function but can't seem to get that to work either. Tile layers have a continuousWorld option which I do not think works

How to export GeoJSON in Javascript

你。 提交于 2019-12-09 01:36:20
问题 I have created a GeoJSON list and am trying to export it to file via a button in the webpage. Everything works fine except that the file that is exported only displays 'undefined' and none of the GeoJSON data. What am I doing wrong? HTML : <button onclick="exportToJsonFile()">Download GeoJSON</button> Script : var api = $.getJSON("https://api.data.gov.sg/v1/environment/rainfall?date=2019-07-03", function rainfall(data_rainfall){ apiGeo = { type: "FeatureCollection", features: []}; //----

Node.js/Javascript library to test if point is in geojson multipolygon

断了今生、忘了曾经 提交于 2019-12-08 16:42:01
问题 Is there some library for node.js or javascript in general that provides a function to check if a coordinate is in a geojson multipolygon? I'm trying to create a small HTTP API that tells me which multipolygons (representing countries, counties, cities, etc.) contain a given coordinate. I thought that I'll hold a list of all multipolygons & their bounding-box in memory and then first check for each polygon if its bounding box cointains the coordinate. If yes, then it'll check if the

OpenLayers 4 - fit to extent of selected features

允我心安 提交于 2019-12-08 11:21:29
问题 Me again. So, yesterday I faced a bit of a problem with zooming to selected features and I'm hoping that some of you can push me in right direction.Here it goes... I'm trying to implement autocomplete/search bar using Materialize Materialize Framework. (Here is fiddle example of simple searchbar) $(document).ready(function(){ $('input.autocomplete').autocomplete({ data: { "Apple": null, "Microsoft": null, "Google": 'https://placehold.it/250x250' }, }); }); Now, what I'm trying to do is to

How to add GeoJSON(MultiLineString) layer to a Google Map

社会主义新天地 提交于 2019-12-08 09:48:20
问题 I need to create maps that will use GeoJSON data(MultiLineString format) as a data layer over a Google Map. I have created a Google Maps JavaScript API project, and have an API key. I have tried the following examples: Example I: https://developers.google.com/maps/documentation/javascript/examples/layer-data-simple (This renders a polygon but does not seem to support the styling of a MultiLineString). Example II: https://developers.google.com/maps/documentation/javascript/examples/layer-data

Set serializer geo_field as PointField from another model - Django

北战南征 提交于 2019-12-08 07:26:59
问题 I have two models and need to serialize Article as Geojson by setting the geo_field attribute as point from the Location model. After following the solution given here I get the error: Got AttributeError when attempting to get a value for field `point` on serializer `ArticleSerializer`. The serializer field might be named incorrectly and not match any attribute or key on the `Article` instance. Original exception text was: 'ManyRelatedManager' object has no attribute 'point'. Here are my