mit-cml / appinventor-sources

MIT App Inventor Public Open Source
http://appinventor.mit.edu/appinventor-sources/
Apache License 2.0
1.47k stars 2.05k forks source link

loadfromURL "image" and "fill" errors (geojson filesfor map) #2681

Open onvaessayer opened 2 years ago

onvaessayer commented 2 years ago

mapLoadFrom URL reads a geoJSON file to display geoJSON features on a map.

1) bug with the "image" and the "fill" property :

"image" property is used to set geoJSON object icons on the map. If image property is a simple file name, it is searched in the app media (this works with png, jpg and most svg files). If image property is set as a full url "http://...", then icon is searched on the web. This works with jpg and png files but crashes when using a svg file on the web. sample geoJSON files to illustrate the problem are below with URL base ""

*loading this geojson file crashes : (extra character in fill hexa color code) http://onvaessayer.org/appinventor/apps/gitshare/resources/test/mapTest4fill.geojson

2) suggested upgrade/improvements to enable easy data edits and checks 2.1 add marker size parameter (large, medium, small) 2.2 use Github or geojson.io naming conventions to enable geojson file edit with these tools "marker-color": "#7e7e7e", (instead or added to "fill") "marker-size": "medium", (large,small) "marker-symbol": "" 2.3 include a default or standard icon set (see geojson.io for example)

Affects

Expected behavior

App should not crash, it may possibly ignore icon file or color code but not crash

Steps to reproduce

loadFromURL with sample geojson files + test app .aia at http://onvaessayer.org/appinventor/apps/gitshare/resources/test/

ewpatton commented 2 years ago

Thanks for the report. Indeed, it shouldn't be the case that this crashes the app so we will need to look into this. Possibly someone can tackle adding support for extra mappings of GeoJSON properties to App Inventor properties.

devarsh-mavani-19 commented 1 year ago

@onvaessayer can you share geojson files again. The links that you previously shared seems to be expired. I am interested in solving this.

onvaessayer commented 1 year ago

Thank you!

I wish to say (again) that you made an outstanding job with these map components. In connection with dictionaries, geojson, json & decoding, are becoming a fantastic tool for teaching mapping and data abstraction to Non CS

I wish to apologize for not sending datasets earlier. (See below with data and app repository) I'll get back to you in the coming days (~10) with comments on the way I use geojson maps and json.

Apps : App Inventor repository: http://onvaessayer.org/appinventor/apps/gitshare in version2a Map error management is analyzed in this tutorial http://onvaessayer.org/appinventor?video=gitshare (see english subtitles - time 46mn23 and on)

Data (geojson):

A list of geojson files that include several types of error : [image: image.png]

And a list of geojson files that have no error { "Paris flowers":"https://onvaessayer.github.io/flowers/map.geojson", "Paris restaurants":"https://onvaessayer.github.io/gitshareData3/map.geojson ", "Dropbox restaurants":" https://www.dropbox.com/s/p8oizwazpme7xpq/map.json?dl=1", "Google Drive restaurant": " https://drive.google.com/file/d/1im0UjN6umweZR7nJ1egobKk9edIGO5gK/view?usp=sharing ", "Cambridge restaurants":" https://onvaessayer.github.io/cambridgeData/map.geojson", "San Francisco restaurants":" https://onvaessayer.github.io/SanFrancisco/map.geojson", "sample errors":"https://onvaessayer.github.io/gitshareErrors1/map.geojson" }

I'll need an other week to clean up my comments on how to make this components fully adequate for teaching.

Regards Pierre

Le mer. 25 janv. 2023 à 07:10, 0xDEVARSH @.***> a écrit :

@ewpatton https://github.com/ewpatton this issue has 3 main sub-issues

  • Crashes when loading svg image
  • Crashes when using fill property (with extra hex character)
  • add marker-color & marker-size and rename image to marker-icon

I have fixed the first one and raised a PR (#2810 https://github.com/mit-cml/appinventor-sources/pull/2810). do you recommend to fix other 2 remaining sub-issues in same PR or a different PR should be raised for other 2 sub-issues?

— Reply to this email directly, view it on GitHub https://github.com/mit-cml/appinventor-sources/issues/2681#issuecomment-1403144640, or unsubscribe https://github.com/notifications/unsubscribe-auth/AY5IGGUJWWWHQWVAEDCE5IDWUC7UBANCNFSM5WSETQPA . You are receiving this because you were mentioned.Message ID: @.***>