You can turn your polyline shapefile into a route using Create Routes in the Linear Referencing Toolbox. Then use the tool, Locate Features Along Routes, also in the Linear Referencing toolbox, to find the distance to the nearest routed polyline and it's nearest perpendicular location along the route. I always use ArcMap's Search button or key Ctrl+F while in your mxd and just type in whatever tool you're looking for.
You'll need to set a large enough search radius so that all your points are captured when using Locate Features Along Routes (and search radius only works for locating points.)
The MEAS field will be the point's perpendicular location along the route in whatever map units your mxd is set in (feet, meters, etc.), and the Distance field, what you're interested in, will contain the nearest distance from the route. A negative (-) number is west of the route, and a positive number is east of the route.
With a bit of text processing (maybe in Excel), you can bring your data into this form:
Duration;user;wkt
298;Casual;LINESTRING(-77.0444 38.9101,-77.03818 38.91554)
which can be interpreted by QGIS as well known text (WKT) using Add delimited text layer
.
Note that you need blanks and comma as delimiters for lon&lat values and linestring members, and lon values have to be first. In the dialogue, only check semicolon as column delimiter.
Applying EPSG:4326
as CRS , you end up at New Hampshire Avenue Nordwest in Washington DC.
EDIT
this one works from your second example:
seconds-total;Subscription-Type;gis-data
298;Casual;LINESTRING(-77.0444 38.9101,-77.03818 38.91554)
27926;Casual;LINESTRING(-77.0444 38.9101,-77.03818 38.91554)
214;Casual;LINESTRING(-77.0511 38.8573,-77.051516 38.848441)
960;Subscriber;LINESTRING(-77.024649 38.936043,-77.012289 38.915417)
378;Subscriber;LINESTRING(-77.04062 38.917761,-77.0471 38.9054)
2085;Subscriber;LINESTRING(-77.041606 38.904742,-76.9862 38.8803)
441;Subscriber;LINESTRING(-77.094875 38.88786,-77.10108 38.884616)
456;Subscriber;LINESTRING(-77.023086 38.8997,-77.022155 38.912719)
Best Answer
The simplest way is to use the points to create the line. To do this in QGIS use the Points2One plugin. Install this plugin (available via
Plugins > Manage and install plugins
) and follow the dialog to create a line from your points.If you have multiple lines, then make sure your points data has a suitable ID field to identify the lines they belong to.
Alternatively you can use
v.build.polylines
in GRASS (available through QGIS) or the SAGA GIS toolConvert points to line(s)
Available through the Processing Toolbox (Ctrl+Shift+T).