<\/HEAD>
Hallo zusammen,<\/P>
<\/P>
Ich stecke hier fest,<\/P>
<\/P>
Ich möchte eine Offline-Karte in meine Website einbinden, die in PHP ist und eine Html-Seite hat.
In der Html-Seite habe ich die Arcgis Map eingebunden und es wird auch die Bearbeitungsfunktionalität direkt dort bereitgestellt.
Aber ich möchte auch eine Offline-Bearbeitungsfunktionalität einbinden, so dass der Benutzer auch dann Features bearbeiten und im lokalen Speicher speichern kann, wenn das Internet ausfällt, und sobald das Internet wieder verfügbar ist, werden die Daten auf den Server aktualisiert. <\/P>
Ich habe viele Beispiele ausprobiert, aber keines hat für mich funktioniert.<\/P>
<\/P>
<\/P>
Hier ist mein html-Code <\/P>
<\/P>
<\/SPAN>f<\/SPAN> <\/SPAN><<\/SPAN>html<\/SPAN>><\/SPAN><\/DIV>
<<\/SPAN>head<\/SPAN>><\/SPAN><\/DIV> <\/SPAN><<\/SPAN>meta<\/SPAN> <\/SPAN>charset<\/SPAN>=<\/SPAN>"utf-8"<\/SPAN> <\/SPAN>\/><\/SPAN><\/DIV> <\/SPAN><<\/SPAN>meta<\/SPAN> <\/SPAN>name<\/SPAN>=<\/SPAN>"viewport"<\/SPAN> <\/SPAN>content<\/SPAN>=<\/SPAN>"initial-scale=1,maximum-scale=1,user-scalable=no"<\/SPAN> <\/SPAN>\/><\/SPAN><\/DIV> <\/SPAN><!--<\/SPAN><\/DIV> ArcGIS API for JavaScript, https:\/\/js.arcgis.com<\/SPAN><\/DIV> Für weitere Informationen über das Beispiel editing-groupedfeatureform lesen Sie die Originalbeschreibung unter developers.arcgis.com.<\/SPAN><\/DIV> https:\/\/developers.arcgis.com\/javascript\/latest\/sample-code\/editing-groupedfeatureform\/index.html<\/SPAN><\/DIV> --><\/SPAN><\/DIV> <\/SPAN><<\/SPAN>title<\/SPAN>><\/SPAN>Feature-Attribute aktualisieren - 4.12<\/SPAN><\/<\/span"><\/<\/<span class=\"token tag\">
style="color: #808080;">><\/SPAN><\/DIV>
<\/SPAN><!-- <script src="https:\/\/js.arcgis.com\/3.28\/"><\/script> --><\/SPAN><\/DIV> <\/SPAN><<\/SPAN>script<\/SPAN>><\/SPAN><\/DIV> <\/SPAN>require<\/SPAN>([<\/SPAN><\/DIV> <\/SPAN>"esri\/Map"<\/SPAN>,<\/SPAN><\/DIV> <\/SPAN>"esri\/views\/MapView"<\/SPAN>,<\/SPAN><\/DIV> <\/SPAN>"esri\/widgets\/FeatureForm"<\/SPAN>,<\/SPAN><\/DIV> <\/SPAN>"esri\/layers\/FeatureLayer"<\/SPAN>,<\/SPAN><\/DIV> <\/SPAN>"dojo\/domReady!"<\/SPAN>,<\/SPAN><\/DIV> <\/SPAN>"dojo\/_base\/json"<\/SPAN>,<\/SPAN><\/DIV> <\/SPAN>"esri\/symbols\/Symbol"<\/SPAN>,<\/SPAN><\/DIV> <\/SPAN>"esri\/symbols\/SimpleMarkerSymbol"<\/SPAN>,<\/SPAN><\/DIV> <\/SPAN>"esri\/symbols\/SimpleLineSymbol"<\/SPAN>,<\/SPAN><\/DIV> <\/SPAN>"dojo\/DeferredList"<\/SPAN><\/DIV> ], <\/SPAN>function<\/SPAN> (<\/SPAN>Map<\/SPAN>, <\/SPAN>MapView<\/SPAN>, <\/SPAN>FeatureForm<\/PAN... (truncated for brevity) ... <\/SPAN>"12px"<\/SPAN>,<\/SPAN><\/DIV> <\/SPAN>family:<\/SPAN> <\/SPAN>"Noto Sans"<\/SPAN>,<\/SPAN><\/DIV> <\/SPAN>style:<\/SPAN> <\/SPAN>"kursiv"<\/SPAN>,<\/SPAN><\/DIV> <\/SPAN>weight:<\/SPAN> <\/SPAN>"normal"<\/SPAN><\/DIV> }<\/SPAN><\/DIV> },<\/SPAN><\/DIV> <\/SPAN>labelPlacement:<\/SPAN> <\/SPAN>"oben-mitte"<\/SPAN>,<\/SPAN><\/DIV> <\/SPAN>labelExpressionInfo:<\/SPAN> {<\/SPAN><\/DIV> <\/SPAN>expression:<\/SPAN> <\/SPAN>"$feature.TRL_NAME"<\/SPAN><\/DIV> }<\/SPAN><\/DIV> };<\/SPAN><\/DIV>
<\/SPAN>\/\/_ Parks mit einem class breaks renderer und einzigartigen Symbolen hinzufügen<\/SPAN><\/DIV> <\/SPAN>function<\/SPAN> <\/SPAN>createFillSymbol<\/SPAN>(<\/SPAN>value<\/SPAN>, <\/SPAN>color<\/SPAN>) {<\/DIV>alert(value);
alert(color);
return {
"value": value,
"symbol": {
"color": color,
"type": "simple-marker",
"style": "circle",
"outline": {
"style": "none"
},
<\/SPAN>const<\/SPAN> <\/SPAN>form<\/SPAN> = <\/SPAN>new<\/SPAN> <\/SPAN>FeatureForm<\/SPAN>({<\/SPAN><\/DIV> <\/SPAN>container:<\/SPAN> <\/SPAN>\"form\"<\/SPAN>,<\/SPAN><\/DIV> <\/SPAN>\/\/groupDisplay: \"sequential\", \/\/ nur eine Gruppe gleichzeitig anzeigen<\/SPAN><\/DIV> <\/SPAN>layer:<\/SPAN> <\/SPAN>featureLayer<\/SPAN>,<\/SPAN><\/DIV> <\/SPAN>fieldConfig:<\/SPAN> [<\/SPAN><\/DIV> {<\/SPAN><\/DIV> <\/SPAN>\/\/ automatisch in FieldGroupConfig umwandelbar<\/SPAN><\/DIV> <\/SPAN>label:<\/SPAN> <\/SPAN>\"Inspector information\"<\/SPAN>, <\/SPAN>\/\/ Inspector-Gruppe<\/SPAN><\/DIV> <\/SPAN>description:<\/SPAN> <\/SPAN>\"Field inspector information\"<\/SPAN>,<\/SPAN><\/DIV> <\/SPAN>\/\/ individuelle Feldkonfigurationen innerhalb der Gruppe<\/SPAN><\/DIV> <\/SPAN>fieldConfig:<\/SPAN> [<\/SPAN><\/DIV> {<\/SPAN><\/DIV> \/\/ automatisch als FieldConfig umwandelbar<\/span>
name:<\span> \"TRL_NAME\",
label: \"TRL_NAME\"
#6a9955;">\/\/ }<\/SPAN><\/DIV>
<\/SPAN>\/\/ Funktion initEditor(results) {<\/SPAN><\/DIV> <\/SPAN>\/\/ var featureLayerInfos = dojo.map(results, function (result) {<\/SPAN><\/DIV> <\/SPAN>\/\/ return {<\/SPAN><\/DIV> <\/SPAN>\/\/ 'featureLayer': result.layer<\/SPAN><\/DIV> <\/SPAN>\/\/ };<\/SPAN><\/DIV> <\/SPAN>\/\/ });<\/SPAN><\/DIV> <\/SPAN>\/\/ featureLayer = results[0].layer;<\/SPAN><\/DIV> <\/SPAN>\/\/ var settings = {<\/SPAN><\/DIV> <\/SPAN>\/\/ map: map,<\/SPAN><\/DIV> <\/SPAN>\/\/ layerInfos: featureLayerInfos<\/SPAN><\/DIV> <\/SPAN>\/\/ };<\/SPAN><\/DIV>
<\/SPAN>\/\/ var params = {<\/SPAN><\/DIV> <\/SPAN>\/\/ settings: settings<\/SPAN><\/DIV> <\/SPAN>\/\/ };<\/SPAN><\/DIV> <\/SPAN>\/\/ var editorWidget = new esri.dijit.editing.Editor(params, 'editorDiv');<\/SPAN><\/DIV> <\/SPAN>\/\/ editorWidget.startup();<\/SPAN><\/DIV> <\/SPAN>\/\/ map.infoWindow.resize(290, 220);<\/SPAN><\/DIV> <\/Span> \/\/}<\/span> #d4d4d4;">.<\/SPAN>entfernen<\/SPAN>(<\/SPAN>"esri-hidden"<\/SPAN>);<\/SPAN><\/DIV> }<\/SPAN><\/DIV> }<\/SPAN><\/DIV> });<\/SPAN><\/DIV> }<\/SPAN><\/DIV>
<\/SPAN>// Lausche auf das submit-Ereignis des Feature-Formulars.<\/SPAN><\/DIV> <\/SPAN>form<\/SPAN>.<\/SPAN>on<\/SPAN>(<\/SPAN>"submit"<\/SPAN>, <\/SPAN>function<\/SPAN> () {<\/SPAN><\/DIV> <\/SPAN>debugger<\/SPAN><\/DIV> <\/SPAN>if<\/SPAN> (<\/SPAN>editFeature<\/SPAN>) {<\/SPAN><\/DIV> <\/SPAN>// Aktualisierte Attribute aus dem Formular abrufen.<\/SPAN><\/DIV> <\/SPAN>const<\/SPAN> <\/SPAN>updated<\/SPAN> = <\/SPAN>form<\/SPAN>.<\/SPAN>getValues<\/SPAN>();<\/SPAN><\/DIV>
<\/SPAN>// Durchlaufe die aktualisierten Attribute und weise<\/SPAN><\/DIV> <\/Span> // die aktualisierten Werte den Feature-Attributen zu.<\span>
</ span > < span st yle = \ " color
49 c 9 b 0 ; \ " > Object < / span > . < span st yle = \ " color
d c d c a a ; \ " > keys ( </ span > < span st yle = \ " color
9 c d c f e ; \ " > updated < / span > ) . < span st yle = \ " color
d c d c a a ; \ " > forEach ( </ span > < span st yle = \ " color
5 6 9 c d 6 ; \ " > function ( </ span > < span st yle = \ " color
9 c d c f e ; \ " > name < / span > ) { </ span > </ div > < div > < span st yle = \ " color
d 494 d 494 ;\ "> </ span > < span st yle = \ " color
9 c d c f e ; \ " > editFeature < / span > . < span st yle = \ " color
9 c d c f e ; \ " > attributes [ </ span > < span st yle = \ " color
9 c d c f e ; \ " > name < / span > ] = < span st yle = \ " color
9 c d c f e ; \ " > updated [ </ span > < span st yle = \ " color
9 c d c f e ; \ " > name < / span > ] ; </ span > </ div > < div > < span st yle = \ " color
d494 d494 ;\ "> }); // Richte den applyEdits-Parameter mit Updates ein.
const edits = {
updateFeatures: [
editFeature]
};
applyAttributeUpdates(
edits);
}
}); br /> div >
// Rufe FeatureLayer.applyEdits() mit angegebenen Parametern auf. div >
function applyAttributeUpdates(params) { div >
debugger div >
document.getElementById("btnUpdate").style.cursor = "progress"; div >
featureLayer div >
.applyEdits(params) div >
.then(function(editsResult) { div >
// Hole die objectId des neu hinzugefügten Features. div >
// Rufe die Funktion selectFeature auf, um das neue Feature hervorzuheben. div >
if (editsResult.addFeatureResults.length > 0) { div >
const objectId = editsResult.addFeatureResults[0].objectId; div >
selectFeature(objectId); div >
} div >
document.getElementById("btnUpdate").style.cursor = "pointer"; div >
}) div >
.catch(function(error) { div >
console.log("==============================================="); div >
console.error( div >
"[ applyEdits ] FEHLGESCHLAGEN: ", div >
error.code, div >
error.name, div >
error.message div >
div >console.log("Fehler =", error); style="color: #d4d4d4;">.<\/SPAN>getElementById<\/SPAN>(<\/SPAN>"btnUpdate"<\/SPAN>).<\/SPAN>style<\/SPAN>.<\/SPAN>cursor<\/SPAN> = <\/SPAN>"pointer"<\/SPAN>;<\/SPAN><\/DIV> });<\/SPAN><\/DIV> }<\/SPAN><\/DIV>
<\/SPAN>document<\/SPAN>.<\/SPAN>getElementById<\/SPAN>(<\/SPAN>"btnUpdate"<\/SPAN>).<\/SPAN>onclick<\/SPAN> = <\/SPAN>function<\/SPAN> () {<\/SPAN><\/DIV> <\/SPAN>\/\/ Löst das Absendeereignis des Feature-Formulars aus.<\/SPAN><\/DIV> <\/SPAN>form<\/SPAN>.<\/SPAN>submit<\/SPAN>();<\/SPAN><\/DIV> };<\/SPAN><\/DIV>
<\/SPAN>view<\/SPAN>.<\/SPAN>ui<\/SPAN>.<\/SPAN>add<\/SPAN>(<\/SPAN>"update"<\/SPAN>, <\/SPAN>"top-right"<\/SPAN>);<\/DIV> < \/span > v i e w < \/ s p a n >< s p a n s t y l e = " c o l o r : d 34 d 34 ; " > . < \/ s p a n >< s p a n s t y l e = " c o l o r : 9 c d c f e ; " > u i < \/ s p a n >< s p a n s t y l e = " c o l o r : d 34 d 34 ; " > . < \/ s p a n >< s p a n s t y l e = " c o l o r : d c d c a a ; " > a d d < \/ s p a n >< s p a n s t y l e = " c o l o r : d 34 d 34 ; " >( < \/ s p a n > " i n f o " < \/ s p a n > , { < \/ s p a n >< \/ d i v >< d i v >< s p a n s t y l e = " c o l o r : d 34 d 34 ; " > < \/ s p a n > p o s i t i o n : < \/ s p a n > < \/ s p a n > " t o p - l e f t " < \/ s p a n > , < \/ s p a n >< \/ d i v >< d i v > < \/ s p a n > i n d e x : < \/ s p a n >1< \/ span >< div >< span st yle=