How to load geo-localised informations based on map configuration and interaction - sql

I'm currently creating a new website based on geo-localised information to display on a map. I've never done this kind of development before, and my researches don't lead me to a decent result.
What I want to do is load a few POI on the map, say 15 by 15 until all POI are loaded on the map (This is to show the user that data is loading progressively).
I know how to load said POI 15 by 15 based on their update date in a scrollable list (Using limit and offset, but this implies that we have the same reference as a starting point), and now I want the same kind of behaviour, but based on their location instead of the timestamp.
What I'd like to do is trigger the update based on the center of the map when it moves, so that it starts loading POI in the displayed area, but without reloading what was already loaded.
I can't figure out how to do that.
Say the user moves the map to the side, but keeps some POI on the map, it should reload from the center to the edge of the map without re-adding the POI.
Also, when the user zooms out, it should load around the already present POI, as the center was already loaded on previous zoom.
The only think I was able to find and understand is how to sort POI based on a distance, with the Haversine formula from here:
http://www.plumislandmedia.net/mysql/haversine-mysql-nearest-loc/
But it doesn't cover the part where you interact with the map and need to load new data to add it to what's already there.
I'm using Leaflet to show information on the map and listen to events.
Any guidance welcome.

Related

How to create a list which sorts its self like games with the animation

I am creating a game in flutter in which I want to create my leader board page in which I want to achieve the list like Reorderable widget but in that we drag the tile manually but I need to get it automate ,it should elevate and lower another tiles same animation like Reorderable list but it should be automated
I hope I will find some solution with large community
You can take a look at the AnimatedList in Flutter: https://api.flutter.dev/flutter/widgets/AnimatedList-class.html
When a new value is inserted (or removed), it is automatically animated (and you can of course customize this animation to suit your needs).
I'm not sure how you would handle moving an item from one place to the next in the list, though.
Update
I found this other SO thread which mentions the great_list_view package, in which you can just update your underlying list (with the new score, or sort it again) and it will automatically animate it for you. That sounds like a good option, and the package has recently been updated and has a decent amount of likes on pub.
https://pub.dev/packages/great_list_view

Acquire a series of STEM images via the method of event listener

Recently I am trying to attach an event listener to a live display so as to acquire a series of images automatically and the even map used is "data_value_changed". In TEM mode everything is fine and the 3D stack can be properly obtained. Unfortunately, while applying this to a live STEM image from the DigiScan, the script failed completely. Later on I just realized that in such a mode, the image is updated pixel by pixel with the scanning rather than frame by frame. Another event map "data_changed" was further tested but still ended up with failure.
With DM2.0 or later version, it seems to be much easier to acquire a series of customerized STEM images, since the DigiScan controlling can be conveniently accessable via scripting. Unfortunately, our microscope is quite old and only with DM 1.5 installed.
Is there any event map sepcific to this purpose or the approach of event handler is not suitable at all?
Thanks in advance
The data changed event handler is suitable, but there is no event for a particular frame/complete event.
Instead, your event-handling code needs to be creative and deal with the situation that you get more events than you want. You are really only interested in the event which (also) change the last pixel in an image (as the frame is sequentially filled), but you do get events whenever sub-parts of the image change.
So you need to "filter" those events out - as quickly and CPU-conservative as possible.
The easiest way is to gather the last pixel's value at each event and compare it to a stored value. If the value changed, then this pixel was changed, indicating the frame is "complete" and you want to use the event. Otherwise, just return without further action.
There is a very slim chance ( - for scanned images - ) that a "new" frame has the numerically identical value than the frame before, so this in most cases is all yoou need to do.
If this isn't enough for you, you may look at longer - but also more CPU cycles consuming - checks like each time computing a Boolean change map betwee "now" and "buffered" and keeping track of the "last" change. Then, if there is a "jump over" to an earlier index, you know that your "buffered" last image actually wa a full frame.
(Note, that you will always see the data update once at the end of frame. Hence this will work.)
There is an example of this type of script in this answer here. If this isn't working for you, please comment or rephrase your question for more details on where you run into issues.

generate geo tiles from vector data

