How to display indoor.shp file in TileMill - osmdroid

I make indoor map with JOSM (.osm format) then i sucessfully convert them in to shapefile(.shp format). I want to convert them in to MBTiles format in order to display andorid application by using TileMill. When i upload my shp file in TileMill project , i cant see my map. Is there a way to show it? Thank you.
Here is my .shp file link
Map {
background-color: #b8dee6;
}
#countries {
::outline {
line-color: #85c5d3;
line-width: 2;
line-join: round;
}
polygon-fill: #fff;
}
#polygon.poly {
line-color:#594;
line-width:0.5;
polygon-opacity:1;
polygon-fill:#ae8;
}

JOSM to shp to MBTiles... For an indoor map... It seems a little bit complicated.
I imagine that your map is made of lines and polygons?
I could suggest that you (re)build your indoor map from scratch as a KML file (with Google Earth, or ArcGIS, or even with Google Maps).
Then you will be able to load this KML directly on an Android device:
either with Google Earth for Android
or with OSMNavigator application (based on OSMBonusPack+osmdroid)
or by writing your own application using OSMBonusPack+osmdroid libs.

Related

OMNeT ++ direct message transmission visualizations in 3D

I am new to OMNeT++ and I'm trying to implement a drone network that communicate with each other using direct messages.
I want to visualize my drone network with the 3D visualization in OMNeT using the OsgVisualizer in inet.visualizer.scene package.
In the dronenetwork.ned file, I have used the IntegratedVisualizer and the OsgGeographicCoordinateSystem. Then in the omnetpp.ini file, the map file to be used is defined and so the map loading and mobility of the drones works fine in the 3D visualization of the simulation run.
However, the message transmissions between the drones are not visualized in 3D even though this is properly visualized in the 2D canvas mode.
I tried adding both NetworkNodeOsgVisualizer and NetworkConnectionOsgVisualizer to my drone module as visualization simple modules and also I have defined the drones as a #networkNode and #networkConnectionNode. But it still hasn't been able to visualize the message transmissions.
Any help or hint regarding this would be highly appreciated.
Code used for visualizations in the simple module drone is as follows
import inet.visualizer.scene.NetworkNodeOsgVisualizer;
import inet.visualizer.scene.NetworkConnectionOsgVisualizer;
module drone
{
parameters:
#networkNode;
#networkConnection;
submodules:
networkNodeOsgVisualizer: NetworkNodeOsgVisualizer {
#display("p=207,50");
displayModuleName = true;
visualizationTargetModule = "^.^";
visualizationSubjectModule = "wirelessInterface.^.^";
}
networkConnectionOsgVisualizer : NetworkConnectionOsgVisualizer{
visualizationTargetModule = "^.^";
visualizationSubjectModule = "wirelessInterface.^.^";
displayNetworkConnections = true;
}
Thank you
Message passing and direct message sending visualizations are special cases implemented by the Qtenv automatically for 2D (default) visualization only. You can add custom 2D message visualization (like the one in the aloha example). OMNeT++ does not provide any 3D visualization by default. All the code must be provided by the model (INET in this case). This is also true for any transient visualization. There is an example for this in the osg-earth omnet example where communication between cows are visualized by inflating bubbles.
So, you have to implement your own visualization effect. There is something in INET which is pretty close to what you want: DataLinkOsgVisualizer and PhysicalLinkOsgVisualizer which flashes an arrow if communication on data link or physical layer has occurred. This is not the same as message passing, but close enough. Or you can implement your own animation using these visualizers as a sample.

OSMDroid offline maps not loading

Using osmdroid I am trying to build an offline mapping app.
I am using map tiles which I generated from a file server in PNG format. These are organised in the standard /x/y/z.png file/directory structure and compressed into a .zip file with the internal structure: /mapnik/x/y/z.png
The name of the .zip file is mapnik.zip (I understand the name of this file doesn't matter).
I installed my .apk by buiding it in Android Studio.
I have tried putting the .zip file in /storage/emulated/0/osmdroid and /storage/emulated/0/osmdroid/tiles which is where the cache.db and cache.db-journal files reside (this directory structure existed already).
When I run the app it runs but shows a blank grid instead of a map.
If I change map.setUseDataConnection(false); to (true) it loads the map over the internet and displays it.
Unfortunately I need this to run uniquely offline.
The code for this I got from https://github.com/TizioFittizio/OsmDroidOfflineMap
My MainActivity is as follows:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
MapView map = (MapView) findViewById(R.id.map);
map.setUseDataConnection(false);
map.setTileSource(TileSourceFactory.MAPNIK);
IMapController controller = map.getController();
GeoPoint startPoint = new GeoPoint(37.370925, -5.972684);
controller.setCenter(startPoint);
Marker startMarker = new Marker(map);
startMarker.setPosition(startPoint);
startMarker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM);
map.getOverlays().add(startMarker);
controller.setZoom(8);
map.setMinZoomLevel(6);
map.setMaxZoomLevel(15);
Does anybody know what I'm doing wrong?
Alternatively, has anyone else done this and did you use osmdroid? And if not, what did you use?
within your zip, it should have the following structure
/
/tileSource
/tileSource/0/0/0.png
where tile source, in your case, should be Mapnik exactly. i.e. map.setTileSource(TileSourceFactory.MAPNIK); must match the tile source name. Check out the source for TileSourceFactory to get an idea of how to create your own ITileSource. To get an idea of how the path is created, it is here.
there's also a sample dataset here which would use a tile source with the name of cb-wac
if you are still having problems,
Configuration.getInstance().setDebugMode(true));
Configuration.getInstance().setDebugTileProviders(true)); may help with debugging
Thanks to everybody who contributed. I'm totally new at Android dev so I'm grateful for people's patience.
This is working now.
My MainActivity.java is as follows:
#Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
map = (MapView) findViewById(R.id.map);
map.setTileSource(TileSourceFactory.MAPNIK);
map.setUseDataConnection(false);
map.getZoomController().setVisibility(CustomZoomButtonsController.Visibility.ALWAYS);
map.setMultiTouchControls(true);
IMapController mapController = map.getController();
mapController.setZoom(13.0);
map.setMinZoomLevel(7.0);
map.setMaxZoomLevel(19.0);
map.setClickable(true);
GeoPoint startPoint = new GeoPoint(37.3691, -5.97907);
mapController.setCenter(startPoint);
My .zip file is in /storage/emulated/0/osmdroid with the structure as describe EXCEPT that the root of the .zip file is /Mapnik/ ie. case-sensitive.
I am now moving on to overlaying shape files on my map. Wish me luck!

