Find label of a city in OSM map - openstreetmap

I would like to know if it is possible to find label of the beginning of a village, city or town?
I mean if there is some difference in 2 points, one 100 meters before the mark and the other 100 meters after the mark so that I know which one is in the city (even though there would be inaccuracy of one "way" segment)...
I tried to find difference in tags. In some cases I found that the mark is precisely between 2 ways but in another case the mark is in the middle of a way and even though I was not able to identify change between segment out of city and in the city (tag "place" doesn't create boundary of the city in terms of these marks but rather cadastral boundary)....
Thanks for any help

Related

In Tableau Map plot multiple sites at same lat long

I have a data where at one latitude and longitude multiple shops are located.
For Example.
Latitude Longitude ShopId Type
6.24458 50.001756 101 Saloon
6.24458 50.001756 102 Groceory
6.24458 50.001756 103 Pharmacy
6.24458 50.001756 104 FishMarket
When on map I am plotting using above latitude & longitude I am getting single mark. And when I hover the mark I am getting single shop details but I want 4 marks and on each mark it should show respective shopid and Type.
I am new to Tableau and not able to figure out how to do it.
You are likely getting 4 marks displayed at the same location. So when you click on the mark you see, then you are only selecting the top mark. You can verify this by dragging over the mark to select all the marks within a selection rectangle. If you then, right click and view data, you should see all 4 marks.
Another thing that can help when you have overlapping marks, is to make the marks partially transparent and add a border around the marks. Both options are available by clicking on the Color button on the marks card to get to the advanced color settings.
If this is not the behavior you want, you have a couple of options. One easy approach is to add a little random noise to each latitude and longitude (called jitter). Adding a little jitter makes the marks visible, although the size of the jittering depends on your data and scale. Jittering is especially useful if all your points are geocoded to the same situation - say if every building with a Los Angeles address is treated as if it is located at city hall. In that case, the geocoding distorts the data to a degree that jittering is just fine.
The undocumented RANDOM() function is an easy way to add some jitter. Excel and Hyper Extracts support RANDOM() among other data source types. It returns a number between 0 and 1.
The other options involve treating your coordinates as continuous dimensions instead of measures, and then using some other visual attribute size, color etc to indicate the number of items at each location. It is often useful to combine nearby items with some sort of grid or hex bin function -- In this case, instead of adding random noise to each coordinate, you round or truncate it in someway to effectively snap points to a grid. The ROUND() and HEXBINX() HEXBINY() functions are useful here. When using this approach, be sure your packed coordinate fields are continuous dimensions and have the appropriate Latitude or Longitude geographic role.
Finally, take a look at the density mark type. It can make visual heat maps, either working with exact data points or grid packed points.

Convert st_astext result to single text columns

I need some help with postgis.
I have made a point geometry that have converted to text through st_astext.
I currently have these three columns:
object_id(uuid) komnr(int) st_astext_result(text)
2bcc1b26-0a7c-472a-9e74-9cadfefc2d44 320 POINT(687989.85 6135746.91)
I would like two columns each containing the east and north coordinate in the same syntax as it is now. Do you have any suggestions to how i may do this?
Preferred outcome would be:
east north
687989.85 6135746.91

Convert Geometry from Multipolygons to Polygons

I have a worksheet in tableau which uses shapefiles of a state at district level. But when I bring it into the view, and hover over anything, all of it gets highlighted. I found out the Geometry is set to MULTIPOLYGONS instead of POLYGONS. How can I convert multipolygons to polygons so I can hover over each district and get their details in the tooltip?
Shapefiles are normally constructed with one Multipolygon per district (at least for districts that need more than one polygon to describe the area as many do). So when you select a single district, you get all the geometry associated with the district. This is intentional and the right behaviour for highlighting districts (or whatever unit you are working with).
What is probably happening for you is that you have displayed a map but haven't put the district identifier onto the Tableau "detail" shelf. In this case the *whole" map will highlight. This has nothing to do with Multipolygons. It is a deliberate choice in Tableau to allow for the possibility of maps containing multiple hierarchical areas.
In the UK, for example, you can get shapefiles with low level census areas called LSOAs. But the data will also contain how these fit together into higher-level areas (MSOAs, local authorities, parliamentary constituencies etc.). Using the low-level shapefile with the higher-area information is possible by dragging the names of the higher-level areas into the details shelf making them the unit of analysis for the map.
If you don't drag any area name into the detail shelf, Tableau will assume the whole map is the unit for aggregation and will highlight everything.
So fix the problem by dragging the unit names or identifiers for your districts to the shelf and everything will work.

How to calculate width and lengths of street in PostgreSQL?

I am already aware that this question, more specifically, should have been directed to GIS StackExchange. I already asked the question here but sadly, got no answers or any suggestions. I used ST_ClosestPoint() to project a point to the nearest line (point on line interpolation) using this approach.
Select ST_ClosestPoint(line, pt) As closest_pt_line
From
(Select ad.geom As pt,
st.geom As line,
ST_Distance(ad.geom, st.geom) As d
From ad, st
Where ST_DWithin(st.geom, ad.geom, 10.0)
Order By d
) As foo;
Based on this projected point, I need to calculate the length of street in both directions and width of street by making using of building polygons layer. The scenario can be visualized like this:
Visualization of the scenario
I am aware of ST_Length function but it returns the length of whole linestring rather than length 1 and length 2. Any advice to calculate lengths of street and width would be highly appreciated?

Place a marker in each country with mapbox

I am using Mapbox to build a multiple choropleth map.
Something along the lines of this example, https://www.mapbox.com/mapbox.js/example/v1.0.0/choropleth-joined-data-multiple-variables/
I am using countries instead of US states however.
I've got the map working and I can switch between layers
I have an extra requirement however to add a marker in each country that displays how many projects are active in that country.
I found out how I can add custom markers to the map with this example, https://www.mapbox.com/mapbox.js/example/v1.0.0/divicon/
The problem is I need to put a marker in the center of each country.
Does anybody know a way to put a marker in the middle of each country?
I tried to use the natural earth admin 0 label points data but that has multiple points per country. It looked like the 'scalerank=0' points were the middle of the countries but if I filter on these points, I still get multiple points for some countries (russia has 4 for instance, but Belgium has 4 as well).
If you plot all scalerank 0 points on a map you get the following result:
https://a.tiles.mapbox.com/v4/persyval.jg5p7gm7/page.html?access_token=pk.eyJ1IjoicGVyc3l2YWwiLCJhIjoiX3lrSTNYYyJ9.6Ps4OlBCYmlkxQksKsGb7A#6/45.159/12.206
Does anybody know about a dataset that has one point per country or another way to put a marker in the center of each country with mapbox?
It seems it's hard to find a list of country points for the placing of markers.
So I took the mentioned admin labal 0 points and tried to sanitize it to have only one appropiate marker per country.
The result can be downloaded here in GEOJSON format:
https://drive.google.com/file/d/0B6IQhfb-UYeUYk1mcUZaMmV0S1U/edit?usp=sharing
If you want to have a visual representation of the points take a look at this map:
https://a.tiles.mapbox.com/v4/persyval.jgk4767c/page.html?access_token=pk.eyJ1IjoicGVyc3l2YWwiLCJhIjoiX3lrSTNYYyJ9.6Ps4OlBCYmlkxQksKsGb7A#4/36.49/34.32
I needed this points for a proof of concept project so I haven't checked all markers meticulously, I also haven't taken account some of the more political sensitive country borders.
If you have a project in which this is of importance please check the file before using, but the points in this file can be easily edited to your own preferences.