Hot answers tagged

5 votes

Import GeoJSON into PostGIS

./ogr2ogr -f "PostgreSQL" PG:"dbname=theDatabaseName user=postgres" "/Users/dev/Downloads/theGeometry.json" -where "name not like 'Whatever%'" -nln theFeatureName -overwrite ogr2ogr displays a list ...
acmeincorporated's user avatar
4 votes

MongoDB - fast & accurate k-NN

It's tricky to tell what might be slowing things down. But I have a few suspicions from looking at the code. Mongodb may well be serving from RAM if the records fit into memory. Or it may have cached ...
Steven Kay's user avatar
  • 20.3k
4 votes
Accepted

How to check if GeoJSON feature is in rectangular shape and find corner points?

You could sum up angles. If you want to stick to Turf.js, try function isRectangle(turfInputPolygon, threshold) { var threshold = threshold || 2; var turfPolygon = turfInputPolygon; if (turf....
geozelot's user avatar
  • 29.9k
4 votes
Accepted

MongoDB Error Code 16755 - Can't extract geo keys for duplicate vertices and edge crossing

I hit a similar problem. I just needed to find the valid records in my dataset (I discarded the records with Duplicate Vertices). I renamed the collection - db.myCollection.renameCollection('...
Aidan Ewen's user avatar
3 votes
Accepted

Load a GeoJSON layer with mixed geometries via QGIS's Python module

You should specify the geometry type in uri: vlayer = QgsVectorLayer('C:\Users\Public\data_3.json|geometrytype=LineString',"mygeojson","ogr") geometrytype can be "Point", "LineString" or "Polygon"
Enrico Ferreguti's user avatar
3 votes
Accepted

Problem adding GeoJSON to MongoDB: Loop shares more than one vertex with its parent loop

It should be possible to make your GeoJSON file valid with ogr2ogr http://www.gdal.org/ogr2ogr.html by using OGR SQLite dialect http://www.gdal.org/ogr_sql_sqlite.html which supports all the ...
user30184's user avatar
  • 64.6k
2 votes
Accepted

How can I detect if my linestring is near an OSM node?

Ok, I will assume you have a list of nodes as a list containing Shapely Points reperesenting your nodes from shapely.geometry import Point, LineString nodes = [Point(1, 1), Point(0, 1)] and your ...
atlefren's user avatar
  • 4,307
1 vote

"'location object expected, location array not in correct format" error while trying insert polygon into MongoDB

MongoDB expects a well-formatted GeoJSON geometry as per RFC 7946 - not sure if your attempted format is a legacy one of some sort? Example on Humongous MongoDB Playground
geozelot's user avatar
  • 29.9k
1 vote
Accepted

Convert shapefile to JSON by using node js

https://github.com/mmomtchev/node-gdal-async (disclaimer: I am its author) const gdal = require('gdal-async'); const ds = gdal.open('shape.shp'); for (const layer of ds.layers) { for (const feature ...
Criminal_Affair_At_SO's user avatar
1 vote

GeoServer Docker - Data loss

I suspect you are storing your GeoServer data directory on the docker instance where the disk is not persisted over restarts.
Ian Turton's user avatar
  • 81.1k
1 vote

Find neighboring polygons in MongoDB

By looking at the MongoDB documentation about $geoIntersects it seems the case of finding a polygon that shares the same edge isn't guaranteed by this operator: $geoIntersects does not guarantee that ...
S. Iakovlev's user avatar
1 vote
Accepted

Can I store both a Point and a Polygon in GeoJSON format for a single feature?

You can use a GeometryCollection as stated in the specs e.g https://www.rfc-editor.org/rfc/rfc7946#section-3.1.8 You can find in the same spec in the appendix an example e.g https://www.rfc-editor.org/...
ThomasG77's user avatar
  • 30.5k
1 vote

Points within Polygons given certain conditions

For closure: I got 90% of the way there with method #1, first finding all polygons that satisfied my filter, and then using shapely to recreate them into objects and use GeoPandas to dissolve into ...
Vladimir Bogdashkin's user avatar
1 vote

Query to intersect polygons in PostGIS with points in MongoDB

It sounds like a foreign data wrapper may work, but I'm not familiar with MongoDB to know preciselythe best approach. I assume you can make an ODBC connection to the MongoDB with little problem. I've ...
Nate Wanner's user avatar
  • 1,591
1 vote
Accepted

What algorithm is used by the $geowithin operator of Mongodb

If you mean a point-in-polygon intersection test, it appears to use the raycasting method. The source of MongoDB is available here on GitHub - look for Polygon::contains . Wikipedia has a good ...
Steven Kay's user avatar
  • 20.3k
1 vote

Adding data from Mongo to GeoServer?

You can (as Daniel suggests) add the MongoDB extension to GeoServer which will allow you to view the data as a WMS or WMTS (tiles) in your OpenLayers app. You could also look at using the WFS-T ...
Ian Turton's user avatar
  • 81.1k
1 vote

How connect GeoServer to existing Mongo database?

So, I answer for my question. I should create geometry index like here here db.collection.createIndex( { <location field> : "2dsphere" } )
GRM's user avatar
  • 105
1 vote
Accepted

How to find inner points near to corner of rectangular GeoJSON feature?

So, to continue my answer in the linked question (thus, sticking to Turf.js as you suggested), one simple solution would be to scale down each polygon by, say, 10% and use those corner points. Add ...
geozelot's user avatar
  • 29.9k
1 vote

Inserting GeoJson Polygon Coordinates with MongoDB and C#?

Found the answer. As I suspected it was simple enough. Need to use GeoJson.Polygon<TCoordinates> Method (GeoJsonObjectArgs<TCoordinates>, GeoJsonPolygonCoordinates<TCoordinates>) ...
Max's user avatar
  • 21
1 vote

mongo geoIntersects with Spring Data

Was stuck on this too for a bit, this is my solution: Example domain model: public class Foo{ @GeoSpatialIndexed(type=GeoSpatialIndexType.GEO_2DSPHERE) GeoJsonMultiPolygon polygons; ...
Jeryl Cook's user avatar
1 vote

Implementation of Esri ArcGIS Plugin Data Source using Monogdb

You need implement interface IPlugInCreateWorkspace in class MongoDBWorkspacePluginFactory . Here you can see a sample https://github.com/nicogis/MongoDBPlugIn/blob/...
nicogis's user avatar
  • 586
1 vote
Accepted

Error when creating spatial index in MongoDB

I tried to approach this from as many angles as possible, and I finally found something that worked. Instead of converting the .shp to .geojson using ogr2ogr, I loaded the .shp into QGIS and then ...
haff's user avatar
  • 666
1 vote

Error when creating spatial index in MongoDB

I didn't work through the issue with your data but my perspective is that the error comes down to a limitation of shapefile format. Topological consistency is not enforced/inherent in the shapefile ...
Kent Stanton's user avatar
1 vote
Accepted

GeoJson structure

I am going to try to substitute some terms because you are using a similar word to describe two distinct ideas. Let me know if this is wrong. What I propose is going to be closest to you #2 solution:...
RomaH's user avatar
  • 2,745
1 vote

How can I clean/fix polygons in a Node.js application?

You may want to give Mapshaper a try. It allows you to snap vertices when you load a file. And if that doesn't fix everything, you can try repairing it once it's loaded. You can also find a web-based ...
mgalka's user avatar
  • 523
1 vote

Mongodb data store parameter on Opengeo Suite 4.1.1

I encountered the same problem. The error was the result of a malformed uri at the schema_store. Please, note the third slash in the example. schema_store * : file:///path/to/store Alternatively, I ...
Stef Verdonk's user avatar
1 vote

Importing OSM Data into MongoDB?

This can be done using the mongosm importer. Download the osm file: http://download.geofabrik.de/europe/germany/baden-wuerttemberg/karlsruhe-regbez-latest.osm.bz2. Extract the file. Try f.ex. 7zip, ...
serv-inc's user avatar
  • 113
1 vote

How to publish the layer from MongoDB store in GeoServer?

you can use Mongodb Plugin(gt-mongodb) that exists in GeoTools 17 http://docs.geotools.org/latest/userguide/library/data/mongodb.html
Samih haddad's user avatar
1 vote

Getting MongoDB working with GeoServer 2

To install geoserver plugins, make sure you put them to the lib of WEB-INF (e.g. webapps/geoserver/WEB-INF/lib ) not the lib in geoserver (i.e. /usr/share/geoserver/lib).
Harry's user avatar
  • 233

Only top scored, non community-wiki answers of a minimum length are eligible