A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

Hot answers tagged

45

Yes, there is an analytical solution for this problem. The algorithm you are looking for is known in polygon generalisation as "smallest surrounding rectangle". The algorithm you describe is fine but in order to solve the problems you have listed, you can use the fact that the orientation of the MAR is the same as the one of one of the edges of the point ...


44

Every polygon has, at a minimum, four distinct "centers": The barycenter of its vertices. The barycenter of its edges. Its barycenter as a polygon. A GIS-specific "center" useful for labeling (usually calculated with undocumented proprietary methods). (They may accidentally coincide in special cases, but for "generic" polygons they are distinct points.) A ...


40

To supplement @julien's great solution, here is a working implementation in R, which could serve as pseudocode to guide any GIS-specific implementation (or be applied directly in R, of course). Input is an array of point coordinates. Output (the value of mbr) is an array of the vertices of the minimum bounding rectangle (with the first one repeated to ...


20

I'm a little late to the party but here is another suggestion: http://potree.org/ It's an open souce, WebGL based point cloud viewer I've been working on for quite a while. == UPDATE == It can render large amounts of colored point clouds. LIDAR data without colors will be supported soon. Showcase: http://potree.org/wp/demo/ Source code: https://github....


18

What makes GIS stand out from graphic design and cartography is its use of quantitative reasoning and scientific and engineering principles. Let's see how this can work without getting bogged down in unnecessary calculations. Some Facts In GIS it is indeed useful to have a good intuition for lengths, areas, and even volumes. I'll get to that, but let's ...


16

1) For a full 3D GIS, the better is GRASS GIS, look at Screenshots of 3D data management or From drone-aerial pictures to DEM and ORTHOPHOTO: the case of Caldonazzo's castle, from example. Some examples (interactive: you can scale, rotate the representation and many other things) : DEM with 3D points: Draped raster on the DEM Draped geological map with ...


15

To create cross section: use ArcGIS, MapInfo, etc. with point XYZ data projected on either south-north or east-west plane or use dedicated geological software to create the section (Geosoft Target, Leapfrog Mining, Rockworks, Datamine Studio, etc.) Might require some post-processing to manually add or adjust labels and text To create 3D topo/subsurface ...


15

When there is no implicit cast between two datatypes you need to state it explicitly. In your case ST_Force_3D (or ST_Force3D for PostGIS 2.1 and later) should do the trick: ALTER TABLE cl ALTER COLUMN geom TYPE geometry(MultiLineStringZ) USING ST_Force_3D(geom);


14

ReadyMap might be another option. Here is an example (with a bonus of Leaflet integration!) [via @LeafletJS]: And one more with 3D overlay on the globe: More: demos, code. Update: The project seems to change its course rather drastically. ReadyMap is now: Free Data Service for ReadyMap and osgEarth Developers And the 3D globe application moved (most ...


11

Yes, it is possible but using a Python script in the console see For geologists: 3D geological boreholes I presented the scripts in visualizing 3D data (Z values) or data with z attribute: a solution or QGIS, représentation 3D des couches vectorielles (shapefiles dits 3D ou shapefiles avec attributs z) avec les modules Python Matplotlib ou Visvis à ...


11

This is not the first time I encounter such question and generally it is asked by people outside of geospatial industry that are not familiar with cartographic theory or with practice needs (this is just my observation). As to the question: A "3d Globe" that you see on the screen is nothing less than just an Azimutal projection... And there is no such ...


11

3D globes and the like are very useful for quick visualization purposes. You can instantly see Global Level and Continental Level data, and spatial relationships and distances are easily understood. However if you think about it, you don't really need a Globe foe every such case. As SS_Rebelious has mentioned, a Globe on a Flat Screen, is basically an ...


11

Thank you for clarifying your question as it was previously quite unclear. You can read a multiband raster using the stack or brick function in the raster package and assign the associated RGB values to an sp SpatialPointsDataFrame object using extract, also from raster. Coercion of the data.frame object (which results from read.csv) to an sp point object,...


10

It's super-easy in QGIS 3.0: Run the "Set Z Value" Processing algorithm Click the button on the right of "Z Value", and select Field -> "DYBDE". Run the algorithm. The z values for the geometry's vertices will be set to the value from the DYBDE field. In case you have the values of depths and you want to get elevation values with negative number for ...


9

The Describe object also has the hasM and hasZ properties.


8

I just implemented this myself and posted my answer over on StackOverflow, but I figured I'd drop my version here for others to view: import numpy as np from scipy.spatial import ConvexHull def minimum_bounding_rectangle(points): """ Find the smallest bounding rectangle for a set of points. Returns a set of points representing the corners of ...


8

If you want to get a 3D DXF from a SHP (SHPfile generated from DTM with Qgis-Processing-Tools-GDAL/OGR Extraction-Contour), you must: 1) have column with Z values into Table attributes of SHP. 2) open "OSGeo4W Shell Commands" if you have Windows OS. 3) write into shell for example: ogr2ogr -f "dxf" d:\Temp\3Doutput.dxf d:\Temp\contour.shp -zfield ELEV ...


