Querying database using geographical areas/points - gis

I'm new to the concept of GIS in databases and am looking for a solution that allows me to do the following:
- store polygon areas in a record field
- Store geographical points. These points will contain latitude and longitude coordinates (GPS).
- query database for all records, whose polygons intersect with a given point.
- query database for all records, whose points intersect with a given area
Any recommendations?
thanks,
Fbr

PostGreSQL with the PostGIS extension. Free open source, very mature.
SQL Server 2008 has built-in Spatial Extensions. Even in the free Express Edition.
Oracle
MySQL 5.6.1 or later has built-in spatial extensions.
More information here on different spatial databases and here on learning about spatial databases

Related

GEO Server: Can I connect GEO Server with any geo Spatial database by adding data store?

I want to connect GEO Spatial Database with GEO Server.
GEO Server is not provide out of the box facility for the same. But i want to know the possibility to connect GEO Server with other GEO Spatial database by adding new data store through GEO Tool.
I have seen one answer here stating this can be possible to develop one mimicking the existing stores for existing spatial databases

Best way to store GPS latitude and longitude with nodejs and database

I would like to know what is the best way to store information about the GPS position of the device in real time using NodeJS and some database server.
Example:
Currently there are 5,000 devices connected to the server, each of these devices is sending information about their GPS position with a maximum timeout of 1 seconds.
Approximately per minute the NodeJS server will be receiving 300,000 PUT requests.
Too much request, I know it.
Another important factor to take into consideration is that the database server is technically another server or instance.
By the way, I plan to use Amazon AWS or Microsoft Azure as a cloud server provider.
So my question is, what is the most efficient way to store this information on realtime?
Among my options are MySQL, MongoDB, PostgreSQL, etc.
They could explain why it is better to use the option you recommend.
Thank you!
i would say - MongoDB.
why i would say that -
MongoDB offers a number of indexes and query mechanisms to handle geospatial information. You can easily Store your location data as GeoJSON objects with this coordinate-axis order: longitude, latitude.
MongoDB also recently included support for additional GeoJSON types: MultiPoint, MultiLineString, MultiPolygon, GeometryCollection.
MongoDB also offers a vast set of query operators that allows you to easily query over the geospatial data such as:
$geoWithin
$geoIntersects
$near
a typical example would be
{
location: {
type: "Point",
coordinates: [40.7829, 73.9654]
},
name: "Central Park, New York City"
}
You can go over a wide range of examples at https://docs.mongodb.com/v3.2/tutorial/geospatial-tutorial/
Lastly, MongoDB let you build a 2D indexes on the geospatial data. looking at the usage you mentioned. it should come handy.
As already say MongoDB has exactly all the needed in one place.
For the Index side, you can also consider "Partial Index" in order to exclude document that you don't need anymore (take in consideration all the Document less then 12 months only, for example): https://docs.mongodb.com/v3.2/core/index-partial/
For the Cloud side, i strong suggest you MongoDB ATLAS.
https://www.mongodb.com/cloud/atlas/pricing

Does MySQL have inbuilt feature for Geo location based queries?

Does MySQL have inbuilt feature for Geo location based queries?
I have found this one Spatial extension http://dev.mysql.com/doc/refman/5.1/en/spatial-extensions.html
How's it as compare to MongoDB GeoSpatial feature?? What's the difference in between them??
MySQL's geospatial extension implements planar, not spherical or projection, geometry in a native fashion. It is possible to use a spatial index to accelerate latitude / longitude lookup, but the spherical geometry computations need to be done in MySQL queries or stored functions provided by you, the user of the geospatial extension. Here's a writeup on that.
http://www.plumislandmedia.net/mysql/using-mysqls-geospatial-extension-location-finder/
Mongo has multiple projections supported in the geospatial projection.

What database and java library to use for Spatial Analysis?

I have been working on a web project that stores locations for users. The project uses currently MySql 5.5 and JPA 2 for mapping the relation database, together with EJB 3.1 as the middle tier. I store longitude and latitude data in Decimal data types in MySql.
I want to expand the project so the user can search for Points (GPS coordinates) near the location he/she marks out (through using Google Map API 3) on the map.
I need some hints and suggestions before starting transforming or changing components in my project. If possible with tutorial and how to achieve the changes and what tools (library, dev tools, etc.) to use. Here are my questions.
Can I use the Spatial extension in MySql (using data types like Point) and map this to entities that are supported by JPA 2 (like DataNucleus library, if they are supported by JPA 2). That are light weight and can persist them self through the persistent layer.
Is it better to move to PostGIS and Postgres (which seem to have better spatial support) with all the pain and effort needed to change database and using hibernate instead. Netbeans has Hibernate support but when trying with the JDBC for PostGis I stumble upon problems. Need a good tutorial to follow to get started if I go down this road.
Using the infrastructure that is already in-place and compute the distance from lactation A and B. Similar to the way done in this article by Jan Philip Matuschek
Excuse me for clustering the questions.
Regards Chris
MySQL's Spacial extension is usually OK if you only have point locations, but it starts to get overwhelmed if you want to find points in polygons (i.e., query by region), or use fancy indices and search algorithms. There is a really good cross comparison to help show the differences between the different spatial DBs.
I'd see that there are many more benefits to migrating to PostgreSQL and PostGIS. There are also many more GIS applications that work naively with PostGIS, such as QGIS, Geoserver, etc. The most recent version of PostGIS has a KNN nearest neighbor search operator to quickly find, for example, the nearest 25 points out of several million rows to a particular point on your map (see also here).
See the manual for JDBC and PostGIS. As for JPA, see PostGIS and JPA 2.0
As for distance calculations, see ST_Distance and ST_Distance_Spheroid.

What sort of things can be done with PostGIS that can't be done using MySQL?

I'm about to start a GIS project, and I want to know if I really need PostGIS or if MySQL's Spatial Extensions are sufficient?
PostGIS is a complete spatialdb and has been for a while. MySQL continues to only implement the Minimum Bounding Rectangle functions
http://dev.mysql.com/doc/refman/5.5/en/functions-for-testing-spatial-relations-between-geometric-objects.html
If you want to do spatial work on FOSS DB your only real choices at this point are
1) PostGIS
2) Spatialite
There are community editions of the other DBs that have spatial extensions as well that you can use.