GTFS Shape Extraneous Data Points - ios

I am working on an iOS application which uses GTFS data. The data is provided by the local transit authority. When plotting the route overlays onto a map, I have found a number of outlying data points as seen in the image below:
Screen Shot (Imgur)
*Sorry I didn't have enough reputation to post an image
In order to make the data more managable I have filtered the shape data through the Ramer-Douglas-Peucker Algorithm to remove redundant data points.
I am unsure of how to process the data further to remove these obviously incorrect points. Could someone offer some advice on to filter out these data points?

It looks like the agency has maybe added extraneous segments from the road to each stop's location on the side of the road? You might try filtering small segments that pop out to a stop location and back.

Related

How to overlay the RTDOSE and Image data in the correct position?

I'm currently an MS student in Medical Physics and I have a great need to be able to overlay an isodose distribution from an RTDOSE file onto a CT image from a .dcm file set.
I've managed to extract the image and the dose pixel arrays myself using pydicom and dicom_numpy, but the two arrays are not the same size! So, if I overlay the two together, the dose will not be in the correct position based on what the Elekta Gamma Plan software exported it as.
I've played around with dicompyler and 3DSlicer and they obviously are able to do this even though the arrays are not the same size. However, I think I cannot export the numerical data when using these softwares.I can only scroll through and view it as an image. How can I overlay the RTDOSE to an CT image?
Thank you
for what you want it sounds like you should use Simple ITK (or equivalent - my experience is with sitk) to do the dicom handling, not pydicom.
Dicom has built in a complete system for 3D point and location specifications for all the pixel data in patient coordinates. This uses a bunch of attributes in the dicom files in the Image Plane Module set of tags. See here for a good overview.
The simple ITK library fully understands and uses the full 3D Image Plane tags to identify and locate any images in patient coordinates by default - irrespective of such things as the specific pixel spacing, slice thickness etc etc.
So - in your case - if you use SITK to open your studies, then you should be able to overlay them correctly "out of the box", because SITK will do all the work to parse the Image Plane Module tags and locate the data in patient coordinates - just like you get with 3DSlicer.
Pydicom, in contrast, doesn't itself try to use any of that information at all. It only gives you the raw pixel arrays (for images).
Note I use both pydicom and SITK. This isn't something bad about pydicom, but more a question of right tool for the job. In fact, for many (most?) things I use pydicom, but for any true 3D type work, SITK is the easier toolkit to use.

Plot user location onto line map

Ok, I've done some reading around the subject, have an idea of how I'd tackle my problem, but want to find out of this is the most efficient way, or if I'm missing something simple.
I have a line diagram of a section of railway that I'd like to plot the users location onto (the user being someone on a train moving up/down the railway).
Now, I initially went down the route of geo-referencing, but quickly realised this probably wasn't the way to go, as my image is not a real reflection of the area + I want the line diagram to be what the user sees.
OK, my though process of how I will tackle it:
I know the physical area so I could extract the coordinates along the railway, every x meters (my line diagram has a resolution of around 5m). Stick this into an array. Can anyone suggest a tool to do this?!
Allocate my line diagram a start and end, then match the image coordinates with the physical coordinates for the entire line.
Read in the users position and update where to draw the position based on the closest match in the array?
Does this sound doable, and would it give me decent results?
If you have more sophisticated answers, please do share.
It sounds reasonable in general. As the user is supposed to be on a train a simpler option may work where you just keep track of the physical distance moved and use that as a percentage distance along the line. This is a lot simpler to manage and could be backed up with some coordinate checkpoints to ensure you don't have a drifting error. I'd aim for a simpler implementation if you can.

iOS-Charts - Graph incomplete due to missing data

I am working on getting multiple line charts displaying on the same graph. The problem is, when there are missing data points, the graph doesn't fill in gaps. Is there a way for it to automatically do this?
The first and second images show the same graph, only a slightly different frame for the x-axis. Has anyone else run into this same problem? I believe the problem stems from lacking enough data points. The graph displays accurately when zoomed out, but runs into this problem when I zoom between two known data points where no data point is present. The solution I'm currently exploring is to interpret the slope between points and fabricate data points for the missing x-axis points. This process is quite extensive and seems a little impractical. Does anyone have a better solution for this?
These lines fill based on having adequate data. The standard for these charts is to be undefined where there is no Y value present. If you were to fill in more data, your graph would maintain its continuity.

Core Plot - Drawing only the points in a specific range of the graph

I have a simple scatter plot with ~500,000 points on it. Having this many points on the graph really makes my app lag, which isn't surprising. I was wondering if there was a way to only draw the points for a specific x range (like 0-100 or 500-1000). The user will only be looking at certain points of the graph (via zooming in), so it would make it much less laggy if the program only had to plot a small amount of those points.
I've tried having the graph re-draw itself, every time the user zooms in/out or moves the axis, but this actually seems to make the app run slower. Is there a solution to this issue?
You'll have to filter the data and only provide the visible points to the plot in your datasource. Use a plot space delegate to detect when the visible area changes and adjust the data as needed. The best way to do this will depend on how your app stores its data internally. You'll want to use a data structure that lets you quickly determine which points need to be plotted.
You don't want to reload all of the data every time something changes. The plots have methods to insert and remove ranges of data points while preserving the rest of the data. If you're only changing a few points at a time, this is much faster than reloading all of the data every time. The "Real-Time Plot" demo in the Plot Gallery app shows one way to use these methods.

Building density maps with large geocoded datasets?

I have a data set with over 50,000 geocoded points (lat-long). Each point has a set of data associated with it -- things like quality, status, etc.
I'd like to make a set of density maps showing the distribution of data by those metrics. For example, one map would show the density of all items with a quality of "good".
With a smaller set of points, I'd use Google Maps and custom markers. Here, however, different segments have tens of thousands of points
Are there any APIs or libraries that could help me do this?
The solution I will be going with:
Break the area to be mapped into a
grid.
Count the number of entries
falling inside each square.
For each
square, generate a PNG with
transparency relative to the number
of entries.
Populate a Google Map with
this set of PNGs as markers.
Google Fusion Table does a nice job at it http://www.google.com/fusiontables/Home/
Good for you that your data are already geocoded, because -from my recent experience-, Google location resolver does not let you dealing with ambiguous location..
One solution could be to create bitmaps with your density maps and add them (only one at the same time) as overlay on your google map (with GGroundOverlay)
You may have a look at this post that gives an example of density map with google map. It uses the HeatMapAPI. Unfortunately, this API is not free if you use it with a large number of points...
Put build your own density bitmap may be not so complicated...
One other solution is to reduce the number of markers you can use. It could be done with the MarkerClustered library. It is not exactly a density map, but... can maybe be useful.
http://heatmap.codeplex.com/

Resources