Geometry ======== We recommend that you run your own postgis service if you are planning on doing more that the basic GIS (geographic information system) activities. If you need guidance or an introduction into the world of GIS then please contact us. we are glad to help you. For smaller usages of GIS we have made a couple of endpoints available for use. These endpoints can be used in combination with Maps API and Date API. Whats geometry -------------- Any point, line of shape on the map is geometry. Our viewer works with tiles (images made up from geometries) or vectors (raw geometric information) No matter how the viewer is build up, it's always based on geometries. With our Data API you can use geometries to gather information about anything that is within the geometry. With the Maps API you can create vector layers using your own geometries or those you get from the Data API. The geometry notation mostly used in our API's is Extended Well-Known text (EWKT). Some endpoints support other formats like GeoJson. If they do it will be mentioned in the description of those endpoints. If your geometries are stored in another format you will need to convert it for use of most endpoints. Area ---- .. _gis_area: .. http:post:: /maps_api/v2/server/gis/area With GIS it is possible to generate a very accurate surface area in m2. Use this endpoint to calculate the surface area of your own geometries or geometries from the Data API. **Example JSON requests:** .. sourcecode:: http POST /maps_api/v2/server/gis/area HTTP/1.1 Host: planviewer.nl Accept: application/json Content-Type: application/json { "geometry": "POLYGON ((190259.106 444171.8126, 189849.186 443089.8926, 191293.986 442874.8526, 191475.426 443741.7326, 190259.106 444171.8126))" } **Example response:** .. sourcecode:: json { "area":"1391872.20480001" } The example above gives us an area surface calculation to the 8th digit after the decimal. Buffer ------ .. http:post:: /maps_api/v2/server/gis/buffer .. _gis_buffer: When using geometry in combination with Data API to gather information it is important that you get the correct information. For example when using a perceel geometry to get information about the perceel you won't want this the surrounding percelen to be included. With GIS you can contract or expand a geometry. Is can be used to get a clean Data API result or it can be used to gather information in the surroundings of the geometry. Use a positive number (float) to expand and a negative number (float) to contract the geometry **Example JSON requests:** .. sourcecode:: http POST /maps_api/v2/server/gis/buffer HTTP/1.1 Host: planviewer.nl Accept: application/json Content-Type: application/json { "geometry": "POLYGON ((190259.106 444171.8126, 189849.186 443089.8926, 191293.986 442874.8526, 191475.426 443741.7326, 190259.106 444171.8126))", "buffer": -0.0000001 } **Example response:** .. sourcecode:: json { "geometry": "SRID=28992;POLYGON((190259.106 444171.8126,191475.426 443741.7326,191293.986 442874.8526,189849.186 443089.8926,190259.106 444171.8126))" } The newly returned geometry can be directly used in our Maps API and Data API. .. _gis_intersection: Intersection ------ .. http:post:: /maps_api/v2/server/gis/intersection Compares two geometries and returns the geometry of where they overlap. **Example JSON requests:** .. sourcecode:: http POST /maps_api/v2/server/gis/intersection HTTP/1.1 Host: planviewer.nl Accept: application/json Content-Type: application/json { "geom1":"SRID=28992;POLYGON((120562.54 491547.24,120582.24 491572.46,120544.193 491602.177,120544.15 491602.21,120506.06 491631.97,120486.36 491606.75,120524.45 491577,120562.54 491547.24))", "geom2":"SRID=28992;POLYGON((120575.933 491564.609 0,120582.065 491572.51 0,120506.059 491631.877 0,120499.919 491623.984 0,120575.933 491564.609 0))" } **Example response:** .. sourcecode:: json { "geometry": "SRID=28992;POLYGON((120575.933 491564.609 0,120499.919 491623.984 0,120506.059 491631.877 0,120582.065 491572.51 0,120575.933 491564.609 0))" } The newly returned geometry can be directly used in our Maps API and Data API. .. _gis_transform: Transform ------ .. http:post:: /maps_api/v2/server/gis/transform transform geometry from one projection to another **Example JSON requests:** .. sourcecode:: http POST /maps_api/v2/server/gis/transform HTTP/1.1 Host: planviewer.nl Accept: application/json Content-Type: application/json { "ewkt": "SRID=28992;POINT(265912.661 573137.666)", //geometry as ewkt "projection": 28992, //current projection "projectTo": 4326 //projection where the geometry needs to transform too. } **Example response:** .. sourcecode:: json { "geometry": "POINT(7.04448455058787 53.1335129727251)", //geometry on the new projection "projection": 4326 //confirmation of used projection } .. note:: Planviewer uses geometry exclusively on the RD projection (RijksDriehoekstelsel) which has the "Spacial Reference" or SRID of 28992. In the example above the point geometry is transformed from RD tot WGS 84. This is the projection used for GPS-data on your phone and is the primary international projection used. There are a lot of projections used all over the world to accurately project data on maps. If you need to find the details of a certain projection, here is a good place to start: https://spatialreference.org/ Although Planviewer's map viewers and data use RD, this function can be used to transform between two other projections. We do however advise you to visually check the transformation in a viewer or GIS package of you choice. .. _gis_isvalid: Isvalid ------ .. http:post:: /maps_api/v2/server/gis/isvalid Checks if a geometry is valid. **Example JSON requests:** .. sourcecode:: http POST /maps_api/v2/server/gis/isvalid HTTP/1.1 Host: planviewer.nl Accept: application/json Content-Type: application/json { "ewkt":"SRID=28992;POLYGON((120562.54 491547.24,120582.24 491572.46,120544.193 491602.177,120544.15 491602.21,120506.06 491631.97,120486.36 491606.75,120524.45 491577,120562.54 491547.24))" } **Example response:** .. sourcecode:: json { "valid": true } .. _gis_makevalid: Makevalid ------ .. http:post:: /maps_api/v2/server/gis/makevalid Checks if a geometry is valid and tries to fix it if not. **Example JSON requests:** .. sourcecode:: http POST /maps_api/v2/server/gis/makevalid HTTP/1.1 Host: planviewer.nl Accept: application/json Content-Type: application/json { "ewkt":"SRID=28992;POLYGON((120562.54 491547.24,120582.24 491572.46,120544.193 491602.177,120544.15 491602.21,120506.06 491631.97,120486.36 491606.75,120524.45 491577,120562.54 491547.24))" } **Example response:** .. sourcecode:: json { "geometry": "SRID=28992;POLYGON((190259.106 444171.8126,189849.186 443089.8926,191293.986 442874.8526,191475.426 443741.7326,190259.106 444171.8126))" } .. _gis_force2d: Force2d ------ .. http:post:: /maps_api/v2/server/gis/force2d Removed additional dimensions from the geometry. (e.x. MultiPolygon Z) **Example JSON requests:** .. sourcecode:: http POST /maps_api/v2/server/gis/force2d HTTP/1.1 Host: planviewer.nl Accept: application/json Content-Type: application/json { "ewkt": "MULTIPOLYGON Z (((118027.2709 486024.0515 0,118028.2526 485873.0357 0,117930.5518 485873.3229 0,117918.2965 486364.4986 0,118026.6929 486365.4664 0,118027.2709 486024.0515 0)))" } **Example response:** .. sourcecode:: json { "geometry": "SRID=28992;MULTIPOLYGON(((118027.2709 486024.0515,118028.2526 485873.0357,117930.5518 485873.3229,117918.2965 486364.4986,118026.6929 486365.4664,118027.2709 486024.0515)))" } .. _gis_pointonsurface: Pointonsurface ------ .. http:post:: /maps_api/v2/server/gis/force2d Returns a POINT guaranteed to be on the surface of the geometry. **Example JSON requests:** .. sourcecode:: http POST /maps_api/v2/server/gis/pointonsurface HTTP/1.1 Host: planviewer.nl Accept: application/json Content-Type: application/json { "ewkt": "SRID=28992;MULTIPOLYGON(((118027.2709 486024.0515,118028.2526 485873.0357,117930.5518 485873.3229,117918.2965 486364.4986,118026.6929 486365.4664,118027.2709 486024.0515)))" } **Example response:** .. sourcecode:: json { "geometry": "SRID=28992;POINT(117974.763229195 486194.27505)" }