We really need a whole lot of examples on how to use Maps with FeatureCollections and in particular featurefromdescription
Please?
And what exactly do you plug INTO featurefromdescription ?
text list like?
This is by no means clear:-
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
FeatureFromDescription( description )
Converts a feature description into an App Inventor map feature. Points are converted into Marker components, LineStrings are converted into LineString components, and Polygons (and MultiPolygons) are converted into Polygon components. If the feature has properties, they will be mapped into App Inventor properties using the following mapping:
What are you trying to do Al? Knowing that, someone could provide specific advice.
MIT really does not provide a hand fed tutorial. For examples for your question you might start here. Read the examples; there are a few tutorials w.r.t. Markers. Also search the community forum for Maps, geojson, json, linestring, polygons etc. where you should find discussions about how to use specific Map components.
The National Parks tutorial) demonstrates how to plot multiple run time markers using a csv file to an OpenStreetMap. Use the list from csv Block to convert the csv to a List. What you do depends on how you make your List, where it is stored or is downloaded from.
. There are simpler ways to use the Block but one has to know where the information for the CreateMarker Block originates and how you intend to use the runtime marker. Often, it is simpler to just use one or two design time Markers.
FeatureFromDescription is intended to be used from within the context of GotFeatures event. The second parameter to that event, features is a list of feature descriptions parsed from GeoJSON. You can iterate over each element in this list to (optionally) manipulate or filter it before passing it to FeatureFromDescription. The elements of features are associative lists containing the key-value pairs from the GeoJSON for the given feature. (Maps predates the addition of dictionaries to the App Inventor language, otherwise they would have been dictionaries).
Note: If you don't provide an implementation for GotFeatures (i.e., you don't include the event block in your project), then the system will provide a default implementation that will pass each feature description directly to the method add the resulting component to the Map or FeatureCollection.
For CreateMarker, it creates a instance of Marker, adds it to the Map, and returns the marker, which you can pass to the "Any Marker" blocks, if further customization of the marker is desired. If you don't need to customize the marker, you can connect this block to the input of the evaluate but ignore result block.
FeatureFromDescription expects a single feature. You're handing it a list with a string "features" and then a feature description. You need to only hand it the latter.
The type should be "Feature", not "feature"
Lastly, for Polygon features the coordinates must be a list of linear ring coordinates arrays per the GeoJSON spec, so your coordinates need an extra make a list level to satisfy that constraint.
You made the same mistake. Point #3 is that you have to add an extra layer of make a list. My blocks image should be draggable into App Inventor for testing.
Are you sure that your blocks are correct? I believe GeoJSON uses the easting coordinate first then the northing coordinate. It was a bit of an API design failure on my part when I made the Points property use latitude (northing) first. You should also make sure that the winding order is correct so that points are visited clockwise around the polygon. Usually these types of artifacts are caused by not having the correct winding order.
I attempted switching lat and lon around but that built the polygon somewhere in the sea, a different shape but with the same issue.
Hopefully you can see that the lat/lon pairs are in the same "winding" order for the design time polygon (which makes a hexagon) as for the featurefromdescription polygon (which doesn't make a hexagon)
Had a play around, and it seems you were on the right lines with the order of eastings/northings.
I set some coordinates (in clockwise order) to draw a 4 sided polygon. Lo and behold, I got the criss-cross layout. Then I ordered the coordinates by latitude/northings (descending order) and, hey presto, the polygon drew as expected!
Don't worry about setting the coordinates you want when running FeatureFromDescription just set any coordinates you want (I used 0,0 three times), in order to generate the polygon component. Then use the anyComponent blocks for the Polygon (so you will need a silent designer polygon in place), to set the coordinates you do want.