Combine KML polygons in PHP

I have a problem with the Google Maps API allowing only 1000 functions to be used on the map.

I save records in the database areas. Each area associates with it a bunch of KML polygon information stored as an XML string. Each area consists of one or more polygons.

Given some user data, several of these areas are combined into one <Placemark>. I get their combined geometry by wrapping the concatenated polygon information in a tag <MultiGeometry>.

<Placemark>
    <name>My combined area</name>
    <MultiGeometry>
        <Polygon> (area 1 info) </Polygon>
        <Polygon> (area 2 info) </Polygon>
        <Polygon> (area 2 info) </Polygon>
        <Polygon> (area 3 info) </Polygon>
    </MultiGeometry>
</Placemark>

The problem is that many of these areas are very complex, and therefore any given label can contain more than 100 polygons, which very quickly pushes me to the limit of 1000 per document.

, , , , . (, , ) ?

+3
1

. .

, XML-, GIS, ​​ PostgreSQL, PostGIS. (WKB) , XML .

, . . , "the_geom", :

SELECT ST_ASKML(ST_Union(the_geom)) AS area_union_askml
FROM areas 
WHERE (some_filter_expression)
GROUP BY (optional_group_by_expression)

ST_UNION KML.

, KML Google, ST_Simplify ST_SimplifyPreserveTopology. ST_NPoints , , .

+1

Source: https://habr.com/ru/post/1719940/


All Articles