fegyi001 / mangol

Maps created with Angular & OpenLayers using Material design
http://188.166.116.137/mangol/
98 stars 47 forks source link

defaultDataProjection changed to dataProjection (since 5.0.0) #26

Closed OSHistory closed 5 years ago

OSHistory commented 5 years ago

Hi there, I recently made an effort to provide basic typings for OL5 (https://github.com/OSHistory/generate_ol_types).

Using the resulting types (released under: https://github.com/OSHistory/generate_ol_types/releases/tag/v1.0.0-alpha.1) I managed to build your fine application/library. However I found some deprecated references to dataProjection (this branch).

For around 3 other issues i created a seperate branch called typeCompatible, which are due to missing Event-Types etc.

fegyi001 commented 5 years ago

@OSHistory Thanks for the fix! I merged it, since this is how the official ol/format/GeoJSON looks like. But using it together with @types/ol is problematic, since the type definitions there are still using defaultDataProjection instead of dataProjection. As a temporary workaround I created a pseudo GeoJSON constructor like this:

         //Excerpt from featureinfo.service.ts
         let format = new GeoJSON();
          if (dataProjection !== featureProjection) {
            const pseudoGeoJSONFormat = <any>GeoJSON;
            format = new pseudoGeoJSONFormat({
              dataProjection: dataProjection,
              featureProjection: featureProjection
            });
          }