Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am creating an app for tracking trains. When the train comes near to a railway station the system should identify it.

To do that I want to gather GPS coordinates near the station and save them. Then when trains send GPS coordinates to the system, it will compare saved coordinates and identify the station name ...

-

How to find all longitude and latitudes (all gps coordinates)within the line from start point to end point?

If line is short (like 100 m long) i want to find all gps points in that line, so that I can save them in a database ..

thats why i want collect gps points in that line

share|improve this question

closed as unclear what you're asking by Fezter, BradHards, Devdatta Tengshe, PolyGeo, Chad Cooper Apr 30 at 14:25

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

4  
As there are an infinite number of points along a line, could you please clarify what you mean? Would you like to find the coordinates of all the vertices of a line? Or do you want to find the coordinates of points at a given interval? Such as every 100 metres? –  Fezter Apr 30 at 5:43
    
yes definitely line could be 100m long how can i find it ? –  Amila Thennakoon Apr 30 at 5:45
3  
Yes what? Please clarify what you need, use the edit button below your question to update it with the new information. –  Martin Apr 30 at 5:52
    
Would you be able to edit your Quedtion to provide the clarification that @Fezter and I seek, please? Your comment has not made your Question any clearer for me. –  PolyGeo Apr 30 at 5:53
    
From what I gather, you have a line layer and you have a layer containing points that were captured using GPS. You want to get the coordinates of all the points that fall on the line layer? Due to the inaccuracies of GPS, I doubt many if any of the points will fall exactly on your line. You'll probably need to find the points within a given distance of that line. Please edit your question again and give us as many details as possible. –  Fezter Apr 30 at 6:03

2 Answers 2

As far as I understand, you will get the GPS position of a train, and you need to figure out which station it is at.

If so, you are trying to solve it in the wrong way. You shouldn't try to save the GPS locations of all potential points, and then test the equality one by one. This isn't a good idea for the following reasons:

  • Because the GPS location given by any senor has some level of error, there is very little chance that it will fall exactly on your given line.
  • Secondly, even if it falls exactly on the line, there are infinitely many points on that line.

To solve this issue, you need to do some spatial operations. You need to buffer the line to some tolerance, say 25 m, and then test if the train's location falls within this buffer polygon.

Since you will have many stations in your data, it is best if you use a spatial database to do these kinds of spatial queries.

If you are using SQL Server 2008 R2, you should have a look at the following functions:

  • STBuffer This function can be used to create a buffer around your station (line) geometry

  • STWithin This function can be used to check if the input point is within the buffered Geometry.

share|improve this answer
    
thank you Devdatta ..... thank you a lot for helping .... –  Amila Thennakoon Apr 30 at 7:01
    
could you please tell me how to do that you suggestion im not clear it ? –  Amila Thennakoon Apr 30 at 7:02
    
What server side technology will you be using? what database will you be using? all this details are needed before I can give you details. –  Devdatta Tengshe Apr 30 at 7:10
    
Im using ASP.net Data base MS SQL Server 2008 R2 [coz its support gelocation data types] –  Amila Thennakoon Apr 30 at 7:20
    
@AmilaThennakoon: Please see my edits. –  Devdatta Tengshe Apr 30 at 7:28

The Train/Rail companies do not rely on GPS. They can use up-to 3 methods:

Block Occupancy detection requires the layout to be divided into individual blocks, each one isolated from the next, and the power to the block fed throgh the detector. The detector will sense any current being drawn by a train within the block

Infra red detection relies on a sensor module that produces an infra red beam and is able to switch state when a train is above the beam and the beam is reflected back on the sensor.

Magnetic detection involves fixing magnets to the bottom of trains and these activating reed switches placed at strategic points on the track

Simplest: You need to create a method of a 25m block around a train and have to detect when it left the last block and the speed it is traveling.

See http://www.railwayblog.kevinappleby.co.uk/train-detection-and-dcc-some-armchair-musings-541/

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.