Maps - editor form - geopoint CRUD

Hi,

How do I interact with the geopoint datatype in the form editor? So that when i click the map, a POI shows up & is stored?

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://jmix.io/schema/ui/window"
        xmlns:maps="http://jmix.io/schema/maps/ui"
        caption="msg://locationEdit.caption"
        focusComponent="form">
    <data>
        <instance id="locationDc"
                  class="com.automatize.rekegcrm.entity.Location">
            <fetchPlan extends="_base"/>
            <loader/>
        </instance>
    </data>
    <facets>
        <dataLoadCoordinator auto="true"/>
        <screenSettings id="settingsFacet" auto="true"/>
    </facets>
    <actions>
        <action id="windowCommitAndClose" caption="msg:///actions.Ok"
                icon="EDITOR_OK"
                primary="true"
                shortcut="${COMMIT_SHORTCUT}"/>
        <action id="windowClose"
                caption="msg:///actions.Close"
                icon="EDITOR_CANCEL"/>
    </actions>
    <dialogMode height="600"
                width="800"/>
    <layout spacing="true" expand="editActions">
        <scrollBox id="scrollBox" spacing="true">
            <form id="form" dataContainer="locationDc">
                <column width="350px">
                    <textField id="nameField" property="name"/>
                    <textField id="streetField" property="street"/>
                    <textField id="numberField" property="number"/>
                    <textField id="zipField" property="zip"/>
                    <textField id="cityField" property="city"/>
                    <comboBox id="countryField" property="country"/>
                    <comboBox id="typeField" property="type"/>
                    <maps:geoMap id="map" height="400px" width="600px" zoom="4">
                        <maps:layers>
                            <maps:tile id="tiles" tileProvider="map_OpenStreetMap"/>
                            <maps:vector id="geopointField" dataContainer="locationDc" editable="true"/>
                        </maps:layers>
                    </maps:geoMap>

                </column>
            </form>
        </scrollBox>
        <hbox id="editActions" spacing="true">
            <button id="commitAndCloseBtn" action="windowCommitAndClose"/>
            <button id="closeBtn" action="windowClose"/>
        </hbox>
    </layout>
</window>

Hi, @tim

You should specify the selectedLayer, i.e. the layer that you want to interact with (this includes editing).
In your case it is the layer with the location: geopointField.

<maps:layers selectedLayer="geopointField">
    <maps:tile id="tiles" tileProvider="map_OpenStreetMap"/>
    <maps:vector id="geopointField" dataContainer="locationDc" editable="true"/>
</maps:layers>

Regards,
Gleb

1 Like