Code Monkey home page Code Monkey logo

react-geo's Introduction

react-geo

npm version GitHub license Coverage Status GitHub action build Known Vulnerabilities PRs Welcome

react-geo is a JavaScript library providing a large number of components to build modern mapping applications. It is used in combination with React, OpenLayers and Ant Design.

Installation

npm i --save @terrestris/react-geo

Usage

For a full list of available components, their properties and examples see here.

TypeScript

The react-geo package includes TypeScript declarations as *.d.ts files.

Styling

react-geo supports dynamic theming via CSS variables and requires the following import inside your project.

@import '~antd/dist/antd.variable.min.css';

Workshop

For a comprehensive introduction into the usage of react-geo you might want to have a look at our tutorial.

Starter application

Also don't miss the create-react-geo-app (CRGA) to quickly create a fully working web-mapping application based on react-geo.

Contribution

Contributions are much appreciated! 🥳

Read the hints for developers to get started. We look forward to your contributions!

License

react-geo is released under the BSD 2-Clause license. Please see the file LICENSE in the root of this repository for more details.

react-geo's People

Contributors

ahennr avatar amir-ba avatar annarieger avatar buehner avatar dependabot-preview[bot] avatar dependabot[bot] avatar dnlkoch avatar fritzhoing avatar greenkeeper[bot] avatar greenkeeperio-bot avatar hblitza avatar hwbllmnn avatar jansule avatar jkeruzec avatar kaivolland avatar lukaslohoff avatar marcjansen avatar mholthausen avatar michaelsund avatar peterc66 avatar semantic-release-bot avatar sgoetsch avatar simonseyock avatar treffn avatar unraveler avatar weskamm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-geo's Issues

Unify css class-names for components

Every component should have its unique react-geo css-className.
Which could be configured in the upper area of the class definition.

Compare Legend class:
TOP:

export class Legend extends React.Component {


