Questions tagged [geojson]

GeoJSON is an open format, based on JSON, for encoding geographic data.

GeoJSON is a geospatial data interchange format based on JSON. It defines the following geometries:

  • Position
  • Point
  • MultiPoint
  • LineString
  • MultiLineString
  • Polygon
  • MultiPolygon
  • GeometryCollection.

Example of a GeoJSON Point:

{ 
    "type": "Point",
    "coordinates": [0.0, 0.0]
}

Resources :

4307 questions
12
votes
1 answer

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

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,…
Van Coding
  • 24,244
  • 24
  • 88
  • 132
12
votes
5 answers

Creating a GeoJson in php from MySql to use with MapBox javascript API

What I'm trying to do is very simple; get marker's data from a Mysql table with my PHP code, convert that that to a geoJson ( used by MapBox ), send that geoJson to javascript and then populate those marker into my map. I've been reading very…
Marcelo Grebois
  • 383
  • 1
  • 4
  • 14
11
votes
1 answer

Using getBounds on geoJSON feature

I've tried map.fitBounds(geojsonFeature.getBounds()); and I get this error: geojsonFeature.getBounds() is not a function. Here is the code: http://jsfiddle.net/0aqxktov/ What is going wrong here? Thanks in advance.
Mike Johnson Jr
  • 776
  • 1
  • 13
  • 32
11
votes
2 answers

How do I get the area of a GeoJSON polygon with Python

I have the GeoJSON { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": {}, "geometry": { "type": "Polygon", "coordinates": [ [[13.65374516425911, 52.38533382814119],…
Martin Thoma
  • 124,992
  • 159
  • 614
  • 958
11
votes
1 answer

Creating Infowindows on features loaded via loadGeoJson()

I apologize if this is basic, but I have very limited javascript knowledge. I'm making a map that loads GeoJSON data that I created in ArcGIS reformatted to GeoJSON using ogr2ogr. I've got the map loading and showing the point markers from my…
TampaCraig
  • 141
  • 1
  • 1
  • 8
11
votes
2 answers

Google maps GeoJSON- toggle marker layers?

I have some GeoJSON returned from a call to a PostGIS database. I'd like to be able to add a marker for each feature, and be able to toggle different types of marker/feature. Currently I'm using JavaScript to generate a marker for each feature,…
user814425
  • 605
  • 8
  • 19
11
votes
2 answers

Mongodb find query with $near and coordinates not working

I'm trying to make use of some geolocation functionality in mongodb. Using a find query with $near doesn't seem to work! I currently have this object in my database: { "Username": "Deano", "_id": { "$oid": "533f0b722ad3a8d39b6213c3" …
DeaIss
  • 2,525
  • 7
  • 27
  • 37
11
votes
5 answers

Uncaught InvalidValueError: not a Feature or FeatureCollection

After seeing a recent video by the Google Devs I decided to do a regional map of the UK. There were a couple of possibilities mentioned on this site that I've since had to dismiss* So I ended up using this site (example page of data downloads):…
RustyFluff
  • 720
  • 2
  • 8
  • 27
11
votes
2 answers

topojson.object in topojson V1

I am having a lot of fun playing with topojson, but it looks like topojson.object is undefined in V1 of topojson, where it was supported in V0. Can someone explain how I might work around this issue? I am trying to draw distinct path elements for…
Mark Roper
  • 1,389
  • 1
  • 16
  • 27
11
votes
1 answer

Converting Polylines to GeoJSON

I have a series of (encoded, or decoded) polylines captured from a service like Google Maps / Open Street Maps. For example: var polylines =…
slifty
  • 13,062
  • 13
  • 71
  • 109
10
votes
1 answer

fastapi: mapping sqlalchemy database model to pydantic geojson feature

I just started playing with FastAPI, SQLAlchemy, Pydantic and I'm trying to build a simple API endpoint to return the rows in a postgis table as a geojson feature collection. This is my sqlalchemy model: class Poi(Base): __tablename__ = 'poi' …
dlqmap
  • 101
  • 3
10
votes
6 answers

Reformat SQLGeography polygons to JSON

I am building a web service that serves geographic boundary data in JSON format. The geographic data is stored in an SQL Server 2008 R2 database using the geography type in a table. I use [ColumnName].ToString() method to return the polygon data as…
James
  • 917
  • 3
  • 9
  • 25
10
votes
2 answers

Python Script to Convert CSV to GeoJSON

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", …
user5834454
  • 147
  • 2
  • 3
  • 12
10
votes
5 answers

Jackson deserialize GeoJson Point in Spring Boot

I have a @Entity model that has a property of type com.vividsolutions.jts.geom.Point. When I try to render this model in a @RestController I get a recursion exception. (StackOverflowError); nested exception is…
Tom
  • 3,807
  • 4
  • 33
  • 58
10
votes
1 answer

How to convert from PostgreSQL to GeoJSON format?

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…
Alex
  • 315
  • 2
  • 5
  • 14