8

Write your data into a new shapefile with ogr2ogr and force geometry type into 2D with the -dim switch. ogr2ogr -f "ESRI Shapefile" output_2d.shp input_zm.shp -dim 2 The -dim setting is not limited to shapefiles but works in the same way for most vector formats. One exception I know is Oracle Spatial that does not honour the ogr2ogr switch but you must ...


8

In QGIS v3.0 you can use directly QgsPoint: zPoint = QgsPoint(-74, 4, 2600) # x, y, z zPoint.z() # Prints 2600.0 Whereas in QGIS >= 2.10 you need to use QgsPointV2: zPoint = QgsPointV2( QgsWKBTypes.PointZ, -74, 4, 2600 ) # type, x, y, z zPoint.z() # Prints 2600.0 This is an example with a memory layer using QGIS 2.14 (based on the PyQGIS Cookbook): ...


7

You can render from POSTGIS with OSM data in 3D http://wiki.openstreetmap.org/wiki/OSM-3D NOTE: "Preparing OSM data to be viewed in OSM-3D requires a lot of preprocessing steps which are done on GIScience's servers." see the ZIMBA server http://wiki.openstreetmap.org/wiki/OSM-3D#Servers


7

Maybe you could use Osmbuildings. Its a JavaScript library for visualizing OpenStreetMaps (or custom GeoJSON) building geometry into a 3D perspective. It use OpenStreetMaps data directly. Just add the loadData() method: var map = new L.Map('map').setView([52.50440, 13.33522], 17); var osmb = new OSMBuildings(map).loadData(); L.control.layers({}, { ...


7

When talking about having only contours in 3D dxf, the proper way is definitely NOT extracting the vertices as XYZ and interpolating the surface from points. That way you lose the information about how are the points connected which at least leads to losing some detail or it can be even worse. If you use Dxf2xyz and you don't want to lose information I ...


7

Miro's answer will work fine, but if you just want to add a Z value to your attributes table (perhaps for labeling in a map or some other reason), I would start as he suggests: v.in.dxf - to import contours including z dimension (SQLite works well as an output format) Now instead of rasterizing, use the field calculator to pull the Z value from the 3D ...


7

There is a paper called "Curved Reconstruction from Unorganized Points" by In-Kwon Lee which looks into constructing lines/curves from a set of points without any ordering by exploiting the moving least-squares method. Although it focues on 2D applications, it mentions the possibility of extending this to higher dimensions. The following image is taken from ...


7

I know QGIS has a plugin that export DEM to STL using DEMto3D, and I tested on a DEM and it worked. The description of the plugin mentioned that clearly: DEMto3D is the first tool that links GIS (Geographic Information System) and 3D printing. DEMto3D allows export DEM to STL format ready to 3D printing. Here is the homepage of the demto3d, and there ...


7

what you're talking about is an anaglyph map. it's possible using standard QGIS symbology here's an example I did a while back. The buildings were given a size attribute (probably using $area) The idea is for big buildings (by area) appear closer to the viewer, and smaller ones further away. These polygons were given a rank (0=largest set, 1= next ...


6

You could export your scenes to specialist 3D modelling/viewing software. This is what I usually do because the 3D viewers of most GISs are a bit limited (EDIT: in fact I'd forgotten ERDAS Imagine does stereo too but I haven't used it for ages so I can't remember if it is just anaglyph). EXPANDED (as per Chad's request): You need to implement a modelling ...


6

I don't use ESRI City Engine, but I do a lot of work integrating GIS into 3d or vice versa depending on your perspective. Seeing as nobody gave you an answer, here is a generic approach. What you do really depends a lot on how the model has been built and whether you can get access to it. I will assume you have access to the model or some modelling ...


6

You can use the v.to.3d module in the GRASS toolkit (installed with QGIS) to do 2d to 3d layer transformation: v.to.3d - Performs transformation of 2D vector features to 3D.


Only top voted, non community-wiki answers of a minimum length are eligible