0

I am trying to make a 3D web application which should be able to render 3D building using Cesiumjs and loading data from PostgreSQL/PostGIS via GeoServer.

I have MULTIPOLYGON Z and MULTIPOINTS Z for one building and using PostGIS function st_asx3d to save data in table so i can get it from the GeoServer.

Then after getting it in the GeoServer and extract it as buildings.geojson it looks like this:

     {
     "type": "FeatureCollection",
     "features": [
      {
        "type": "Feature",
        "id": "buildings.fid--2389fea2_167cb9c6db4_-7ffc",
        "geometry": null,
        "properties": {
        "id": 1,
          "brep": "<IndexedFaceSet  convex='false' coordIndex='0 1 2 3 -1 4 5 6 7 8 -1 9 10 11 12 -1 13 14 15 16 17 -1 18 19 20 21 -1 22 23 24 25 -1 26 27 28 29'><Coordinate point='606932.664834999945015 4502862.564945000223815 14.613559 606935.218797000008635 4502868.66958099976182 14.613559 606930.335553999990225 4502870.712554999627173 10.484536 606927.78159200004302 4502864.607919000089169 10.484536 606930.335553999990225 4502870.712554999627173 10.484536 606935.218797000008635 4502868.66958099976182 14.613559 606940.082867000019178 4502866.634627999737859 10.500748 606940.082867000019178 4502866.634627999737859 0 606930.335553999990225 4502870.712554999627173 0 606935.218797000008635 4502868.66958099976182 14.613559 606932.664834999945015 4502862.564945000223815 14.613559 606937.528904999955557 4502860.529992000199854 10.500748 606940.082867000019178 4502866.634627999737859 10.500748 606932.664834999945015 4502862.564945000223815 14.613559 606927.78159200004302 4502864.607919000089169 10.484536 606927.78159200004302 4502864.607919000089169 0 606937.528904999955557 4502860.529992000199854 0 606937.528904999955557 4502860.529992000199854 10.500748 606927.78159200004302 4502864.607919000089169 10.484536 606930.335553999990225 4502870.712554999627173 10.484536 606930.335553999990225 4502870.712554999627173 0 606927.78159200004302 4502864.607919000089169 0 606927.78159200004302 4502864.607919000089169 0 606930.335553999990225 4502870.712554999627173 0 606940.082867000019178 4502866.634627999737859 0 606937.528904999955557 4502860.529992000199854 0 606940.082867000019178 4502866.634627999737859 10.500748 606937.528904999955557 4502860.529992000199854 10.500748 606937.528904999955557 4502860.529992000199854 0 606940.082867000019178 4502866.634627999737859 0 ' /></IndexedFaceSet>",
          "points": "<PointSet ><Coordinate point='606928.010000000009313 4502864.759999999776483 10.52 606928.290000000037253 4502865.46999999973923 10.470000000000001 606928.510000000009313 4502866.009999999776483 10.66 606928.689999999944121 4502864.419999999925494 11.039999999999999 606928.729999999981374 4502866.25 10.51 606928.810000000055879 4502864.169999999925494 11.33 606928.85999999998603 4502864.639999999664724 11.279999999999999 606928.89000000001397 4502867.040000000037253 10.5 606928.900000000023283 4502867.209999999962747 10.380000000000001 606929.010000000009313 4502866.160000000149012 10.890000000000001 606929.119999999995343 4502864.900000000372529 11.24 606929.300000000046566 4502865.400000000372529 11.300000000000001 606929.489999999990687 4502863.879999999888241 11.81 606929.5 4502867.46999999973923 11.09 606929.53000000002794 4502865.709999999962747 11.300000000000001 606929.599999999976717 4502863.570000000298023 12.1 606929.689999999944121 4502866.610000000335276 11.199999999999999 606929.699999999953434 4502864.009999999776483 12.09 606929.71999999997206 4502866.480000000447035 11.289999999999999 606929.839999999967404 4502865.53000000026077 11.630000000000001 606929.939999999944121 4502864.339999999850988 12 606930.099999999976717 4502864.799999999813735 12.01 606930.180000000051223 4502867.360000000335276 11.279999999999999 606930.290000000037253 4502863.339999999850988 12.609999999999999 606930.319999999948777 4502865.169999999925494 12.029999999999999 606930.319999999948777 4502866.839999999850988 11.710000000000001 606930.46999999997206 4502866.019999999552965 11.869999999999999 606930.53000000002794 4502863.389999999664724 12.880000000000001 606930.540000000037253 4502865.910000000149012 11.98 606930.67000000004191 4502864.919999999925494 12.52 606930.78000000002794 4502863.769999999552965 12.800000000000001 606930.89000000001397 4502864.21999999973923 12.880000000000001 606930.96999999997206 4502866.809999999590218 11.970000000000001 606931.010000000009313 4502867.360000000335276 11.9 606931.069999999948777 4502867.419999999925494 11.869999999999999 606931.10999999998603 4502864.629999999888241 12.779999999999999 606931.14000000001397 4502866.21999999973923 12.48 606931.260000000009313 4502865.429999999701977 12.65 606931.380000000004657 4502865.339999999850988 12.789999999999999 606931.449999999953434 4502867.509999999776483 12.23 606931.479999999981374 4502864.299999999813735 13.220000000000001 606931.60999999998603 4502863.209999999962747 13.619999999999999 606931.680000000051223 4502863.620000000111759 13.609999999999999 606931.78000000002794 4502866.259999999776483 12.77 606931.810000000055879 4502866.769999999552965 12.710000000000001 606931.89000000001397 4502864.089999999850988 13.51 606931.910000000032596 4502866.849999999627471 12.699999999999999 606931.959999999962747 4502865.610000000335276 13.220000000000001 606932.060000000055879 4502864.830000000074506 13.449999999999999 606932.209999999962747 4502864.78000000026077 13.6 606932.270000000018626 4502866.889999999664724 12.970000000000001 606932.32999999995809 4502863.679999999701977 14.16 606932.439999999944121 4502862.660000000149012 14.51 606932.479999999981374 4502863.019999999552965 14.35 606932.560000000055879 4502865.71999999973923 13.44 606932.599999999976717 4502866.169999999925494 13.41 606932.680000000051223 4502863.559999999590218 14.289999999999999 606932.739999999990687 4502866.290000000037253 13.539999999999999 606932.790000000037253 4502867.429999999701977 13.15 606932.800000000046566 4502864.980000000447035 14.029999999999999 606932.849999999976717 4502864.240000000223517 14.220000000000001 606933.020000000018626 4502864.21999999973923 14.34 606933.040000000037253 4502867.549999999813735 13.35 606933.10999999998603 4502866.269999999552965 13.859999999999999 606933.10999999998603 4502863.049999999813735 14.380000000000001 606933.209999999962747 4502862.419999999925494 14.300000000000001 606933.369999999995343 4502865.190000000409782 14.4 606933.380000000004657 4502865.589999999850988 14.210000000000001 606933.410000000032596 4502862.96999999973923 14.26 606933.560000000055879 4502865.740000000223517 14.34 606933.57999999995809 4502863.650000000372529 14.32 606933.589999999967404 4502866.889999999664724 13.960000000000001 606933.599999999976717 4502864.360000000335276 14.59 606933.770000000018626 4502863.610000000335276 14.18 606933.819999999948777 4502866.959999999962747 14.140000000000001 606933.82999999995809 4502862.419999999925494 13.75 606933.89000000001397 4502861.799999999813735 13.550000000000001 606933.930000000051223 4502865.650000000372529 14.59 606933.939999999944121 4502867.549999999813735 13.94 606934 4502867.53000000026077 14.07 606934.07999999995809 4502862.360000000335276 13.6 606934.10999999998603 4502864.610000000335276 14.49 606934.130000000004657 4502864.990000000223517 14.48 606934.260000000009313 4502863.040000000037253 13.619999999999999 606934.319999999948777 4502863.71999999973923 13.869999999999999 606934.32999999995809 4502865.139999999664724 14.5 606934.369999999995343 4502866.349999999627471 14.619999999999999 606934.46999999997206 4502862.959999999962747 13.470000000000001 606934.540000000037253 4502861.790000000037253 13.029999999999999 606934.589999999967404 4502866.370000000111759 14.56 606934.680000000051223 4502865.019999999552965 14.35 606934.739999999990687 4502861.75 12.960000000000001 606934.75 4502866.929999999701977 14.630000000000001 606934.810000000055879 4502866.959999999962747 14.619999999999999 606934.819999999948777 4502864.019999999552965 14.25 606934.849999999976717 4502864.400000000372529 14.34 606934.959999999962747 4502862.419999999925494 13.02 606935.03000000002794 4502863.080000000074506 13.01 606935.069999999948777 4502864.519999999552965 14.210000000000001 606935.07999999995809 4502865.740000000223517 14.31 606935.160000000032596 4502862.320000000298023 12.75 606935.300000000046566 4502865.759999999776483 14.279999999999999 606935.449999999953434 4502864.379999999888241 14.23 606935.5 4502866.299999999813735 14.31 606935.5 4502863.410000000149012 13.77 606935.53000000002794 4502866.339999999850988 14.289999999999999 606935.560000000055879 4502863.790000000037253 14.029999999999999 606935.630000000004657 4502867.25 14.4 606935.64000000001397 4502861.809999999590218 12.23 606935.739999999990687 4502862.440000000409782 12.220000000000001 606935.790000000037253 4502865.139999999664724 14.050000000000001 606935.800000000046566 4502863.900000000372529 13.970000000000001 606935.849999999976717 4502867.209999999962747 14.279999999999999 606935.849999999976717 4502861.679999999701977 12.039999999999999 606936.03000000002794 4502865.160000000149012 14.1 606936.099999999976717 4502862.740000000223517 12.289999999999999 606936.189999999944121 4502867.5 14.25 606936.189999999944121 4502863.75 13.869999999999999 606936.25 4502865.669999999925494 14.07 606936.260000000009313 4502863.190000000409782 13.73 606936.270000000018626 4502865.71999999973923 13.99 606936.319999999948777 4502861.209999999962747 11.57 606936.349999999976717 4502866.639999999664724 14.19 606936.449999999953434 4502867.549999999813735 14.199999999999999 606936.459999999962747 4502861.809999999590218 11.640000000000001 606936.5 4502864.559999999590218 13.869999999999999 606936.540000000037253 4502863.290000000037253 13.76 606936.550000000046566 4502866.620000000111759 14.07 606936.560000000055879 4502861.019999999552965 11.32 606936.739999999990687 4502864.549999999813735 13.84 606936.770000000018626 4502862.120000000111759 11.56 606936.939999999944121 4502866.870000000111759 14.07 606936.939999999944121 4502863.120000000111759 13.59 606936.96999999997206 4502862.589999999850988 13.380000000000001 606936.989999999990687 4502865.110000000335276 13.73 606936.989999999990687 4502865.049999999813735 13.81 606937.010000000009313 4502860.599999999627471 10.85 606937.060000000055879 4502866.040000000037253 13.890000000000001 606937.180000000051223 4502861.179999999701977 10.880000000000001 606937.189999999944121 4502866.940000000409782 13.99 606937.199999999953434 4502863.959999999962747 13.59 606937.21999999997206 4502862.629999999888241 12.890000000000001 606937.239999999990687 4502860.389999999664724 10.6 606937.25 4502866.03000000026077 13.85 606937.439999999944121 4502861.490000000223517 10.82 606937.459999999962747 4502863.950000000186265 13.640000000000001 606937.53000000002794 4502861.950000000186265 10.85 606937.680000000051223 4502866.25 13.779999999999999 606937.689999999944121 4502862.480000000447035 13.31 606937.729999999981374 4502864.5 13.550000000000001 606937.729999999981374 4502864.419999999925494 13.550000000000001 606937.78000000002794 4502865.440000000409782 13.630000000000001 606937.790000000037253 4502861.910000000149012 10.74 606937.910000000032596 4502866.320000000298023 13.640000000000001 606937.910000000032596 4502867.209999999962747 13.800000000000001 606937.92000000004191 4502863.360000000335276 13.390000000000001 606937.949999999953434 4502865.440000000409782 13.6 606938.180000000051223 4502863.339999999850988 13.27 606938.199999999953434 4502867.349999999627471 13.74 606938.400000000023283 4502862.610000000335276 10.43 606938.430000000051223 4502865.620000000111759 13.529999999999999 606938.46999999997206 4502863.870000000111759 13.25 606938.479999999981374 4502863.78000000026077 13.24 606938.489999999990687 4502867.309999999590218 13.75 606938.510000000009313 4502864.830000000074506 13.470000000000001 606938.64000000001397 4502866.599999999627471 13.6 606938.650000000023283 4502865.700000000186265 13.449999999999999 606938.67000000004191 4502864.839999999850988 13.41 606938.900000000023283 4502866.769999999552965 13.49 606938.939999999944121 4502867.559999999590218 13.6 606939.03000000002794 4502864.190000000409782 10.51 606939.130000000004657 4502864.099999999627471 10.369999999999999 606939.17000000004191 4502864.940000000409782 10.56 606939.17000000004191 4502864.990000000223517 13.18 606939.25 4502866.669999999925494 13.43 606939.349999999976717 4502866 13.34 606939.459999999962747 4502867.209999999962747 7.39 606939.540000000037253 4502865.290000000037253 5.51 606939.60999999998603 4502866.169999999925494 13.25 606939.67000000004191 4502866.940000000409782 13.34 606939.800000000046566 4502866.009999999776483 10.42 606935.14000000001397 4502867.809999999590218 14.6 606934.900000000023283 4502867.860000000335276 14.630000000000001 606929.449999999953434 4502867.929999999701977 11.23 606930.290000000037253 4502867.959999999962747 12.02 606932.010000000009313 4502867.980000000447035 12.5 606930.300000000046566 4502868.019999999552965 11.73 606933.180000000051223 4502868.080000000074506 13.19 606930.67000000004191 4502868.139999999664724 12.130000000000001 606932.25 4502868.150000000372529 12.76 606933.119999999995343 4502868.169999999925494 13.19 606934.380000000004657 4502868.360000000335276 14.08 606934.119999999995343 4502868.450000000186265 13.92 606929.459999999962747 4502868.540000000037253 10.6 606929.430000000051223 4502868.549999999813735 10.4 606931.28000000002794 4502868.570000000298023 12.58 606932.35999999998603 4502868.669999999925494 12.6 606931.5 4502868.75 12.56 606934.650000000023283 4502868.759999999776483 14.279999999999999 606934.959999999962747 4502868.78000000026077 14.48 606929.930000000051223 4502868.78000000026077 12.49 606932.290000000037253 4502868.790000000037253 12.5 606933.589999999967404 4502868.900000000372529 13.32 606933.32999999995809 4502869.040000000037253 13.15 606930.560000000055879 4502869.150000000372529 12.550000000000001 606931.569999999948777 4502869.25 12.220000000000001 606934.119999999995343 4502869.330000000074506 13.56 606930.739999999990687 4502869.349999999627471 12.15 606933.82999999995809 4502869.370000000111759 13.42 606931.489999999990687 4502869.410000000149012 11.99 606932.800000000046566 4502869.440000000409782 12.56 606932.540000000037253 4502869.629999999888241 12.369999999999999 606930.800000000046566 4502869.839999999850988 12.08 606933.300000000046566 4502869.889999999664724 12.75 606932.010000000009313 4502869.980000000447035 11.85 606933 4502869.980000000447035 12.56 606930.71999999997206 4502870.03000000026077 11.81 606931.75 4502870.230000000447035 11.619999999999999 606931.239999999990687 4502870.53000000026077 11.300000000000001 606931.85999999998603 4502870.549999999813735 7.37 606930.949999999953434 4502870.820000000298023 10.75 606937.199999999953434 4502867.809999999590218 14.06 606937.5 4502867.940000000409782 13.99 606937.739999999990687 4502867.940000000409782 13.960000000000001 606935.439999999944121 4502868.129999999888241 14.57 606935.709999999962747 4502868.169999999925494 14.44 606936.479999999981374 4502868.410000000149012 14.25 606936.520000000018626 4502868.490000000223517 7.58 606936.800000000046566 4502868.53000000026077 14.19 606935.270000000018626 4502868.929999999701977 7.45 606935.660000000032596 4502869 12.98 ' /></PointSet>"
      }
    }
  ],
  "totalFeatures": 1,
  "numberMatched": 1,
  "numberReturned": 1,
  "timeStamp": "2018-12-20T12:38:01.436Z",
  "crs": null
}