i am facing this problem : I have in my database some vector data (polylines ...) which describe many world/country/region/cities boundaries.
I would like to have an interactive map on thoses areas.
When i render those data in the browser (data are sent in geojson) this is slow (i'am not surprised).
The next reason, is to generate some raster tiles to represent the areas at different zoom level and to have a way to make the relation between a click on a area and the area selected (to display more info).
I am a newbie in geo tiles :
What is the best tool to generate png/jpg tiles from vector data?
How to make relation between an area clicked and a "id" in database?
I know my questions are very large, but if you have some advices ...
Thanks!
I recently wrote a blog posting on how to improve the rendering speed of raster tiles:
http://blog.webfoot.com/2013/03/12/optimizing-map-tile-generation/
As for connecting a click to a jurisdiction ID, I don't think there is a shortcut: you need to translate the click into lat/lng (or Vast Coordinate System, as I describe in the blog post) and then do a point-in-polygon check. If you are using PostGIS, then you can do an ST_Intersects.
NOTE: if you are using MySQL, the intersection is done with bounding boxes, not the polygons. It still is possible: you just need to grab a point-in-polygon function from somewhere to check which polygon if a bounding-box check gets you more than one.
Here is an example of dots you can click on:
http://maps.webfoot.com/demos/CanadianStimulus/CanadianStimulus.html
Note that because people aren't precise with clicking (especially with tiny dots), I actually make a few pixels around the dots "live" as well as the single-pixel dots. You can also click away from the dot, and then it will show the polygon (which in this example's case, is the federal electoral district).
There is a MongoDB Plugin datasource for Geoserver, a full featured WebGIS Server. You can use it to build up a map rendering service (a WMS actually) ofyour data. Then use Geowebcache to generate tiles of your map.
This way you can use fully featured WebGIS stack, which allows you to manage additional datasources, and easy tile subset recreation if portions of your data get updated.
Also querying features on a map (relation map position to element in database) is provided through Geoservers WFS implementation.

Displaying Webpages From RSS Feed in iOS Xcode

Currently, I have an RSS Feed Reader in a UITableView within a Navigation Control. I would like to click on the links and Open up a formatted page (containing all of the information from the website formatted for the iOS screen). I'm not sure if I should do this using the RSS data and a UITextView? I'm currently attempting to use UITextView in hopes that I can separate the information (title, author, body) without anything looking promising. I want to be able to move around the data and format it to my liking in the actual application itself. I read around and noted that you can include HTML and custom CSS. Would this be the way to go? I'm not quite sure how to tackle this. I want the page that opens up to be entirely scrollable (Like the IGN application or Slashgear application). Many apps for websites utilize this (and I am a bit new to this). How do they go about this? I also want to note, at some point I will like to cache the data so it may load what is already loaded without being connected to the internet. Does anyone have any ideas?
Edit:
Ok, I believe I found the correct path to go down from playing around and a lot of googling (nothing directly says what a decent way of doing this is). My particular way as of now is the route of a UIScrollView in general. Now the part I don't understand is how to divide up the long text into 'pages' for scrolling (and I am using the paging feature. This situation has led me into this question: How To Separate Strings For UIScrollView/UITextView based on the size of the frame
Ok, I believe I found the correct path to go down from playing around and a lot of googling (nothing directly says what a decent way of doing this is). My particular way as of now is the route of a UIScrollView in general. Now the part I don't understand is how to divide up the long text into 'pages' for scrolling (and I am using the paging feature. This situation has led me into this question: How To Separate Strings For UIScrollView/UITextView based on the size of the frame

ListView bound to storage files with grouping capabilities in WinJS

I would like to replicate the song view of the Music app, in my Windows 8 Metro app using WinJS.
I'm using a StorageDataSource to load files from the music library in a list view. This works well, now I'd like to group music files by some property (ex.: album).
StorageDataSource does not support grouping, so I'm looking for tips on how to go at this. It has to be efficient as the user can have many items in the library, but I don't need it to auto-update when new files are added/removed (though it would be nice).
My current understanding is that I need to build 2 custom data sources:
One or the itemDataSource of the ListView, and is a wrapper around StorageDataSource. Ex.: the getItemsFromIndex implementation queries the underlying dataSource for its items that it wraps in a literal. I can't just set the StorageDataSource as its objects are immutable.
One for the groupDataSource of the listView. I build it manually once when the app loads, by iterating over my first StorageDataSource and determining how many groups I have, and where each one starts in terms of itemDataSource indexes.
It works, but I wonder if there's a better way. It also seems impossible to have groups in a ListLayout and it forces items to be displayed horizontally.
Does anyone have tips for the high level view of what's required here? Thanks.
First, you are correct that if you are using a list layout that grouping isn't supported; its only supported in the Grid layout. You could choose to insert fake data items for the groups that you could style as you needed using a custom item template rendering function.
The rest of your stuff will require some learning I suggest you take a look at the ListView samples to really understand the ins and outs of the data source API.
One option is to let the ListView calculate them for you by supplying the computerDataSourceGroups function:
http://msdn.microsoft.com/en-us/library/windows/apps/hh700578.aspx
The other option is that the StorageDataSource source is right the for you to look at; adding grouping to this as a raw datasource may in fact be your most efficient and maintainable solution. It will hopefully allow you to continue to leverage the virtualization of the listview without causing the data source to de virtualized. You should find the source in the references node in VS, in ui.js.