Questions tagged [geojson]

GeoJSON is a geospatial data interchange format based on JavaScript Object Notation (JSON)

Filter by
Sorted by
Tagged with
44
votes
13answers
34k views

Converting ArcGIS Server JSON to GeoJSON?

I'm creating a web map using Leaflet, and I want to be able to grab feature layers from our ArcServer. I have successfully been able to retrieve a feature class as JSON, but Esri's JSON objects don't ...
53
votes
5answers
97k views

Loading external GeoJSON file into Leaflet map?

I would like to load a geoJSON (polygon) file into my leaflet map. I have seen examples where geoJSON is embedded into the javascript code but I can't find any examples showing how it is done with an ...
31
votes
4answers
18k views

SQL query to have a complete geojson feature from PostGIS?

I would like to get a geojson feature with properties from PostGIS. I have found an example to have a feature collection but I can't make it works for just a feature. SELECT row_to_json(fc) FROM ( ...
16
votes
3answers
14k views

Generating GeoJSON with Python

I want to programmatically create a GeoJSON file using polygons from a shapefile but adding attributes from my own application. This is easily done for a shapefile: def create_data_dayer(self,...
18
votes
5answers
37k views

Convert Shapefiles to GeoJSON?

I'm trying to convert Shapefiles from the State of Texas Senate Districts website into a GeoJSON file for use with Google Maps API. I'm using QGIS to facilitate but I can't get the projection/...
14
votes
2answers
17k views

leaflet geojson coordinate problem

I just started to play with leflet/geojson a little. But my coordinates are not rendered properly and I have no clue what is going on. My coordinates are: 52.23943, 4.97599. They work correct with ...
2
votes
1answer
456 views

SQLServer Shapefile Export won't load in MongoDB due to self intersection

I am having an issue loading a handful of GeoJSON files that were created from a shapefile export from SQLServer into MongoDB. This polygon will not load in MongoDB because of two duplicate vertices ...
32
votes
4answers
29k views

How to insert a GeoJSON polygon into a PostGIS table?

I need to insert a polygon from GeoJSON to my PostGIS table. This is how the SQL query looks like. INSERT INTO tablename (name, polygon) VALUES ( 'Name', ST_GeomFromGeoJSON( '{ ...
15
votes
3answers
8k views

Converting SimpleGeo Places GeoJSON file to shapefile?

SimpleGeo has recently made their "Places" data set freely available which is GREAT, because now we can use it for our own purposes, even offline. So I went about downloading the 2GB dataset, which ...
17
votes
1answer
20k views

Passing Filter Parameters to GeoServer WFS via URL?

I'm trying to use PHP's CURL function to fetch geoJSON information from a GeoServer instance. I'm doing this using url variables rather than trying to construct a full xml GetFeature request. However,...
23
votes
1answer
18k views

Converting GeoJSON to Shapefile using ogr2ogr?

I have a GeoJson file that I want to convert to ESRI Shapefile using ogr2ogr in FWTools. I tried using ogr2ogr -F "ESRI Shapefile" filename.shp geojsonfile.json OGRGeoJSON I got output ERROR 6:...
5
votes
2answers
15k views

Convert shapely polygon coordinates

I am trying to work with a shapefile using shapely, fiona and python. The original coordinate system is in latitude and longitude that I am trying to convert to state plane system. So I want an ...
10
votes
1answer
2k views

arcpy.geometry __geo_interface__ and AsShape() function: loss of precision and holes

I'm serializing my arcpy geometries as geojson so that I can 'hydrate' them back as geometries later and I'm having 2 problems in the cycle.: PROBLEM 1: Precision R0 = arcpy.SearchCursor(self....
36
votes
2answers
14k views

Convert GeoJSON to TopoJSON

Question How do you convert GeoJSON data to TopoJSON? Why Topojson files are often smaller than geojson and the conversion allows you to incrementally simplify a dataset, if you wish.
27
votes
2answers
34k views

Opening GeoJSON file with mixed geometries in QGIS?

If I have a GEOJson file, for example a file named test.js with inside the following: { "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": {"type": "Point", "coordinates": [...
5
votes
2answers
7k views

GDAL python cut geotiff image with geojson file

I wrote the function which cutting geotiff image by bounding box. First image is original. At second you can see result off my code. I don't use gdalwarp or any console utilities. But I have no idea ...
9
votes
3answers
38k views

Add GeoJSON layer to OpenLayers 3

I have a GeoJSON file called mygeojson.json and I want to add it as a layer in OpenLayers 3 on top of an openstreetmap layer. So far I could display the openstreetmap world including zoom etc. but for ...
8
votes
1answer
3k views

Is there an easy way to use Postgis GeoJSON in Openlayers 3

I was using google-vector-layers and leaflet-vector-layers from Jason Sanford (https://github.com/JasonSanford) to easily display, style and add customized popups for data from Postgis-databases. ...
5
votes
2answers
4k views

Merging/Joining GeoJSON and JSON?

I want OSM administrative boundaries from http://global.mapit.mysociety.org/area/14455.html. I can get the geodata in different formats there, but the attribute data always is a separate JSON file. I ...
5
votes
3answers
5k views

Generating random coordinates in multipolygon in Python?

How to generate random points in multi-polygon using geojson in python ? thus far I found a class in JavaScript named : randomPointsOnPolygon(numberOfPoints, polygon) but I need to use something ...
8
votes
3answers
15k views

Import GeoJSON into PostGIS

I want to import GeoJSON avaliable in the following dump into PostGIS but I am not able to import it. I already imported geousa data available in this public dump into MongoDB smoothly. Let me know is ...
4
votes
1answer
12k views

How do I get GeoJSON data from GeoServer into show up on my Leaflet map?

I'm trying to create a simple "Green" map for my city. The idea being that it is a website with a map and layers you can turn on and off. I am serving the data through GeoServer and am using GeoJOSN ...
17
votes
1answer
10k views

How to display geoJSON from an URL in a layer?

I am looking for some type of plugin or code which would allow me to add a geojson URL, define the areas to input the lat/long variables from the visible Qgis canvas map and call/render the results ...
5
votes
1answer
7k views

Leaflet GeoJSON with projected coordinates (3857)

I am trying to get a GeoJSON with projected coordinates to show in Leaflet. I have no problems loading GeoJSON with lat/lng (EPSG:4326). Here is a fiddle where I load the GeoJSON with unprojected lat/...
3
votes
2answers
4k views

export map state as JSON: Web_Map_as_JSON

Is there a way to export the current map state as a JSON object, mostly named Web_Map_as_JSON. The JSON specification should be like this. In other words, it would be convenient to have a function ...
2
votes
1answer
548 views

gdal.VectorTranslate returns an empty file

When testing the following code: from osgeo import gdal import json def read_file(filename): f = gdal.VSIFOpenL(filename, "rb") if f is None: return None content = gdal.VSIFReadL(...
1
vote
1answer
967 views

Using PostGis BBox and ST_intersects Queries? [closed]

CartoDb Recommend here that the following query is faster than an St_intersects Query SELECT * FROM {table_name} WHERE the_geom && ST_SetSRID(ST_MakeBox2D(ST_Point(-73.9980, 40.726), ST_Point(...
21
votes
1answer
18k views

Storing GeoJSON FeatureCollection to PostgreSQL with PostGIS?

I am new to GeoJSON. I have a GeoJSON features collection as shown and would like to store it in postgres table (testtable). My postgres table has a serial id and geometry column. { "type": "...
18
votes
1answer
5k views

What is topojson and how is it different than geojson?

This is a conceptual question. What are the differences between these? and what are the pros and cons of these formats?
10
votes
2answers
12k views

Parsing a GeoJSON file with jQuery

I'm trying to iterate through a GeoJSON file (below) and eventually populate an array with a few attributes within "properties". I keep coming up short working through various examples I can find. Do ...
29
votes
1answer
25k views

What is the default projection in Leaflet?

I've read an API documentation for Leaflet on its site, but I can't realize: what is a default projection to view maps? It was written about spherical and elliptical Mercator and Equirectangular - so ...
20
votes
3answers
16k views

Exporting Feature GeoJSON from PostGIS? [duplicate]

I'd like to do a GeoJSON dump of a PostGIS table, but I want to export features (the geometry and the properties) not just the geometry. I've been digging into the ST_AsGeoJSON function but it looks ...
12
votes
1answer
9k views

What's up with the GeoJSON spec and CRS as a IRM?

I'm writing a web API to our GIS data, currently revamping our geocoding service. I'm creating the option for folks to specify the output type as GeoJSON so I'm trying to follow the spec. Our data is ...
22
votes
3answers
20k views

Selecting feature types when using ogr2ogr to convert to shapefile?

Shapefiles can only have one geometry type, but many other formats (kml, geojson) can have multiple types. When converting to shapefiles, is it possible to to tell ogr2ogr to create multiple ...
24
votes
2answers
1k views

Best-practices for databases and APIs with geographic data spanning the antimeridian

What is the best-practice for storing geographic features (lines, polygons and their multipart equivalents) when these features span the antimeridian (±180° longitude), and need to be sent to and ...
24
votes
4answers
34k views

GeoJSON Styling information

As far as I can see there is nothing in the GeoJSON standard to store styling information, i.e. line colours, thicknesses etc. Am I missing something or is this just something that GeoJSON doesn't ...
17
votes
3answers
14k views

How to create a GeoJSON that works with D3?

I'm simply trying to convert a .shp file to a geoJSON format using: ogr2ogr -f geoJSON output.json input.shp After executing the command nothing seems to be wrong. Here's an excerpt from the output....
6
votes
3answers
21k views

Is it possible to convert regular JSON to GeoJSON?

My apologies if this is a repeat question, I searched here and couldn't find an answer. I have JSON data I've exported from Openpaths.cc which contains lat and lon values. However, the data is not in ...
4
votes
1answer
19k views

How to get LatLng array from geoJSON Layer in Leaflet?

i need to hand the latlng coordinates from my phpPostGIS-served geoJSONLayer as an array over to a new added HeatMap Layer. L.geoJSON has an build-in option: coordsToLatLng( coords )" and a static ...
4
votes
2answers
15k views

How to plot geo-data using matplotlib/python

I am trying to plot a polygone on python, using different libararies, but no one of these worked with me. I tried vincent ,Shapely , .. and now matplotlib. I don't wanna use softwares like qgis I ...
16
votes
5answers
8k views

Polygons and MultiPolygons should follow the right-hand rule

http://geojsonlint.com/ I get error Polygons and MultiPolygons should follow the right-hand rule I used it for past 3 years without any problem with my old geojson file. Now geojsonlint enforce the ...
6
votes
1answer
4k views

ogr2ogr specify lat/long order on conversion to GeoJSON

When using ogr2ogr to convert a polyon from a .shp file to GeoJSON, I noticed that it writes the coordinates in order lat, long. I noticed this because whenever I tried to view the GeoJSON on a map, ...
5
votes
2answers
3k views

Attribute editing in QGIS on geoJson file

We have vector files in the format of geoJson files. We need to keep it in geoJson format as it is picked up by mobile devices via Restful services. The problem is we want to change the attributes of ...
4
votes
2answers
4k views

How to export thousands of features from PostGIS to a single GeoJSON file?

I know how to export one feature from a PostGIS database using ogr2ogr: $ogr2ogr -f GeoJSON out.json "PG:host=localhost dbname=xxx user=xxx password=xxx" -sql 'select id, county, wkb_geometry from ...
2
votes
1answer
3k views

Geopandas/folium map not displaying?

I'm trying to use a combination of geopandas, pandas and folium to create a polygon map that I can embed incorporate into a web page. For some reason, it's not displaying and wonder if anyone can ...
8
votes
2answers
7k views

Converting KML files for use with Python library Shapely

I am trying to get a KML-file (wijken.kml) into Shapely. The KML-file is validated against the proper XML schema, so I guess the input is correct. Routes I have tried: 1) Converting to WKT or WKB ...
6
votes
1answer
797 views

GeoJSON attributes encoding limitation

I have problem when trying to encode attribute values in latin1 using OGR GeoJSON driver. Accent char are not displayed correctly. Is the GeoJSON encoding is limited to UTF-8? I can't find any info ...
5
votes
1answer
3k views

rasterio masking with GeoJSON from file issue

I'm trying to load GeoJSON from a file for use with rasterio mask on a GeoTIFF and I can't seem to get the GeoJSON to load properly. I get this error: File "/Users/user/example.py", line 18, in clip ...
4
votes
1answer
1k views

How to turn off geojson layers in Leaflet when the site starts?

I have a problem with my geojson layers. When I lunch my site they are all switched on, but I don't want to. Is there any solution to have lunched only one layer when my site starts, not the all one? ...
4
votes
2answers
1k views

GeoJSON/GeoCouch questions from a newb [duplicate]

I am new to JSON and GeoJSON and would like to start to use this but I am a little confused about some things. Perhaps you can help me out: 1) Is there a GeoJSON validator out there? 2) Is the text ...