I am attempting to download and convert OpenStreetMap data of the Washington DC area using osgEarth.
I am using the openstreetmap_flat.earth example from osgEarth.
<map name="OpenStreetMap" type="projected" version="2">
<options>
<profile>spherical-mercator</profile>
<lighting>false</lighting>
<terrain engine="quadtree" range_mode="PIXEL_SIZE_ON_SCREEN" tile_pixel_size="256"/>
</options>
<image name="osm" driver="xyz">
<url>http://[abc].tile.openstreetmap.org/{z}/{x}/{y}.png</url>
<profile>spherical-mercator</profile>
<cache_policy usage="none"/>
</image>
</map>
My bounding box for the DC area is SW(-77.0518, 38.8414) NE(-76.9488, 38.9589)
I'm using osgearth_package with the following command line options to perform my download. The goal is to get 19 levels of detail of the DC area. I believe I'm entering the coordinates in as UTM but I could be miserably wrong.
osgearth_package --tms ../openstreetmap_flat.earth --out c:/osgearth/ --out-earth osm.earth --max-level 19 --verbose --bounds -8564949.622936 4698767.775034 -8587714.346282 4698703.947754
The output isn't quite right. I'm getting parts of south america, and africa. Also, while I do get higher level of detail from the DC area, it's nowhere near 19 levels. It's more like 5 levels.
I'm expecting only the DC area to show up on my map with 19 levels of detail, nothing else.
Am I doing something wrong? Any suggestions?
I think your problem is spherical Mercator vs UTM. The docs for osgearth_package
http://docs.osgearth.org/en/latest/user/tools.html#osgearth-package
say
--bounds xmin ymin xmax ymax bounds to package (in map coordinates; default=entire map) You can provide multiple bounds
So, I think your bounds coordinates need to be in spherical Mercator, not in UTM.
Related
I'm learning QGIS, having moved over from the old OziExplorer. I'm pretty sure my issue is to do with 2 different CRS's. I'm trying to create a map with:
OpenStreetMap or OpenCycleMap (EPSG:3857, WGS 84 / Pseudo-Mercator)
A grid (and POIs) in UTM (EPSG: 32755, UTM Zone 55S)
It shows up as:
Is there a set of steps to do so the Grid is not slightly rotated...or should I just live with it? UTM is great as we are metric and a grid like this is in Metres (1km here). Thanks.
I am new to PostGIS, am not getting the area of polygon right, my sample data is from Google maps, I know the area of the polygon is 11 acres, but the area returned by st_area doesn't match,
I already referred to a few links like below, but unable to resolve the issue, Internet says google follows 4326 Spatial references, I tried a lot, can you please help, Image attached is the polygon from google maps.
I am expecting an array of such coordinates from the user, I have to calculate the area from PostGIS and give an error back to the user if the area entered is not approximated to calculated area.
https://gis.stackexchange.com/questions/169422/how-does-st-area-in-postgis-work
How do I convert a latitude/longitude pair into a PostGIS geography type?
https://gis.stackexchange.com/questions/56862/what-spatial-reference-system-do-i-store-google-maps-lat-lng-in/56925
17.475197 78.389024
17.4771 78.39044
17.475657 78.391652
17.474408 78.390847
17.475197 78.389024
l_polygon_text='MULTIPOLYGON(((
17.4771000000000001 78.3904399999999981,
17.4751970000000014 78.3890240000000063,
17.4756570000000018 78.3916519999999934,
17.4751970000000014 78.3890240000000063,
17.4744080000000004 78.3908469999999937,
17.4771000000000001 78.3904399999999981)))';
st_area(ST_GeometryFromText(l_polygon_text,4326))
st_area(ST_GeometryFromText(l_polygon_text,2163));
st_area(ST_GeometryFromText(l_polygon_text,2249));
st_area(ST_GeometryFromText(l_polygon_text,3859));
ST_AREA(ST_Transform(ST_GeomFromText(l_polygon_text,4326),31467));
ST_Area(ST_Transform(ST_SetSRID(ST_GeomFromText(l_polygon_text),4326),900913));
polygon
In PostGIS, coordinates must be expressed as longitude first, then latitude. Google uses the opposite.
After swapping the coordinates to the proper order, you can't directly call st_area, else you would get an area in "square degrees" which is meaningless. You would have to project to a suitable local coordinate system, or you can use the geography type which will return an area in m2.
select st_area(st_geogFromText('MULTIPOLYGON(((78.3904399999999981 17.4771000000000001, 78.3890240000000063 17.4751970000000014,78.3916519999999934 17.4756570000000018,78.3890240000000063 17.4751970000000014,78.3908469999999937 17.4744080000000004,78.3904399999999981 17.4771000000000001)))'));
st_area
--------------------
26956.897848576307
That being said, the example you have provided is about 6.5 acres, not 11, because the polygon is not properly defined:
I am using QGIS and I imported the Google maps sattelite map. Then I drew a line and measured the distance using the Measure Tool, but the distance is inaccurate (it says about 1200 m, but I know it should be 780 m). Also, when I look at the coordinates of a point on the map (shown in Figure 1: coordinates of the point with a star on it), it is different from the coordinates I find when looking up the coordinates online (https://www.gps-coordinates.net/) (shown in Figure 2: coordinates of the same point as in Figure 1), so there is probably something wrong there.
I imported the Google maps sattelite map via: browser panel --> XYZ tiles -> Sattelite -> New Connection -> URL = http://mt0.google.com/vt/lyrs=s&hl=en&x={x}&y={y}&z={z}.
I drew the line in a 'lines layer'.
I already changed the CRS to ETRS89/UTM zone 32N (I am looking at a place in eastern Germany) both in the general project properties and in the layer which includes the line I drew. I also checked whether the unit of distance was right, and it is indeed meters. Lastly, I changed the coordinates from X and Y to degrees/minutes/seconds. Nothing worked and the result stays about 1200 m.
I hope you can help, thanks in advance!
I just figured out how to fix the problem. It turns out the map I was using did not use the right coordinates (I still don't know why). I now added another map (QuickMapServices) and this one does use the right coordinates. The Measuring Tool also gives the right distance now.
I've created a table of min and max lat/long coordinates for groups of locations. I'd like to use those to draw rectangular bounding boxes on a map and include other attributes as tooltips, not sure where to start. Some example groups below.
group entities minlat minlong maxlat maxlong
a 44 33.29 (122.45) 41.32 (111.75)
b 39 42.53 (110.97) 48.51 (94.90)
c 37 42.46 (100.34) 45.79 (94.83)
d 31 32.78 (83.97) 35.73 (77.86)
e 30 40.41 (96.41) 43.07 (89.40)
f 28 39.81 (80.47) 42.13 (76.78)
What's your data source? The current version of Tableau supports geography and geometry data types, and you could use that to build the polygons. In SQL Server, I would probably add a calculated field that takes the min/max coordinate ints and creates a polygon based on those with the geography data type. Regardless, you'll need coordinates for each vertex.
Take a look at this video. It shows how to overlay custom polygons onto maps. You need coordinates for each point, then you set marks to Polygon with the points on path.
I took your data and did a quick map. The yellow box looks like a strange shape, I might have mistyped a coordinate. It shows the example regardless though.
I have two layers.
(1) Raster layer with flood inundation depths for Vietnam
(2) Shapefile layer with administrative boundaries for Vietnam
The two layers have the same projection (4326).
I load them both onto QGIS. The raster looks good and has appropriate coordinates (e.g. 100.96, 10.47) and scale (1:7,251,734). But the shapefile is really weird. Its coordinates are something ridiculous like (870842, 1503788) and its scale is also crazy at (1:-2,147,483,648).
Of course, the two layers do not line up.
Can someone please help me out?
I suspect that a spatial reference misassignment is behind this question. It is possible to associate an impossible spatial reference. (I have done this.) The administrative boundary coordinates look like meters, not degrees - minutes.
-a look at the bounds for Vietnam here
spatatialreference.org/ref/epsg/3406/
is a place to start.
Then, trace back to the source for the administrative boundary to find the correct projected spatitial reference.
I hope this helps.
best regards,
Katie