So now when I try to use the cesium function to load GeoJSON Cesium.GeoJsonDataSource.load I don't see the building on the map.

Any idea what am I doing wrong and if there is better way to rend the data to cesium as 3d?

Cesiumjs Code:

var viewer = new Cesium.Viewer('cesiumContainer', {
 terrainProvider: Cesium.createWorldTerrain()
 });

var scene = viewer.scene;
// // Set the initial camera view to look at Manhattan
var initialPosition = 
Cesium.Cartesian3.fromDegrees(-74.01881302800248, 40.69114333714821, 
753);

 var initialOrientation = new 
 Cesium.HeadingPitchRoll.fromDegrees(21.27879878293835, 
-21.34390550872461, 0.0716951918898415);

var camerView = viewer.scene.camera.setView({
destination: initialPosition,
orientation: initialOrientation,
endTransform: Cesium.Matrix4.IDENTITY
});

 viewer.dataSources.add(Cesium.GeoJsonDataSource.load
('buildings.geojson', {
 stroke: Cesium.Color.HOTPINK,
 fill: Cesium.Color.PINK,
 strokeWidth: 30000,
 markerSymbol: '?'
 }
));
  • Perhaps you could show your cesium code. I have had a lot of success using Polygons directly.You can create an array of points for the vertices, and then use an extruded height. Obviously, this will only work for flat roofs. – John Powell Dec 20 '18 at 17:13
  • @JohnPowell i did add the code to the question i hope you have a solution! – Mo Halem Dec 20 '18 at 20:24
  • @JohnPowell and also i will have different kind of roofs any idea how to handel this:/ – Mo Halem Dec 20 '18 at 20:39

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.