  /**
   * The className added to this component.
   * @type {String}
   * @private
   */
  className = 'react-geo-legend'

in render():

const className = this.props.className
  ? `${this.props.className} ${this.className}`
  : this.className;

return (
  <div className={className}>
    <img src={this.state.legendUrl} alt={alt} />
  </div>

DigitizeButton enhancements

  • Make style of digitize buttons configurable

  • Currently only stroke and fill colors can be provided as properties. We should make the whole OL style function configurable as well.

  • Add layer filter

WFS Search

Create a WFS-Search Component.

A general Search Component might be usefull which can be used for Nominatim aswell.

Features - RoadMap

Components

  • Button
    • SimpleButton #1
    • ToggleButton #1
    • ToggleGroup #1
    • MeasureButton #254 v1.3.0
    • DigitzeButton #377 v2.0.0
    • ZoomInButton
    • ZoomOutButton
    • ZoomToExtentButton
    • GeoLocationButton
  • CircleMenu
    • CircleMenu #218 v1.1.0
  • Field
    • NominatimSearch #93
    • ScaleCombo #15
    • CoordinateReferenceSystemCombo #244 v1.2.0
    • HoverTemplateField --> https://ant.design/components/mention/
    • RemoteSelectField (AutoComplete with remote data source -> url as Prop …)
    • WFSSearchField (Maybe composoable with NominatimSearch)
  • Grid
    • FeatureGrid #208
      • Rename to AttributeGrid
    • RemoteGrid (Grid with remote data source -> url as Prop …)
  • LayerTree
    • LayerTree #30
    • LayerTreeNode --> should be moved to LayerTree folder (see CircleMenuItem) #30
  • Legend
  • LayerPreview
    • LayerPreviewImage --> bismap
  • LoadingMask
    • LoadingMask --> bismap
  • Map
    • FloatingMapLogo #15
    • MapComponent #195
      • Drag & Drop Support
    • FeatureInfoPopup
  • Panel
  • Slider
    • LayerTransparencySlider #68
    • WMS-T Slider #314 v1.5.0
    • MultipleLayerSlider (FadeIn/FadeOut)
  • Toolbar
    • Toolbar #10
    • HotizontalToolbar (via. Toolbar property) #10
    • VerticalToolbar (via. Toolbar property) #10
  • Userchip
    • Userchip #4
  • LayerTree
    • LayerTree #30
  • Window
    • Window #289 v1.4.0

Container

  • CoordinateTransformationPanel
  • AddLayer-Components
    • AddWMS-Components #267 v1.4.0
    • AddWFS-Components

Utils

  • Csrf #2
  • AnimateUtil #377
  • CapabilitiesUtil #267
  • DigitizingUtil (WFS-T tools for drawing/digitizing tools)
  • FeatureUtil #30
  • MapUtil #12
  • ObjectUtil #9
  • ProjectionUtil #244
  • StringUtill #30
  • UndoUtil #11
  • UrlUtil #42
  • Logger #2

HOCs

  • VisibleComponent #14
  • MapProvider #195

WFS DescribeFeature utility methods

This came up as a possible enhancement during the implementation of the WfsSearch #563.

I think it would be very usable to have some methid to determine fields from the DescribeFeatureType response. Sth. like:

fieldsFromDescribeFeatureType(describeFeatureTypeResponse, filterFn) {
  // returns an array of field objects with name, datatype, min and max etc.
}
fieldsFromFeatureType(wfsUrl, featureTypeName, filterFn) {
  // returns a promise, and eventually an array of fields
  // issue the correct DescribeFeatureType Request,
  // once we have the response call the above method
}

If one only want the names, one could provide a fieldFn, which decides how a field should be represented.

We should additionally have some utilitues to only fetch string-like fields which can be used for LIKE searches.

ScaleCombo Example - typing in user-scale leads to 1:2

Tested directly on the example named above in FF (55.0.2), same behaviour in Chrome (61.0.3163.79)

When I type "233455" or even "1 : 233455" into the box (what I can do) and hit enter I end up with a scale of 1:2 - in the box AND for the map.

Running npm start fails to compile on master

As the title says, running npm start on the current master leads to:

ERROR in Map/ScaleCombo/ScaleCombo.js from UglifyJs
Unexpected token: name (urlParts) [(webpack)-dev-server/client?http:/localhost:8080:24,0][Map/ScaleCombo/ScaleCombo.js:21112,4]

ERROR in Slider/LayerTransparencySlider.js from UglifyJs
Unexpected token: name (urlParts) [(webpack)-dev-server/client?http:/localhost:8080:24,0][Slider/LayerTransparencySlider.js:21125,4]

ERROR in LayerTree/LayerTree.js from UglifyJs
Unexpected token: name (urlParts) [(webpack)-dev-server/client?http:/localhost:8080:24,0][LayerTree/LayerTree.js:20334,4]

ERROR in Legend/Legend.js from UglifyJs
Unexpected token: name (urlParts) [(webpack)-dev-server/client?http:/localhost:8080:24,0][Legend/Legend.js:18956,4]

ERROR in Panel/Panel/Panel.js from UglifyJs
Unexpected token: name (urlParts) [(webpack)-dev-server/client?http:/localhost:8080:24,0][Panel/Panel/Panel.js:16712,4]

ERROR in Button/ToggleGroup/ToggleGroup.js from UglifyJs
Unexpected token: name (urlParts) [(webpack)-dev-server/client?http:/localhost:8080:24,0][Button/ToggleGroup/ToggleGroup.js:16712,4]

ERROR in Toolbar/Toolbar.js from UglifyJs
Unexpected token: name (urlParts) [(webpack)-dev-server/client?http:/localhost:8080:24,0][Toolbar/Toolbar.js:16712,4]

ERROR in Panel/Titlebar/Titlebar.js from UglifyJs
Unexpected token: name (urlParts) [(webpack)-dev-server/client?http:/localhost:8080:24,0][Panel/Titlebar/Titlebar.js:16712,4]

ERROR in Button/ToggleButton/ToggleButton.js from UglifyJs
Unexpected token: name (urlParts) [(webpack)-dev-server/client?http:/localhost:8080:24,0][Button/ToggleButton/ToggleButton.js:16712,4]

ERROR in Button/SimpleButton/SimpleButton.js from UglifyJs
Unexpected token: name (urlParts) [(webpack)-dev-server/client?http:/localhost:8080:24,0][Button/SimpleButton/SimpleButton.js:16712,4]

ERROR in UserChip/UserChip.js from UglifyJs
Unexpected token: name (urlParts) [(webpack)-dev-server/client?http:/localhost:8080:24,0][UserChip/UserChip.js:16699,4]

ERROR in VisibleComponent/VisibleComponent.js from UglifyJs
Unexpected token: name (urlParts) [(webpack)-dev-server/client?http:/localhost:8080:24,0][VisibleComponent/VisibleComponent.js:15884,4]

ERROR in Map/FloatingMapLogo/FloatingMapLogo.js from UglifyJs
Unexpected token: name (urlParts) [(webpack)-dev-server/client?http:/localhost:8080:24,0][Map/FloatingMapLogo/FloatingMapLogo.js:14969,4]

webpack: Failed to compile

Visible Property in Components

Some components have a visible Property or something similiar in their propeties.
This might be an anitpattern as you can just avoid rendering a component with an appropriate check instead of setting a visible property. This runs useless code.

Titlebar Props and Styling

  • The titlebar doesn't pass the passThroughProps.
  • The "controls" span in the panel/title should have display flex or similar.

Make use of MapProvider

We should secure that we make use of the MapProvider and mappify in every realted example and test.

Provide style.css with dist

Currently we do not create an css file when building.

This means that you have to include a less-loader in your project (webpack).

If we would provide a compiled css file for all components you could easily include it without having a less-loader in your project.

Unify method declaration

The declaration of class methods should be unified:

GOOD:

  getLegendUrl() {
    []
  }

BAD:

  getLegendUrl = () => {
    []
  }

Use .bind() when scope is wrong.

API Doc improvements

The APi docs are semantically not correct.

e.g.: some propTypes and class methods are listed under global

Use ag-Grid instead of Ant table

As we discovered a lot of limitiations regarding the antd table component during development we should think about changing the underlying grid component to ag-Grid.

InstanceOf / use with Standard ol

We use the PropTypes.instanceOf(<SOMECLASS>) check in some classes.

I fear that this wont work with the standard ol: OlMap != ol.Map.
Do we want to support standard ol? If not we have to remove the basicMap.html examples...

SimpleButtons in ToggleGroup

Currently the SimpleButton gets a pressed prop if inside a ToggleGroup.
We need to add a further check in the render method of the ToggleGroup to avoid this unwanted behaviour.

LayerTree tests

Due to several problems there are currently a lot of outcommented tests in LayerTree.spec.jsx.

We should refactor the LayerTree/LayerTreeNode and fix/reintroduce theses tests.

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please delete the greenkeeper/initial branch in this repository, and then remove and re-add this repository to the Greenkeeper App’s white list on Github. You'll find this list on your repo or organization’s settings page, under Installed GitHub Apps.

Instanceof comparison

Babel will transpile imported classes for react-geo and other packages seperately.

So if you create an OlMap in any package it's not necessary an instanceof of the OlMap we use in react-geo even it relies on the same node_module.

Possible solution.

A custom instanceof util like:

isInstanceOf (instance, clazz) => {
  return (instance instanceof clazz) || instance.constructor.name === clazz.name;
}

But this will not work for inheritance. OlLayerTile will not be an instance of OlLayerBase which is wrong.

We may need an alternative solution for all our instanceOf checks. e.G. Try-Catch

Unify imports

We should unify the named imports. Especially for openlayers:

  1. ol imports by class/folder

Good:

import OlLayerTile from 'ol/layer/tile';

Bad:

import OlTileLayer from 'ol/layer/tile';
  1. No unneeded fileendings (*.jsx will still need it)
    Good:
import TestUtils from './TestUtils';

Bad:

import TestUtils from './TestUtils.js';

Switch to styled components

We should think about switching to styled components instead of less.

This would fix the requirement of a less-loader (#225) and would add more flexibility to the styles.

Upgrade to ol v5

As @ahocevar suggested in his FOSSGIS talk.

We should prepare the upgrade of ol. If i'm right the main change will be the import pathes. As the classes are now written in UpperCase.

Maybe this will be an API-breaking change…

Find more common name for Titlebar

A Titlebar component can be used not only in component header but also be placed somewhere else (e.g. as component footer) so we probably need less confusing name for it (something like HeaderOrFooterBar?)

ScaleCombo

The ScaleCombo needs some love... ;)

Duplicated keys, pass the map to selecte Callback, ...

MeasureButton bugs

1. Each button creates an own measurelayer. We should check if the map allready contains a measurelayer.

  1. Multiple Drawing doesn't act as expected. --> Tooltips disapper
  2. Check if Tooltip could be an seperate component.

Fix imports in examples

Currently our examples do the imports like (after the replacement):

import SimpleButton from 'react-geo';

this is wrong as we need named imports.

We should import the Components from the index.js just like we do it in the tests. We might need to adjust the replacement behaviour for the import string to.

Folder Structure refactoring

I'd like to refactor the Folder structure for Util and VisibleComponent.

  1. Every Util should have its own Folder where its *.js and *.spec.js lives. Just like we have it with the components. -> We should rename TestUtils to TestUtil if we're on the way. solved with #61
  2. I'd like to introduce a HOC folder that would contain the VisibleComponent.

less-loader setup requirement

less-loader must be installed and configured in the project that uses react-geo in order to use less-based styles.

Please add this note to Readme.md file.

Local npm registries / package-lock.json

Due to local overrides of the npm registry (e.g. to use an internal caching registry like verdaccio) made on workspaces that have been used to publish a react-geo release, there are at least two different registries listed in the package-lock.json in the main repo. This leads to merge conflicts in this file very often, e.g:

"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz"

vs.

"resolved": "http://10.133.7.204:4873/ansi-styles/-/ansi-styles-3.2.0.tgz"

To handle this, I suggest that we either update the internal publish script to set the correct npm registry before a release is being published or to disable the generation of the package-lock.json completely.

InternetExplorer (examples)

Which IE-Version do we want to support?

Currently our examples are not working in IE 11 we should fix this.

Revise the README

The README should revised in some aspects:

  • Fix outdated informations, e.g. it states karma as testing framework.
  • Add a minimal how-to (install with npm i @terrestris/react-geo and use with ES6 imports …).
  • Add an example webpack.config to the Requirements section.
  • Add FAQ, e.g. how to to use with npm link in dev environments.
  • Add development notes.

Enhance the setup docs -> canvas

I tried to get the Tests running on a Xubuntu machine, but all tests failed with a "canvas of null" error.
Solution for me was to replace canvas-prebuilt with canvas in package.json and then do an "npm i"

-    "canvas-prebuilt": "1.6.5-prerelease.1",
+    "canvas": "1.6.9",

We should investigate why the prebuilt version behaves this way...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.