Modify Default properties on Paraview Properties Panel (5.7.0)

I try to modify the default value of a property in Paraview using a custom Plugin.
When I add a Dicom file in my pipeline, the default representation is set to "Outline" in the property panel, but I want it to be "Volume".
The goal is to interact with existing properties in Paraview
I git clone the paraview repository, and I used CMake to get the .sln file and compile it with Visual Studio. I do the same with example plugin provided by Paraview itself (like the toolbar or property widget to understand how it works), everything works for now.
But when I try to set the data representation to "volume", nothing work (no results, it still uniform.)
What i've tried (from my plugin):
pqApplicationCore* applicationCore = pqApplicationCore::instance();
pqObjectBuilder* objectBuilder = applicationCore->getObjectBuilder();
pqServerManagerModel* serverManagerModel = applicationCore->getServerManagerModel();
if (serverManagerModel->getNumberOfItems<pqServer*>() == 1)
{
// Getting the first (and only) server
pqServer* server = serverManagerModel->getItemAtIndex<pqServer*>(0);
//Creating a reader for dicom files
pqPipelineSource* pipelineSource =
objectBuilder->createReader("sources", "DICOMReader", { file }, server);
// Getting the first view
pqView* v = serverManagerModel->getItemAtIndex<pqView*>(0);
// Setting the data representation to Volume, at least, i try to set it.
pqDataRepresentation* data = objectBuilder->createDataRepresentation(
pipelineSource->getOutputPorts().at(0), v, "UniformGridRepresentation");
// SOLUTION
vtkSMPVRepresentationProxy::SetScalarColoring(data->getProxy(), "DICOMImage", vtkDataObject::POINT);
pqSMAdaptor::setEnumerationProperty(data->getProxy()->GetProperty("Representation"), "Volume");
// wrong
data->setProperty("VolumeRendering", "volume");
data->setVisible(true);
}
CMakeList.txt
set(interfaces)
set(sources
MyToolBar.cxx
MyToolBar.h
MyToolBarActions.cxx
MyToolBarActions.h)
paraview_plugin_add_action_group(…….)
paraview_plugin_add_toolbar(…..)
paraview_add_plugin(pluginName
VERSION "1.0"
UI_INTERFACES ${interfaces}
SOURCES ${sources})
target_link_libraries(cmakePluginName PRIVATE ParaView::ServerManagerRendering)
I expected the "Representation" field to be on "Volume" but still in "Outline"
I also tried to change the "UniformGridRepresentation" to something else, with no results, except weird things and crashes.
Any ideas?
The setProperty you used concern Qt property (this class inherits from QObject) and not ParaView Proxy property.
you should replace this line with the following:
edit: add the SetScalarColoring part
vtkSMPVRepresentationProxy::SetScalarColoring(data->getProxy(), <ArrayName>, vtkDataObject::POINT);
pqSMAdaptor::setEnumerationProperty(data->getProxy()->GetProperty("Representation"), "Volume");
<ArrayName> is the data you want to use for coloration. If not specified, a unique Solid Color is used but it is not available for volume rendering.
vtkDataObject::POINT can also be vtkDataObject::CELL if <ArrayName> is associated to the cells and not to the points.

