Mapbox-ios загрузить тепловую карту - PullRequest
0 голосов
/ 02 июля 2019

Я пытался получить элементы с помощью сервиса WFS geosever и использовать MGLHeatmapStyleLayer для его генерации, но мне нужно было синхронизировать его с веб-отображением (используя openlayers), и что-то пошло не так.

Geoserver geoserver являетсяТепловая карта следующим образом:

accMV03

<Title>accMV03</Title>
A heatmap 


<ogc:Function name="gs:Heatmap">
<ogc:Function name="parameter">
ogc:Literaldata</ogc:Literal>
</ogc:Function>
<ogc:Function name="parameter">
ogc:LiteralweightAttr</ogc:Literal>
ogc:LiteralCLOUDCOVER</ogc:Literal>
</ogc:Function>
<ogc:Function name="parameter">
ogc:LiteralradiusPixels</ogc:Literal>
<ogc:Function name="env">
ogc:Literalradius</ogc:Literal>
ogc:Literal35</ogc:Literal>
</ogc:Function>
</ogc:Function>
<ogc:Function name="parameter">
ogc:LiteralpixelsPerCell</ogc:Literal>
ogc:Literal2</ogc:Literal>
</ogc:Function>
<ogc:Function name="parameter">
ogc:LiteraloutputBBOX</ogc:Literal>
<ogc:Function name="env">
ogc:Literalwms_bbox</ogc:Literal>
</ogc:Function>
</ogc:Function>
<ogc:Function name="parameter">
ogc:LiteraloutputWidth</ogc:Literal>
<ogc:Function name="env">
ogc:Literalwms_width</ogc:Literal>
</ogc:Function>
</ogc:Function>
<ogc:Function name="parameter">
ogc:LiteraloutputHeight</ogc:Literal>
<ogc:Function name="env">
ogc:Literalwms_height</ogc:Literal>
</ogc:Function>
</ogc:Function>
</ogc:Function>

Я сделал те же настройки в mapbox в соответствии с его настройками:

MGLShape * shape = [MGLShape shapeWithData: dataкодировка: NSUTF8StringEncoding error: NULL];MGLShapeSource * source = [[MGLShapeSource alloc] initWithIdentifier: @ "землетрясения" shape: параметры формы: nil];[self.mapView.style addSource: source];

MGLHeatmapStyleLayer * heatmapLayer = [[MGLHeatmapStyleLayer alloc] initWithIdentifier:@"earthquakes" source:source];

NSDictionary *colorDictionary = @{ @0 : [UIColor clearColor],
                                   @0.1 : [UIColor colorWithHexString:@"#7F95E6"],
                                   @0.3 : [UIColor colorWithHexString:@"#7DFC3F"],
                                   @0.4 : [UIColor colorWithHexString:@"#F6FD01"],
                                   @0.5 : [UIColor colorWithHexString:@"#EF8C07"],
                                   @0.7 : [UIColor colorWithHexString:@"#FE0409"],
                                   @1 : [UIColor colorWithHexString:@"#FE0409"]
                                   };
heatmapLayer.heatmapColor = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($heatmapDensity,

'linear', nil,% @) ", colorDictionary];

// Heatmap weight测量单个数据点对图层外观的影响程度。
heatmapLayer.heatmapWeight = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:(CLOUDCOVER,

'linear', nil,%@) ", @ {@ 2: @ 0, @ 50: @ 1}];

heatmapLayer.heatmapRadius = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel,

'linear', nil,% @)", @ {@ 0: @ 0, @ 9: @ 35}];

// The heatmap layer will have an opacity of 0.75 up to zoom level 9, when the opacity becomes 0.
heatmapLayer.heatmapOpacity = [NSExpression expressionWithFormat:@"mgl_step:from:stops:($zoomLevel, 0.5, %@)",

@ {@ 0: @ 0.5}]; [self.mapView.style addLayer: heatmapLayer];

Данные json, которые я получаю(усечено, потому что оно слишком большое):

