Open geodata4all opened 6 years ago
For the polylabel approach, there is now third-party command line utility "geojson-polygon-labels", presented as a "Command line tool to generate point labels from GeoJSON polygons" https://github.com/andrewharvey/geojson-polygon-labels
You can do the PointOnSurface approach using another third party tool like GDAL, e.g
ogr2ogr ne_50m_admin_0_countries_point_on_surface.shp \
ne_50m_admin_0_countries.shp \
-dialect SQLite \
-sql "SELECT featurecla,scalerank,LABELRANK,SOVEREIGNT,SOV_A3,ADM0_DIF,LEVEL,TYPE,ADMIN,ADM0_A3,GEOU_DIF,GEOUNIT,GU_A3,SU_DIF,SUBUNIT,SU_A3,BRK_DIFF,NAME,NAME_LONG,BRK_A3,BRK_NAME,BRK_GROUP,ABBREV,POSTAL,FORMAL_EN,FORMAL_FR,NAME_CIAWF,NOTE_ADM0,NOTE_BRK,NAME_SORT,NAME_ALT,MAPCOLOR7,MAPCOLOR8,MAPCOLOR9,MAPCOLOR13,POP_EST,POP_RANK,GDP_MD_EST,POP_YEAR,LASTCENSUS,GDP_YEAR,ECONOMY,INCOME_GRP,WIKIPEDIA,FIPS_10_,ISO_A2,ISO_A2_EH,ISO_A3,ISO_A3_EH,ISO_N3,ISO_N3_EH,UN_A3,WB_A2,WB_A3,WOE_ID,N_,WOE_NOTE,ADM0_A3_IS,ADM0_A3_US,ADM0_A3_FR,ADM0_A3_RU,ADM0_A3_ES,ADM0_A3_CN,ADM0_A3_TW,ADM0_A3_IN,ADM0_A3_NP,ADM0_A3_PK,ADM0_A3_DE,ADM0_A3_GB,ADM0_A3_BR,ADM0_A3_IL,ADM0_A3_PS,ADM0_A3_SA,ADM0_A3_EG,ADM0_A3_MA,ADM0_A3_PT,ADM0_A3_AR,ADM0_A3_JP,ADM0_A3_KO,ADM0_A3_VN,ADM0_A3_TR,ADM0_A3_ID,ADM0_A3_PL,ADM0_A3_GR,ADM0_A3_IT,ADM0_A3_NL,ADM0_A3_SE,ADM0_A3_BD,ADM0_A3_UA,ADM0_A3_UN,ADM0_A3_WB,CONTINENT,REGION_UN,SUBREGION,REGION_WB,NAME_LEN,LONG_LEN,ABBREV_LEN,TINY,HOMEPART,MIN_ZOOM,MIN_LABEL,MAX_LABEL,NE_ID,WIKIDATAID,NAME_AR,NAME_BN,NAME_DE,NAME_EN,NAME_ES,NAME_FR,NAME_EL,NAME_HE,NAME_HI,NAME_HU,NAME_ID,NAME_IT,NAME_JA,NAME_KO,NAME_NL,NAME_PL,NAME_PT,NAME_RU,NAME_SV,NAME_TR,NAME_UK,NAME_UR,NAME_VI,NAME_ZH,FC_ISO,FC_US,FC_FR,FC_RU,FC_ES,FC_CN,FC_TW,FC_IN,FC_NP,FC_PK,FC_DE,FC_GB,FC_BR,FC_IL,FC_PS,FC_SA,FC_EG,FC_MA,FC_PT,FC_AR,FC_JP,FC_KO,FC_VN,FC_TR,FC_ID,FC_PL,FC_GR,FC_IT,FC_NL,FC_SE,FC_BD,FC_UA,PointOnSurface(geometry) AS geometry FROM ne_50m_admin_0_countries" \
-lco ENCODING=UTF-8
I am using pattern of "simonepri" to start this issue.
Problem
Possibility of extraction of centroids of polygons.
Ideas
For centroids there are few techniques available. Best one according my knowledge is https://github.com/mapbox/polylabel
and second best is postgis pointonsurface https://gis.stackexchange.com/questions/76498/how-is-st-pointonsurface-calculated
and last one centroids of polygon which can be out side a polygon.
Use case
To extract gaps/overlaps from a polygon. First calculate centroids , convert all polygons to lines and convert back to polygon and select polygon which do not have a centroids , inside.
Till now I am using -dissolve with unique ID and -points, but points can be out side of polygon which i do not want.
Can we add this function? I hope that will help others as well.