C++ LibVLC Create Stream from Frames/Images

I want to use LibVLC for creating a Video from Images. As for now I have no experience with LibVLC.
I already Implemented a test Project like here (A simple C program to play mp3 using libvlc).
Is there any Way to create an Instance of "libvlc_media_t" and put images to it instead of calling "libvlc_media_new_path" to load a Video from a File?
Or are there any other Possibilities?
Create a media list and media play list in addition to a media player:
media_list_ = libvlc_media_list_new(vlc_instance_);
media_list_player_ = libvlc_media_list_player_new(vlc_instance_);
libvlc_media_list_player_set_media_list(media_list_player_, media_list_);
libvlc_media_list_player_set_media_player(media_list_player_, media_player_);
You can add image files to a vlc play list in the same way as you can add a video.
libvlc_media_t* media = libvlc_media_new_path(vlc_instance_, "image file");
if (media) {
libvlc_media_list_lock(media_list_);
libvlc_media_list_add_media(media_list_, media)
libvlc_media_list_unlock(media_list_);
}
You can then cycle through the images by using the following:
libvlc_media_list_player_play_item_at_index(media_list_player_, index)

Getting an incorrect permissions screen in the webview Blackberry 10 Cascades Beta 3 SDK in Dev Alpha Simulator

I am trying to make dynamically generated html 5 graphs show up in a webview in Blackberry 10 Cascades. I have confirmed the html5 that I have generated, draws the correct graphs. My problem is that when I try to implement this in the Blackberry 10 Cascades Beta 3 SDK (using the Blackberry 10 Dev Alpha Simulator), the webview that is supposed to show the graph, just looks like this:
Here is the code that leads to this error:
//html_ already contains the html-5 code to make the graph at this point in the code
//This is the file path to a local file that is actually accessable in the emulator
//and not just from Windows
//
QFile *chartFile = new QFile("app/native/assets/data/chart.html");
if (chartFile->open(QIODevice::WriteOnly)) {
chartFile->write(html_.toUtf8());
chartFile->flush();
chartFile->close();
}
if (chartFile) delete chartFile;
if (graphView_) {
graphView_->setHtml("");
graphView_->setUrl(QUrl::fromLocalFile("app/native/assets/data/chart.html"));
}
I checked the permissions of that file, put they are all Allow (777 permissions for those who know Unix style permissions).
I added access_internet to the bar-descriptor.xml, eventhough my app was already able to access remote sites, just to see if that would fix it, but it did not.
I've been searching around trying to find a solution to this problem, but I have not.
If anyone could help me out with this, it would be greatly appreciated.
-------------------------------------------------------
Update:
I changed the code to set the html directly, now I have this:
if (graphView_) {
graphView_->setHtml(html_, QUrl("app/native/assets/data/chart.html"));
}
But nothing shows. It seems I have the wrong relative path relative to my base url.
My base url is this: QUrl("app/native/assets/data/chart.html")
My relative paths all begin with: ./Highcharts/js/...
My relative paths are located under: app/native/assets/data/Highcharts/js
It seems to me that I this should work, but when I do this, I just a blank screen, as if it can not find my relative paths. So I don't know what's going on here either.
I found a solution that works. I'm using the first approach, not the updated approach, but instead of
graphView_->setUrl(QUrl("app/native/assets/data/chart.html"));
I'm using:
graphView_->setUrl(QUrl("local:///assets/data/chart.html"));
And I have left the rest of the code the same, and it works.