{crs = {properties = {name = "urn: ogc: def: crs: EPSG :: 4326";}; type = name;}; функции= ({{геометрия = {координаты = (((("90.79258376", "34.68726192"), ("90.78728718000001", "34.5401826"), ("90.74097773", "34.5400815"), ("90.69451678999999", "34.53981991"), ("90.64797436000001", "34.53948932"), ("90.60135812999999", "34.53913879"), ("90.55467797", "34.53877968"), ("90.50784152999999", "34.53819338"), (")" 9077901), (100) "396097", (100) "396097", ("90.41399723000001", "34.53710182"), ("90.36692619999999", "34.53646124"), ("90.31992113", "34.53633098"), ("90.27261084", "34.53547799""),(«90.22537624», «34.5353213»), («90.17786378», «34.53448444»), («90.13043872», «34.5346113»), («90.08272073000001», «34.53391666»), («90.03488068», «34.53893»)("89.98685483", "34.53218372"), ("89.97653308", "34.5318024"), ("89.98041888", "34.69636811"), ("89.99067782", "34.69622136"), ("90.03889011", "34.69552566")("90.08694996", "34.69493407"), ("90.13484055000001", "34.69424968"), ("90.18259573", "34.69363237"), ("90.23023348", "34.6931434"), ("90.2777308", "34.69264").("90.32510422", "34.69217701"), ("90.37235085", "34.69170131"), ("90.41947651", "34.69122197"), ("90.4664775", "34.69072615"), ("90.51337087", "34.69022963")(«90,56016223», «34,68975602»),("90.60686067", "34.68930153"), ("90.65347061", "34.68885613"), ("90.69997284", "34.68840548"), ("90.74633222", "34.6878439"), ("90.79258376", "34.687)));type = MultiPolygon;};"geometry_name" = GEOM;id = "GE01_ImageLibraryStrips_2010.11428";properties = {ACQDATE = "2010-10-05";AVMULTIRES = "1,80253935";AVOFFNADIR = "17,43123055";AVPANRES = "0,45036912";AVSUNAZIM = "157,32949829";AVSUNELEV = "48.44802475";AVTARGETAZ = "15.0353384";BROWSEURL = "https://api.discover.digitalglobe.com/show?id=1050410002311500"; CATALOGID = 1050410002311500; CLOUDCOVER = 2; IMAGEBANDS =" 4-BANDS "; MNMULTIRES =" 1.74204099 "; MNOFFNADIR =" 13.74027443 "; MNPANRES =" 0.46N186NS "MUNNUNSNS = 930NNS" MUNNS "= 2 = 0 = 0 = M = 0 = 0 = 0 = 0 = 0 = 0 0 6 6 6 6 6 9 6 9 6 6 9 9 9 9 9 6 9 23 9 23 9 23 9 6 9 9 23 6 6 9 9 9 9 6 9 6 9 6 9 6 9 9 6 6 6 9 9 6 6 6 9 6 9 6 6 6 9 632 УНИ. Мы у нас я оставил сообщение" = "; MUNNNS; MUNNSN = MURNER = MUNP;= "48,32831955"; MNTARGETAZ = "5,8564291"; MXMULTIRES = "1,87556374"; MXOFFNADIR = "21,22297668"; MXPANRES = "0,46854198"; MXSUNAZIM = "157,87187195"; MXSUNELEVT 280 = "280 = 28068" = = 68,568 = 280,5 "= 68,568 = 280,5" = 68,5 "= 68,50 = 48,50 = 68,568 = 280,5" = 68,5 "= 48,5; STEREOPAIR = НЕТ; X1 = "89,97653308"; X2 = "90,79258376"; X3 = "90,79258376"; X4 = "89,97653308"; Y1 = "34,69636811"; Y2 = "34,69636811"; Y3 = "34,5318024";34.5318024 ";}; type = Feature;}, {geometry = {координаты = ((((" 101.8034676 "," 37.30488403 "), (" 101.7951162 "," 37.15393595 "), (" 101.7461036 "," 37.1525963 "),(«101.7164768», «37.15247535»), («101.7254842», «37.30562173»), («101.7551235», «37.30543625»),(«101.8034676», «37.30488403»))));type = MultiPolygon;};"geometry_name" = GEOM;id = "GE01_ImageLibraryStrips_2018.19528";properties = {ACQDATE = "2018-07-13";AVMULTIRES = "1,7714931";AVOFFNADIR = "17.212667";AVPANRES = "0,4426126";AVSUNAZIM = "131.10796";AVSUNELEV = "68.80699";AVTARGETAZ = "24.521803";BROWSEURL = "https://api.discover.digitalglobe.com/show?id=1050010011182200"; CATALOGID = 1050010011182200; CLOUDCOVER = 0; IMAGEBANDS =" 4-BANDS "; MNMULTIRES =" 1.7652483 "; MNOFFNADIR =" 16,846489 "; MNPANRES =" 0.4422SUNIM = = 0.4422SUNIM = = 0.4410.0 ";= "68.78098"; MNTARGETAZ = "23.119398"; MXMULTIRES = "1.7778386"; MXOFFNADIR = "17.581448"; MXPANRES = "0.44419014"; MXSUNAZIM = "131.19458"; MXSUNELEV = "68.8328445;;« GE.8328445 «;; STEREOPAIR = NONE; X1 = "101.7164768"; X2 = "101.8034676"; X3 = "101.8034676"; X4 = "101.7164768"; Y1 = "37.30562173"; Y2 = "37.30562173"; Y3 = "37.15247535"; Y4 = "37.15247535 ";}; type = Feature;}); numberMatched = 11061; numberReturned = 3019; timeStamp =" 2019-07-02T09: 33: 35.664Z "; totalFeatures = 11061; type = FeatureCollection;

Можете ли вы помочь мне обнаружить, что веса совершенно разные?

Если вы считаете, что описание не понятно, перейдите к https://github.com/mapbox/mapbox-gl-native/issues/14936#event-2438627720, чтобы просмотреть, здесь я также выпустил ту же проблему, и приложитефотографии, спасибо!

...