geojson

How to convert from PostgreSQL to GeoJSON format?

怎甘沉沦 提交于 2019-12-23 10:07:39
问题 I have a simple table called"imposm3_restaurant" with columns [ id, name, geometry] I want to convert these data into geoJSON, I am using this function CREATE VIEW imposm3_restaurants_geojson AS SELECT row_to_json(fc) AS geojson FROM (SELECT 'FeatureCollection' As type, array_to_json(array_agg(f)) As features FROM (SELECT 'Feature' As type, ST_AsGeoJSON((lg.geometry),15,0)::json As geometry, row_to_json((id, name)) As properties FROM imposm3_restaurants As lg) As f ) As fc; and the result is

What means “Generic type 'Feature<T>' requires 1 type argument(s)” in Typescript?

本小妞迷上赌 提交于 2019-12-23 07:48:58
问题 I try to use GeoJson in typescript but the compiler throws error for this two variables: Generic type 'Feature<T>' requires 1 type argument(s) const pos = <GeoJSON.Feature>{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [0, 1] } }; const oldPos = <GeoJSON.Feature>{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [2, 4] } }; What is this supposed to mean? 回答1: The Feature interface requires a parameter: export interface Feature<T extends GeometryObject>

How do you convert normal geographic json coming from server into geoJson?

早过忘川 提交于 2019-12-23 06:00:46
问题 I have a server with geographic data in normal json format, which I need to change into geojson format so Mapbox can read it. How do you do this? For example, how do you convert this: [ { "id": 0, "name": "Hotel", "icon": "Sleep", "address": "SampleStreet 34", "latitude": 12, "longitude": 55 } ] into this: { "type": "FeatureCollection", "features": [ { "id": 0, "type": "Feature", "properties": { "placeID": 0, "name": "Hotel", "icon": "sleep", "addressFormatted": "SampleStreet 34" }, "geometry

Adding geojson layer to openlayers 3

跟風遠走 提交于 2019-12-23 05:17:17
问题 I have gone through a few different examples on this and nothing ever seems to work. I am trying to simply draw a point on the map using GeoJSON as the source. Here is what I currently have: var staticGeo = new ol.source.GeoJSON(({ object: { type: 'Feature Collection', crs: { type: 'name', properties: {name: 'EPSG:4326'} }, features: [{ type: 'Feature', geometry: { type: 'Point', coordinates: [0,0] } }] }, projection: 'EPSG:3857' })); var vectorSource = new ol.source.Vector({ source:

Accessing Coordinates in a nested geojson file to draw polygons with Google Maps API v3

混江龙づ霸主 提交于 2019-12-23 03:21:37
问题 I am having a real pain of trying to draw multiple polygons from a geojson file. Below I have pasted a sample of the geojson file and the javascript used to access it. It seems the main problem I am running into is that I cannot get into that array of coordinates nested in each record as it either returns the error that "coordinates" is undefined or that there is no method "setMap" for undefined. I have been able to return other nested aspects of a similar JSON file (this is a test file, the

Accessing Coordinates in a nested geojson file to draw polygons with Google Maps API v3

时光总嘲笑我的痴心妄想 提交于 2019-12-23 03:21:14
问题 I am having a real pain of trying to draw multiple polygons from a geojson file. Below I have pasted a sample of the geojson file and the javascript used to access it. It seems the main problem I am running into is that I cannot get into that array of coordinates nested in each record as it either returns the error that "coordinates" is undefined or that there is no method "setMap" for undefined. I have been able to return other nested aspects of a similar JSON file (this is a test file, the

How to read geojson with vega

会有一股神秘感。 提交于 2019-12-23 03:12:18
问题 It sounds super simple, but I can't get how can I use geojson, not topojson, for my polygons. that's my current attempt: "data": [ { "name": "nabs", "url": "both_boundaries.geojson", "format": {"type": "json"}, "transform": [ { "type": "geopath", "projection": "mercator", "scale": 74, "center": [-73.99,40.72] } ] } ] 回答1: You have to parse the features using property within your format: "format": {"type": "json", "property":"features"}, Full example spec: {"$schema": "https://vega.github.io

Combining geojson and json for leaftlet

≡放荡痞女 提交于 2019-12-23 02:53:35
问题 I have a Leaflet map with a GeoJson Layer on it var objJson = "https://raw.githubusercontent.com/salucci/Leaflet-Teste/master/BrasilNovo.json"; geojsonLayer = new L.GeoJSON.AJAX(objJson, { style: style, onEachFeature: onEachFeature}); geojsonLayer.addTo(map); info.addTo(map); And also have a Ajax request that receives Json data from a local PHP server. $.ajax({ url: "http://127.0.0.1/projects/phpController.php", type: "POST", dataType: "json", data: {"Codigo": 1100023}, success: function(data

Leaflet.js - Create layers and add markers depending on geojson category data?

梦想的初衷 提交于 2019-12-23 02:26:20
问题 I have a .js file with coordinates for internships: var internships = [{ "features": [ {"type":"Feature","properties":{"category":"entretient","Name":"green"},"geometry":{"type":"Point","coordinates":[50.807149, 3.162994]}}, {"type":"Feature","properties":{"category":"securité","Name":"blue"},"geometry":{"type":"Point","coordinates":[50.334421, 3.290146]}}, {"type":"Feature","properties":{"category":"secretaria","Name":"red"},"geometry":{"type":"Point","coordinates":[50.744787, 2.256216]}} ]

Remove duplicate values from GeoJSON Collection

不羁的心 提交于 2019-12-23 01:43:17
问题 I would like to know the simplest javascript method for removing duplicate values (coordinates) from a large GeoJSON collection (approx 100k lines). After removing the duplicate values I would like to log the updated collection to the console or display the result on a webpage. A sample of my attempt is below, however all I am getting in the console is an empty array. window.onload = init; function init() { function eliminateDuplicates(arr) { var i; var len = arr.length; var out = []; var obj