In the controller set this projection to the map component. Pay attention, that this projection will be applied for all map components that are shown on the page. This will enable to use projection’s unit type in the whole Map component API.
In my use case, we have different entities with different projections. In the case, that one projection is applied to all map components on the page, it would make sense to use the standard EPSG:4326 projection and to have a converter to create from EPSG:21781 projection ( or anything else ) an EPSG:4326 projection.
If you have two GeoMap components on the same page, probably it would be easier. org.geotools has modules that provides classes to convert geometries from one CRS to another. We will check this case also while working on the issue.
Could you clarify what an issue do you face? The white screen instead of map component? If yes, you can try to delete:
src/main/bundle folder
frontend/generated folder
build folder (just in case)
Also clear cookies for localhost.
I’ve checked your project and I think there is a little issue. The projection you specify using map.setProjection() is EPSG:21781. It means that Map or its elements take the coordinates in specified projection. I saw mapView extent uses WGS84 coordinates and VectorLayer is bound with WGS84 property. So the Map thinks that property uses meter units and shows the point accordingly. And the same for the mapView extent.
For MapView extent you can use the following converted coordinates (EPSG:21781):
To show the point with WGS84 you need to convert coordinates to EPSG:21781 and store it in transient property.
I’ve prepared a demo project that demonstrates coordinates conversion. The project contains two entities:
PointBng: with transient pointWgs (WGS84) and point (EPSG:27700)
PointSwiss: with transient pointWgs (WGS84) and point (EPSG: 21781)
And there is a view with two Maps with default WGS84 projection. These maps are bound with pointWgs properties. Every entity converts coordinates from their projection to WGS84.
Hi Roman
Today I did want to open your sample and got the following error
A problem occurred configuring root project 'sample-2-2-0'.
> Could not resolve all files for configuration ':classpath'.
> Could not resolve io.jmix.gradle:jmix-gradle-plugin:2.2.1.1.
Required by:
project : > io.jmix:io.jmix.gradle.plugin:2.2.1.1
> No matching variant of io.jmix.gradle:jmix-gradle-plugin:2.2.1.1 was found. The consumer was configured to find a library for use during runtime, compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '8.6' but:
- Variant 'apiElements' capability io.jmix.gradle:jmix-gradle-plugin:2.2.1.1 declares a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component for use during compile-time, compatible with Java 17 and the consumer needed a component for use during runtime, compatible with Java 8
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '8.6')
- Variant 'javadocElements' capability io.jmix.gradle:jmix-gradle-plugin:2.2.1.1 declares a component for use during runtime, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library
- Other compatible attributes:
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about org.gradle.plugin.api-version (required '8.6')
- Variant 'runtimeElements' capability io.jmix.gradle:jmix-gradle-plugin:2.2.1.1 declares a library for use during runtime, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 8
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '8.6')
- Variant 'sourcesElements' capability io.jmix.gradle:jmix-gradle-plugin:2.2.1.1 declares a component for use during runtime, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library
- Other compatible attributes:
- Doesn't say anything about its target Java version (required compatibility with Java 8)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about org.gradle.plugin.api-version (required '8.6')
* Try:
> Review the variant matching algorithm at https://docs.gradle.org/8.6/userguide/variant_attributes.html#sec:abm_algorithm.
> No matching variant errors are explained in more detail at https://docs.gradle.org/8.6/userguide/variant_model.html#sub:variant-no-match.
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
How to solve this ?
Thank you for your help.
Felix
Jmix version: 2.2.3
Jmix Studio plugin version: 2.2.3-241
IntelliJ version: IntelliJ IDEA 2024.1.1 (Ultimate Edition)