I'm working on a javascript project to navigate pedestrians. I use openstreetmap to give me the needed map information. I'm using ajax-requests with overpass-api to get the streets and footways (separately).
What I want to find are intersections of streets and footways, that aren't marked as such. They could only overlap each other.
Is there an efficent Query to achieve this goal?
In principle, I do second scai's anwser: it's mostly better using already existing qa tools. But if you really want to go fancy with overpass, you can also get something like that with this somewhat complex (and probably not so über-efficient) query:
http://overpass-turbo.eu/s/1mk
Finding such errors via JavaScript would be very inefficient. What are you trying to achieve?
There are lots of quality assurance tools for OSM, some of them look for such missing intersections. One example is Keep Right. KeepRight offers a GPX export which you could use in your JavaScript application.
Related
Alright so I've been working on a custom version of leaflet and is currently pretty advanced compared to it's stock counterpart. The problem with it is however that some core functionality isn't required in most custom versions of Leaflet. My problem here is, is it possible to add a search algorithm to the layer control to search for specific layers.
I've tried several plugins that don't immediately search for layers and tried to rewrite them so it works for layers. I've also got the plugin that groups all layers in an expandable group. I'm not the best at google searches but I can't find an answer to this problem anywhere.
Since it's part of police software I can't write any code here without permission, due to the dutch laws (even if it doesn't contain crucial code).
I hope someone can help me with this issue, since it's a huge part of this piece of software. I'll have over 200 layers. They might already be grouped but searching is way nicer and faster in some occasions.
Just post some examples or links below that might work. Thanks for helping in advance!
In your place, I would add all layers to layers-control and leave only the most important ones visible on the map.
I would also add input to the layer-control and searchable in the DOM. I would probably approach this problem in this way.
I'd like to achieve something similar to this diagram using d3:
https://gojs.net/latest/samples/records.html
I was trying to look it up on the web but I hardly found any resources to get started with.
I'm quite new to d3 so I don't know how to approach this task, any help or guidance would be appreciated!
This is another one of those questions where people need to implement a sophisticated diagram visualization and they think just because D3 is a lot about visualization, it will be a good fit.
IMHO it is not.
D3 could be a part of the solution, but it certainly cannot be the solution alone: It's almost like asking whether JavaScript can be used to create this kind of diagram. Of course it can! D3 is just a very thin (but very useful) layer on top of the DOM+JavaScript, that can help you with crunching numbers, work with colors, coordinate systems, create DOM elements, and simplifies working with the DOM. Think of it as jquery for DOM and data plus a lot of very nice demos. But the value very often is in the demos, rather than in D3 itself: You need to implement a lot of things to get from a simple mapping from data to dom elements to a sophisticated diagram visualization like the one you are referring to.
If you don't want to implement and maintain most of the low-level diagram logic yourself, you should rather be looking at a diagramming solution, rather than a tool that will help you create SVG elements elegantly with less code.
Look at this question to see a list of graph and diagram visualization software. Agreed, D3 is also on this list (for the same reason you are asking this question), but there are also far more capable tools on that list that you should be looking at, my recommendation being either the one that you've found already or preferrably this one if your requirements are more sophisticated.
I'm using Leaflet library in my ReactJS app and I wonder if there is a simple way to recognize if object clicked by user is a building.
Idea that came up to my mind is to check map colour under clicked position.
Does it make sense?
I appreciate your help.
Colleagues in comments advised to give some use-case:
App I'm working on is meant to mark antique buildings with elevation in bad shape so city architecture management had simpler job of searching for them.
Every user of this App can mark such building. To prevent hooligans from corrupting data with senseless points on map I wanted to validate as a first step if clicked point is a building.
I hope it will clarify problem a little bit.
I wonder if there is a simple way to recognize if object clicked by user is a building.
No.
You basically want to run arbitrary point-in-polygon queries against OSM's building dataset, and I will presume that you don't want to host that dataset yourself.
The simplest way to do this is to perform queries to an Overpass API server, passing a is_in query and filtering by the building tag key. The OSM website's query feature functionality uses such a technique.
With this technique you won't have to worry about hosting the data, just about creating the right Overpass API query. Please bear in mind that the Overpass API servers are run by volunteers and their resources are limited.
The second simplest way would be to download a OSM extract of you area of interest, and run the point-in-polygon queries yourself, by whatever means you like (PostGIS' ST_Intersect, turf.js, etc etc).
If you will be using Leaflet, another approach would be to use vector tiles, and set it up in such a way that the buildings thematic layer is interactive. This will require you to be aware of the limitations of the vector tile servers.
Idea that came up to my mind is to check map colour under clicked position.
That is unreliable. Think about labels on top of buildings, or the colour of the edge of the building area, or buildings that don't render with the standard colour (e.g. places of worship, monuments).
I've read through the documentation of PDFMake, and PDFKit, and WPS: PostScript for the Web but haven't been able to find any reference to anything other than background layers, from looking at various documentation, it sounds like Optional Content Groups are what I need, but how to handle them using Javascript, I've no idea (I've found little about OCG and layers generally, which isn't sounding promising)!
Any suggestions would be greatly appreciated!
Having tried a few libraries, PDFKit appears to be the best bet, it doesn't discuss layers, but each object you add does exist as a layer, and placing items on top of each other will layer them.
I am planning on making an analytics dashboard and would like to implement circular charts like the image attached to this question:
and I would like to do it using jQuery. Do you guys have any usefull links to resources or to other SO questions? Would be awesome!
Thanks!
You can also take a look at :
http://bernii.github.com/gauge.js/
http://www.justgage.com/
Both of them look really good and seems pretty easy to use.
The easiest way would probably be to create an SVG that mimics the appearance you want, and then use JavaScript/jQuery to modify the source of the SVG. The design you're requesting could probably be acheived by simply placing two arcs on top of one another.
Deriving from this excellent answer on calculating arcs, creating two overlapping ones could look something like this, which also demonstrates updating the arc dynamically.
lethargicpanda's suggestions are cool. Check out jQuery Knob too. It also allows user input.